View | Details | Raw Unified | Return to bug 162384 | Differences between
and this patch

Collapse All | Expand All

(-)calibre.new/Makefile (-2 / +1 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	calibre
8
PORTNAME=	calibre
9
PORTVERSION=	0.8.21
9
PORTVERSION=	0.8.26
10
PORTREVISION=	1
11
CATEGORIES=	deskutils python
10
CATEGORIES=	deskutils python
12
MASTER_SITES=	SF/${PORTNAME}/${PORTVERSION}/
11
MASTER_SITES=	SF/${PORTNAME}/${PORTVERSION}/
13
12
(-)calibre.new/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (calibre-0.8.21.tar.gz) = a688cfce1cc168e74fe28c0320b6e7534d238460211055ba5e2f544d31d2719c
1
SHA256 (calibre-0.8.26.tar.gz) = 59e713e126ddb5739bfe33acf52581ccad944a9f05c3e1d3d0b3958b4762f91a
2
SIZE (calibre-0.8.21.tar.gz) = 37419648
2
SIZE (calibre-0.8.26.tar.gz) = 37784724
(-)calibre.new/files/patch-device.py (-187 lines)
Lines 1-187 Link Here
1
--- src/calibre/devices/usbms/device.py.orig	2011-07-08 12:29:30.000000000 -0500
2
+++ src/calibre/devices/usbms/device.py	2011-07-12 20:02:45.000000000 -0500
3
@@ -704,14 +704,12 @@
4
 # ------------------------------------------------------
5
 #
6
 #  open for FreeBSD
7
-#   find the device node or nodes that match the S/N we already have from the scanner
8
-#   and attempt to mount each one
9
-#       1.  get list of disk devices from sysctl
10
-#       2.  compare that list with the one from camcontrol
11
-#       3.  and see if it has a matching s/n
12
-#       6.  find any partitions/slices associated with each node
13
-#       7.  attempt to mount, using calibre-mount-helper, each one
14
-#       8.  when finished, we have a list of mount points and associated device nodes
15
+#      find the device node or nodes that match the S/N we already have from the scanner
16
+#      and attempt to mount each one
17
+#              1.  get list of da devices in /dev
18
+#              2.  find the ones with matching s/n
19
+#              3.  attempt to mount each one using calibre-mount-helper
20
+#              4.  when finished, we have a list of mount points and associated device nodes
21
 #
22
     def open_freebsd(self):
23
 
24
@@ -722,81 +720,68 @@
25
         if not d.serial:
26
             raise DeviceError("Device has no S/N.  Can't continue")
27
             return False
28
-
29
+        
30
         devs={}
31
         di=0
32
-        ndevs=4     # number of possible devices per reader (main, carda, cardb, launcher)
33
-
34
-        #get list of disk devices
35
-        p=subprocess.Popen(["sysctl", "kern.disks"], stdout=subprocess.PIPE)
36
-        kdsks=subprocess.Popen(["sed", "s/kern.disks: //"], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
37
-        p.stdout.close()
38
-        #print kdsks
39
-        for dvc in kdsks.split():
40
-            # for each one that's also in the list of cam devices ...
41
-            p=subprocess.Popen(["camcontrol", "devlist"], stdout=subprocess.PIPE)
42
-            devmatch=subprocess.Popen(["grep", dvc], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
43
-            p.stdout.close()
44
-            if devmatch:
45
-                #print "Checking ", devmatch
46
-                # ... see if we can get a S/N from the actual device node
47
-                sn=subprocess.Popen(["camcontrol", "inquiry", dvc, "-S"], stdout=subprocess.PIPE).communicate()[0]
48
-                sn=sn[0:-1]             # drop the trailing newline
49
-                #print "S/N = ", sn
50
-                if sn and d.match_serial(sn):
51
-                    # we have a matching s/n, record this device node
52
-                    #print "match found: ", dvc
53
-                    devs[di]=dvc
54
-                    di += 1
55
-
56
-        # sort the list of devices
57
-        for i in range(1,ndevs+1):
58
-            for j in reversed(range(1,i)):
59
-                if devs[j-1] > devs[j]:
60
-                    x=devs[j-1]
61
-                    devs[j-1]=devs[j]
62
-                    devs[j]=x
63
-        #print devs
64
+        
65
+        # delay for user to set device if necessary
66
+        time.sleep(5)
67
 
68
+        # get list of disk devices and
69
+        # see if we can get a S/N from the actual device node
70
+        #dsks=['/dev/da1', '/dev/da3s1']
71
+        dsks=glob.glob('/dev/da*')
72
+        dsks.sort()
73
+        for ndvc in dsks:
74
+            dvc = ndvc.replace('/dev/', '')
75
+            print "FBSD:	Checking ", dvc
76
+            #sn="08004610011F550C"
77
+            try:
78
+                sn=subprocess.Popen("/sbin/camcontrol inquiry "+dvc+" -S", shell=True, stdout=subprocess.PIPE).communicate()[0]
79
+            except:
80
+                print "FBSD:	inquiry failed:"
81
+            sn=sn[0:-1]             # drop the trailing newline
82
+            print "FBSD:	S/N = ", sn
83
+            if sn and d.match_serial(sn):
84
+                # we have a matching s/n, record this device node
85
+                print "FBSD:	match found: ", dvc
86
+                devs[di]=dvc
87
+                di += 1
88
+        
89
+        print "FBSD:	", devs
90
+        
91
         # now we need to see if any of these have slices/partitions
92
         mtd=0
93
-        label="READER"      # could use something more unique, like S/N or productID...
94
+        label="READER"          # could use something more unique, like S/N or productID...
95
         cmd = '/usr/local/bin/calibre-mount-helper'
96
-        cmd = [cmd, 'mount']
97
-        for i in range(0,ndevs):
98
-            cmd2="ls /dev/"+devs[i]+"*"
99
-            p=subprocess.Popen(cmd2, shell=True, stdout=subprocess.PIPE)
100
-            devs[i]=subprocess.Popen(["cut", "-d", "/", "-f" "3"], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
101
-            p.stdout.close()
102
-
103
+        for i in range(0,di):
104
             # try all the nodes to see what we can mount
105
             for dev in devs[i].split():
106
-                mp='/media/'+label+'-'+dev
107
-                #print "trying ", dev, "on", mp
108
+                mp='/mnt/'+label+'-'+dev+'/'
109
+                print "FBSD:	trying ", dev, "on", mp
110
                 try:
111
-                    p = subprocess.Popen(cmd + ["/dev/"+dev, mp])
112
-                except OSError:
113
-                    raise DeviceError(_('Could not find mount helper: %s.')%cmd[0])
114
+                    p = subprocess.Popen([cmd, "mount", "/dev/"+dev, mp])
115
+                except:
116
+                    print "FBSD:	mount failed:"
117
                 while p.poll() is None:
118
                     time.sleep(0.1)
119
-
120
+    
121
                 if p.returncode == 0:
122
-                    #print "  mounted", dev
123
-                    if i == 0:
124
+                    print "FBSD:	  mounted", dev, "on", mp
125
+                    if mtd == 0:
126
                         self._main_prefix = mp
127
                         self._main_dev = "/dev/"+dev
128
-                        #print "main = ", self._main_dev, self._main_prefix
129
-                    if i == 1:
130
+                        print "FBSD:	main = ", self._main_dev, self._main_prefix
131
+                    if mtd == 1:
132
                         self._card_a_prefix = mp
133
                         self._card_a_dev = "/dev/"+dev
134
-                        #print "card a = ", self._card_a_dev, self._card_a_prefix
135
-                    if i == 2:
136
+                        print "FBSD:	card a = ", self._card_a_dev, self._card_a_prefix
137
+                    if mtd == 2:
138
                         self._card_b_prefix = mp
139
                         self._card_b_dev = "/dev/"+dev
140
-                        #print "card b = ", self._card_b_dev, self._card_b_prefix
141
-
142
+                        print "FBSD:	card b = ", self._card_b_dev, self._card_b_prefix
143
+                        break
144
                     mtd += 1
145
-                    break
146
 
147
         if mtd > 0:
148
             return True
149
@@ -805,16 +790,16 @@
150
 #
151
 # ------------------------------------------------------
152
 #
153
-#   this one is pretty simple:
154
-#       just umount each of the previously
155
-#       mounted filesystems, using the mount helper
156
+#    this one is pretty simple:
157
+#        just umount each of the previously
158
+#        mounted filesystems, using the mount helper
159
 #
160
     def eject_freebsd(self):
161
         cmd = '/usr/local/bin/calibre-mount-helper'
162
         cmd = [cmd, 'eject']
163
 
164
         if self._main_prefix:
165
-            #print "umount main:", cmd, self._main_dev, self._main_prefix
166
+            print "FBSD:	umount main:", cmd, self._main_dev, self._main_prefix
167
             try:
168
                 p = subprocess.Popen(cmd + [self._main_dev, self._main_prefix])
169
             except OSError:
170
@@ -824,7 +809,7 @@
171
                 time.sleep(0.1)
172
 
173
         if self._card_a_prefix:
174
-            #print "umount card a:", cmd, self._card_a_dev, self._card_a_prefix
175
+            print "FBSD:	umount card a:", cmd, self._card_a_dev, self._card_a_prefix
176
             try:
177
                 p = subprocess.Popen(cmd + [self._card_a_dev,  self._card_a_prefix])
178
             except OSError:
179
@@ -834,7 +819,7 @@
180
                 time.sleep(0.1)
181
 
182
         if self._card_b_prefix:
183
-            #print "umount card b:", cmd, self._card_b_dev, self._card_b_prefix
184
+            print "FBSD:	umount card b:", cmd, self._card_b_dev, self._card_b_prefix
185
             try:
186
                 p = subprocess.Popen(cmd + [self._card_b_dev, self._card_b_prefix])
187
             except OSError:
(-)calibre.new/files/patch-src_calibre_devices_linux_mount_helper.c (+230 lines)
Line 0 Link Here
1
--- src/calibre/devices/linux_mount_helper.c.orig	2011-11-11 23:22:34.000000000 -0500
2
+++ src/calibre/devices/linux_mount_helper.c	2011-11-16 13:06:45.000000000 -0500
3
@@ -1,7 +1,226 @@
4
 #include <stdlib.h>
5
+#include <stdio.h>
6
+#include <unistd.h>
7
+#include <string.h>
8
+#include <errno.h>
9
+#include <sys/types.h>
10
+#include <sys/stat.h>
11
+#include <sys/wait.h>
12
+#include <fcntl.h>
13
+
14
+#define MARKER ".created_by_calibre_mount_helper"
15
+#define False 0
16
+#define True 1
17
+
18
+int exists(const char *path) {
19
+    struct stat file_info;
20
+    if (stat(path, &file_info) == 0) return True;
21
+    return False;
22
+}
23
+
24
+int get_root() {
25
+    int res;
26
+    res = setreuid(0, 0);
27
+    if (res != 0) return False;
28
+    if (setregid(0, 0) != 0) return False;
29
+    return True;
30
+}
31
+
32
+void ensure_root() {
33
+    if (!get_root()) {
34
+        fprintf(stderr, "Failed to get root.\n");
35
+        exit(EXIT_FAILURE);
36
+    }
37
+}
38
+
39
+int do_mount(const char *dev, const char *mp) {
40
+    char options[1000], marker[2000];
41
+#ifdef __NetBSD__
42
+    char uids[100], gids[100];
43
+#endif
44
+    int errsv;
45
+
46
+    if (!exists(dev)) {
47
+        fprintf(stderr, "Specified device node does not exist\n");
48
+        return EXIT_FAILURE;
49
+    }
50
+    if (!exists(mp)) {
51
+        if (mkdir(mp, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) != 0) {
52
+            errsv = errno;
53
+            fprintf(stderr, "Failed to create mount point with error: %s\n", strerror(errsv));
54
+        }
55
+    }
56
+    snprintf(marker, 2000, "%s/%s", mp, MARKER);
57
+    if (!exists(marker)) {
58
+        int fd = creat(marker, S_IRUSR|S_IWUSR);
59
+        if (fd == -1) {
60
+            int errsv = errno;
61
+            fprintf(stderr, "Failed to create marker with error: %s\n", strerror(errsv));
62
+            return EXIT_FAILURE;
63
+        }
64
+        close(fd);
65
+    }
66
+#ifdef __NetBSD__
67
+    snprintf(options, 1000, "rw,noexec,nosuid,sync,nodev");
68
+    snprintf(uids, 100, "%d", getuid());
69
+    snprintf(gids, 100, "%d", getgid());
70
+#else
71
+#ifdef __FreeBSD__
72
+    snprintf(options, 1000, "rw,noexec,nosuid,sync,-u=%d,-g=%d",getuid(),getgid());
73
+#else
74
+    snprintf(options, 1000, "rw,noexec,nosuid,sync,nodev,quiet,shortname=mixed,uid=%d,gid=%d,umask=077,fmask=0177,dmask=0077,utf8,iocharset=iso8859-1", getuid(), getgid());
75
+#endif
76
+#endif
77
+
78
+    ensure_root();
79
+
80
+#ifdef __NetBSD__
81
+    execlp("mount_msdos", "mount_msdos", "-u", uids, "-g", gids, "-o", options, dev, mp, NULL);
82
+#else
83
+#ifdef __FreeBSD__
84
+    execl("/sbin/mount", "mount", "-t", "msdosfs", "-o", options, dev, mp, NULL);
85
+#else
86
+    execlp("mount", "mount", "-t", "auto", "-o", options, dev, mp, NULL);
87
+#endif
88
+#endif
89
+    errsv = errno;
90
+    fprintf(stderr, "Failed to mount with error: %s\n", strerror(errsv));
91
+    return EXIT_FAILURE;
92
+}
93
+
94
+int call_eject(const char *dev, const char *mp) {
95
+    int ret, pid, errsv, i, status = EXIT_FAILURE;
96
+
97
+    pid = fork();
98
+    if (pid == -1) {
99
+        fprintf(stderr, "Failed to fork\n");
100
+        exit(EXIT_FAILURE);
101
+    }
102
+
103
+    if (pid == 0) { /* Child process */
104
+        ensure_root();
105
+#ifdef __NetBSD__
106
+        execlp("eject", "eject", dev, NULL);
107
+#else
108
+#ifdef __FreeBSD__
109
+	execl("/sbin/umount", "umount", dev, NULL);
110
+#else
111
+        execlp("eject", "eject", "-s", dev, NULL);
112
+#endif
113
+#endif
114
+        /* execlp failed */
115
+        errsv = errno;
116
+        fprintf(stderr, "Failed to eject with error: %s\n", strerror(errsv));
117
+        exit(EXIT_FAILURE);
118
+    } else { /* Parent */
119
+        for (i = 0; i < 7; i++) {
120
+            sleep(1);
121
+            ret = waitpid(pid, &status, WNOHANG);
122
+            if (ret == -1) return False;
123
+            if (ret > 0) break;
124
+        }
125
+        return WIFEXITED(status) && WEXITSTATUS(status) == 0;
126
+    }
127
+    return False;
128
+}
129
+
130
+int call_umount(const char *dev, const char *mp) {
131
+    int ret, pid, errsv, i, status = EXIT_FAILURE;
132
+
133
+    pid = fork();
134
+    if (pid == -1) {
135
+        fprintf(stderr, "Failed to fork\n");
136
+        exit(EXIT_FAILURE);
137
+    }
138
+
139
+    if (pid == 0) { /* Child process */
140
+        ensure_root();
141
+#ifdef __FreeBSD__
142
+        execl("/sbin/umount", "umount", mp, NULL);
143
+#else
144
+        execlp("umount", "umount", "-l", mp, NULL);
145
+#endif
146
+        /* execlp failed */
147
+        errsv = errno;
148
+        fprintf(stderr, "Failed to umount with error: %s\n", strerror(errsv));
149
+        exit(EXIT_FAILURE);
150
+    } else { /* Parent */
151
+        for (i = 0; i < 7; i++) {
152
+            sleep(1);
153
+            ret = waitpid(pid, &status, WNOHANG);
154
+            if (ret == -1) return False;
155
+            if (ret > 0) break;
156
+        }
157
+        return WIFEXITED(status) && WEXITSTATUS(status) == 0;
158
+    }
159
+    return False;
160
+}
161
+
162
+int cleanup_mount_point(const char *mp) {
163
+    char marker[2000];
164
+    int urt, rmd, errsv;
165
+
166
+    snprintf(marker, 2000, "%s/%s", mp, MARKER);
167
+    if (exists(marker)) {
168
+        urt = unlink(marker);
169
+        if (urt == -1) {
170
+            errsv = errno;
171
+            fprintf(stderr, "Failed to unlink marker: %s\n", strerror(errsv));
172
+            return EXIT_FAILURE;
173
+        }
174
+    }
175
+    rmd = rmdir(mp);
176
+    if (rmd == -1) {
177
+        errsv = errno;
178
+        fprintf(stderr, "Failed to remove mount point: %s\n", strerror(errsv));
179
+        return EXIT_FAILURE;
180
+    }
181
+    return EXIT_SUCCESS;
182
+}
183
+
184
+int do_eject(const char *dev, const char *mp) {
185
+    int unmounted = False;
186
+
187
+    ensure_root();
188
+
189
+    unmounted = call_eject(dev, mp);
190
+    if (!unmounted) call_umount(dev, mp);
191
+    if (unmounted) return cleanup_mount_point(mp);
192
+    return EXIT_FAILURE;
193
+}
194
+
195
+int cleanup(const char *dev, const char *mp) {
196
+    ensure_root();
197
+    call_umount(dev, mp);
198
+    return cleanup_mount_point(mp);
199
+}
200
 
201
 int main(int argc, char** argv)
202
 {
203
-    return EXIT_FAILURE;
204
+    char *action, *dev, *mp;
205
+    int status = EXIT_FAILURE;
206
+
207
+    /*printf("Real UID\t= %d\n", getuid());
208
+    printf("Effective UID\t= %d\n", geteuid());
209
+    printf("Real GID\t= %d\n", getgid());
210
+    printf("Effective GID\t= %d\n", getegid());*/
211
+
212
+    if (argc != 4) {
213
+        fprintf(stderr, "Needs 3 arguments: action, device node and mount point\n");
214
+        exit(EXIT_FAILURE);
215
+    }
216
+    action = argv[1]; dev = argv[2]; mp = argv[3];
217
+
218
+    if (strncmp(action, "mount", 5) == 0) {
219
+        status = do_mount(dev, mp);
220
+    } else if (strncmp(action, "eject", 5) == 0) {
221
+        status = do_eject(dev, mp);
222
+    } else if (strncmp(action, "cleanup", 7) == 0) {
223
+        status = cleanup(dev, mp);
224
+    } else {
225
+        fprintf(stderr, "Unrecognized action: must be mount, eject or cleanup\n");
226
+    }
227
+ 
228
+    return status;
229
 }
230
 
(-)calibre.new/files/patch-src_calibre_devices_usbms_device.py (+173 lines)
Line 0 Link Here
1
--- src/calibre/devices/usbms/device.py.orig	2011-11-11 23:22:34.000000000 -0500
2
+++ src/calibre/devices/usbms/device.py	2011-11-16 17:20:57.000000000 -0500
3
@@ -700,14 +700,12 @@
4
 # ------------------------------------------------------
5
 #
6
 #  open for FreeBSD
7
-#   find the device node or nodes that match the S/N we already have from the scanner
8
-#   and attempt to mount each one
9
-#       1.  get list of disk devices from sysctl
10
-#       2.  compare that list with the one from camcontrol
11
-#       3.  and see if it has a matching s/n
12
-#       6.  find any partitions/slices associated with each node
13
-#       7.  attempt to mount, using calibre-mount-helper, each one
14
-#       8.  when finished, we have a list of mount points and associated device nodes
15
+#      find the device node or nodes that match the S/N we already have from the scanner
16
+#      and attempt to mount each one
17
+#              1.  get list of da devices in /dev
18
+#              2.  find the ones with matching s/n
19
+#              3.  attempt to mount each one using calibre-mount-helper
20
+#              4.  when finished, we have a list of mount points and associated device nodes
21
 #
22
     def open_freebsd(self):
23
 
24
@@ -721,81 +719,67 @@
25
 
26
         devs={}
27
         di=0
28
-        ndevs=4     # number of possible devices per reader (main, carda, cardb, launcher)
29
+        # delay for user to set device if necessary
30
+        time.sleep(5)
31
+
32
+        # get list of disk devices and
33
+        # see if we can get a S/N from the actual device node
34
+        #dsks=['/dev/da1', '/dev/da3s1']
35
+        dsks=glob.glob('/dev/da*')
36
+        dsks.sort()
37
+        for ndvc in dsks:
38
+            dvc = ndvc.replace('/dev/', '')
39
+            print "FBSD:       Checking ", dvc
40
+            #sn="08004610011F550C"
41
+            try:
42
+                sn=subprocess.Popen("/sbin/camcontrol inquiry "+dvc+" -S", shell=True, stdout=subprocess.PIPE).communicate()[0]
43
+            except:
44
+                print "FBSD:   inquiry failed:"
45
+            sn=sn[0:-1]             # drop the trailing newline
46
+            print "FBSD:       S/N = ", sn
47
+            if sn and d.match_serial(sn):
48
+                # we have a matching s/n, record this device node
49
+                print "FBSD:   match found: ", dvc
50
+                devs[di]=dvc
51
+                di += 1
52
 
53
-        #get list of disk devices
54
-        p=subprocess.Popen(["sysctl", "kern.disks"], stdout=subprocess.PIPE)
55
-        kdsks=subprocess.Popen(["sed", "s/kern.disks: //"], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
56
-        p.stdout.close()
57
-        #print kdsks
58
-        for dvc in kdsks.split():
59
-            # for each one that's also in the list of cam devices ...
60
-            p=subprocess.Popen(["camcontrol", "devlist"], stdout=subprocess.PIPE)
61
-            devmatch=subprocess.Popen(["grep", dvc], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
62
-            p.stdout.close()
63
-            if devmatch:
64
-                #print "Checking ", devmatch
65
-                # ... see if we can get a S/N from the actual device node
66
-                sn=subprocess.Popen(["camcontrol", "inquiry", dvc, "-S"], stdout=subprocess.PIPE).communicate()[0]
67
-                sn=sn[0:-1]             # drop the trailing newline
68
-                #print "S/N = ", sn
69
-                if sn and d.match_serial(sn):
70
-                    # we have a matching s/n, record this device node
71
-                    #print "match found: ", dvc
72
-                    devs[di]=dvc
73
-                    di += 1
74
-
75
-        # sort the list of devices
76
-        for i in range(1,ndevs+1):
77
-            for j in reversed(range(1,i)):
78
-                if devs[j-1] > devs[j]:
79
-                    x=devs[j-1]
80
-                    devs[j-1]=devs[j]
81
-                    devs[j]=x
82
-        #print devs
83
+        print "FBSD:   ", devs
84
 
85
         # now we need to see if any of these have slices/partitions
86
         mtd=0
87
-        label="READER"      # could use something more unique, like S/N or productID...
88
+        label="READER"          # could use something more unique, like S/N or productID...
89
         cmd = '/usr/local/bin/calibre-mount-helper'
90
-        cmd = [cmd, 'mount']
91
-        for i in range(0,ndevs):
92
-            cmd2="ls /dev/"+devs[i]+"*"
93
-            p=subprocess.Popen(cmd2, shell=True, stdout=subprocess.PIPE)
94
-            devs[i]=subprocess.Popen(["cut", "-d", "/", "-f" "3"], stdin=p.stdout, stdout=subprocess.PIPE).communicate()[0]
95
-            p.stdout.close()
96
-
97
+        for i in range(0,di):
98
             # try all the nodes to see what we can mount
99
             for dev in devs[i].split():
100
-                mp='/media/'+label+'-'+dev
101
-                mmp = mp
102
-                if mmp.endswith('/'):
103
-                    mmp = mmp[:-1]
104
+                mp='/mnt/'+label+'-'+dev
105
+                print "FBSD:   trying ", dev, "on", mp
106
+                #if mp is not None and mp.endswith('/'):
107
+                #    mp = mp[:-1]
108
                 #print "trying ", dev, "on", mp
109
                 try:
110
-                    p = subprocess.Popen(cmd + ["/dev/"+dev, mmp])
111
-                except OSError:
112
-                    raise DeviceError(_('Could not find mount helper: %s.')%cmd[0])
113
+                    p = subprocess.Popen([cmd, "mount", "/dev/"+dev, mp])
114
+                except:
115
+                    print "FBSD:       mount failed:"
116
                 while p.poll() is None:
117
                     time.sleep(0.1)
118
 
119
                 if p.returncode == 0:
120
-                    #print "  mounted", dev
121
-                    if i == 0:
122
+                    print "FBSD:         mounted", dev, "on", mp
123
+                    if mtd == 0:
124
                         self._main_prefix = mp
125
                         self._main_dev = "/dev/"+dev
126
-                        #print "main = ", self._main_dev, self._main_prefix
127
-                    if i == 1:
128
+                        print "FBSD:   main = ", self._main_dev, self._main_prefix
129
+                    if mtd == 1:
130
                         self._card_a_prefix = mp
131
                         self._card_a_dev = "/dev/"+dev
132
-                        #print "card a = ", self._card_a_dev, self._card_a_prefix
133
-                    if i == 2:
134
+                        print "FBSD:   card a = ", self._card_a_dev, self._card_a_prefix
135
+                    if mtd == 2:
136
                         self._card_b_prefix = mp
137
                         self._card_b_dev = "/dev/"+dev
138
-                        #print "card b = ", self._card_b_dev, self._card_b_prefix
139
-
140
+                        print "FBSD:   card b = ", self._card_b_dev, self._card_b_prefix
141
+                        break
142
                     mtd += 1
143
-                    break
144
 
145
         if mtd > 0:
146
             return True
147
@@ -813,7 +797,7 @@
148
         cmd = [cmd, 'eject']
149
 
150
         if self._main_prefix:
151
-            #print "umount main:", cmd, self._main_dev, self._main_prefix
152
+            print "FBSD:       umount main:", cmd, self._main_dev, self._main_prefix
153
             try:
154
                 p = subprocess.Popen(cmd + [self._main_dev, self._main_prefix])
155
             except OSError:
156
@@ -823,7 +807,7 @@
157
                 time.sleep(0.1)
158
 
159
         if self._card_a_prefix:
160
-            #print "umount card a:", cmd, self._card_a_dev, self._card_a_prefix
161
+            print "FBSD:       umount card a:", cmd, self._card_a_dev, self._card_a_prefix
162
             try:
163
                 p = subprocess.Popen(cmd + [self._card_a_dev,  self._card_a_prefix])
164
             except OSError:
165
@@ -833,7 +817,7 @@
166
                 time.sleep(0.1)
167
 
168
         if self._card_b_prefix:
169
-            #print "umount card b:", cmd, self._card_b_dev, self._card_b_prefix
170
+            print "FBSD:       umount card b:", cmd, self._card_b_dev, self._card_b_prefix
171
             try:
172
                 p = subprocess.Popen(cmd + [self._card_b_dev, self._card_b_prefix])
173
             except OSError:
(-)calibre.new/files/patch-src_calibre_devices_usbms_driver.py (+23 lines)
Line 0 Link Here
1
--- src/calibre/devices/usbms/driver.py.orig	2011-11-11 23:22:34.000000000 -0500
2
+++ src/calibre/devices/usbms/driver.py	2011-11-16 17:46:30.000000000 -0500
3
@@ -150,6 +150,11 @@
4
                                      self._card_b_prefix if oncard == 'cardb' \
5
                                                          else self._main_prefix
6
 
7
+	# force type of prefix to str, else
8
+	# normalize_path() in posixpath.py later on fails
9
+	if prefix is None:
10
+	    prefix = ''
11
+
12
         ebook_dirs = self.get_carda_ebook_dir() if oncard == 'carda' else \
13
             self.EBOOK_DIR_CARD_B if oncard == 'cardb' else \
14
             self.get_main_ebook_dir()
15
@@ -371,7 +376,7 @@
16
         debug_print('USBMS: starting sync_booklists')
17
         json_codec = JsonCodec()
18
 
19
-        if not os.path.exists(self.normalize_path(self._main_prefix)):
20
+	if self._main_prefix is not None and not os.path.exists(self.normalize_path(self._main_prefix)):
21
             os.makedirs(self.normalize_path(self._main_prefix))
22
 
23
         def write_prefix(prefix, listid):
(-)calibre.new/files/patch-src_calibre_ebooks_pdf_reflow.cpp (-14 lines)
Lines 1-14 Link Here
1
--- src/calibre/ebooks/pdf/reflow.cpp.orig	2011-10-26 01:52:43.000000000 +0000
2
+++ src/calibre/ebooks/pdf/reflow.cpp	2011-10-26 12:02:17.000000000 +0000
3
@@ -625,11 +625,7 @@ static string get_link_dest(LinkAction *
4
   return oss.str();
5
 }
6
 
7
-#if (POPPLER_MAJOR_VERSION == 0) && (POPPLER_MINOR_VERSION < 17)
8
-void XMLOutputDev::process_link(Link* link){
9
-#else
10
 void XMLOutputDev::process_link(AnnotLink* link){
11
-#endif
12
 
13
   double _x1, _y1, _x2, _y2;
14
   int x1, y1, x2, y2;
(-)calibre.new/files/patch-src_calibre_ebooks_pdf_reflow.h (-14 lines)
Lines 1-14 Link Here
1
--- src/calibre/ebooks/pdf/reflow.h.orig	2011-10-26 12:04:54.000000000 +0000
2
+++ src/calibre/ebooks/pdf/reflow.h	2011-10-26 12:09:04.000000000 +0000
3
@@ -244,11 +244,7 @@ class XMLOutputDev : public OutputDev {
4
     XMLImages *images;
5
     PDFDoc *doc;
6
 
7
-#if (POPPLER_MAJOR_VERSION == 0) && (POPPLER_MINOR_VERSION < 17)
8
-    void process_link(Link* link);
9
-#else
10
     void process_link(AnnotLink* link);
11
-#endif
12
 
13
 };
14
 }
(-)calibre.new/pkg-descr (-1 / +1 lines)
Lines 3-6 Link Here
3
as well as e-book reader sync features and an integrated e-book viewer.
3
as well as e-book reader sync features and an integrated e-book viewer.
4
4
5
Author:	Kovid Goyal <kovid@kovidgoyal.net>
5
Author:	Kovid Goyal <kovid@kovidgoyal.net>
6
WWW:	http://calibre.kovidgoyal.net/
6
WWW:	http://calibre-ebook.com
(-)calibre.new/pkg-message (+9 lines)
Line 0 Link Here
1
--------------------------------------------------------------------
2
3
Please note that if connecting Calibre to an android device, then
4
you must use either the WordPlayer or Aldiko ebook reading apps from
5
the Android Marketplace.  See the following URL for more information
6
7
http://manual.calibre-ebook.com/faq.html#how-do-i-use-app-with-my-android-phone-tablet
8
9
--------------------------------------------------------------------
(-)calibre.new/pkg-plist (+14 lines)
Lines 77-82 Link Here
77
lib/calibre/calibre/devices/kobo/__init__.py
77
lib/calibre/calibre/devices/kobo/__init__.py
78
lib/calibre/calibre/devices/kobo/books.py
78
lib/calibre/calibre/devices/kobo/books.py
79
lib/calibre/calibre/devices/kobo/driver.py
79
lib/calibre/calibre/devices/kobo/driver.py
80
lib/calibre/calibre/devices/kobo/bookmark.py
80
lib/calibre/calibre/devices/libusb.py
81
lib/calibre/calibre/devices/libusb.py
81
lib/calibre/calibre/devices/manager.py
82
lib/calibre/calibre/devices/manager.py
82
lib/calibre/calibre/devices/mime.py
83
lib/calibre/calibre/devices/mime.py
Lines 96-101 Link Here
96
lib/calibre/calibre/devices/prs505/__init__.py
97
lib/calibre/calibre/devices/prs505/__init__.py
97
lib/calibre/calibre/devices/prs505/driver.py
98
lib/calibre/calibre/devices/prs505/driver.py
98
lib/calibre/calibre/devices/prs505/sony_cache.py
99
lib/calibre/calibre/devices/prs505/sony_cache.py
100
lib/calibre/calibre/devices/prst1/__init__.py
101
lib/calibre/calibre/devices/prst1/driver.py
99
lib/calibre/calibre/devices/scanner.py
102
lib/calibre/calibre/devices/scanner.py
100
lib/calibre/calibre/devices/sne/__init__.py
103
lib/calibre/calibre/devices/sne/__init__.py
101
lib/calibre/calibre/devices/sne/driver.py
104
lib/calibre/calibre/devices/sne/driver.py
Lines 179-184 Link Here
179
lib/calibre/calibre/ebooks/conversion/preprocess.py
182
lib/calibre/calibre/ebooks/conversion/preprocess.py
180
lib/calibre/calibre/ebooks/conversion/utils.py
183
lib/calibre/calibre/ebooks/conversion/utils.py
181
lib/calibre/calibre/ebooks/cssselect.py
184
lib/calibre/calibre/ebooks/cssselect.py
185
lib/calibre/calibre/ebooks/djvu/__init__.py
186
lib/calibre/calibre/ebooks/djvu/djvubzzdec.py
187
lib/calibre/calibre/ebooks/djvu/djvu.py
188
lib/calibre/calibre/ebooks/djvu/input.py
182
lib/calibre/calibre/ebooks/epub/__init__.py
189
lib/calibre/calibre/ebooks/epub/__init__.py
183
lib/calibre/calibre/ebooks/epub/fix/__init__.py
190
lib/calibre/calibre/ebooks/epub/fix/__init__.py
184
lib/calibre/calibre/ebooks/epub/fix/container.py
191
lib/calibre/calibre/ebooks/epub/fix/container.py
Lines 546-551 Link Here
546
lib/calibre/calibre/gui2/convert/comic_input_ui.py
553
lib/calibre/calibre/gui2/convert/comic_input_ui.py
547
lib/calibre/calibre/gui2/convert/debug.py
554
lib/calibre/calibre/gui2/convert/debug.py
548
lib/calibre/calibre/gui2/convert/debug_ui.py
555
lib/calibre/calibre/gui2/convert/debug_ui.py
556
lib/calibre/calibre/gui2/convert/djvu_input_ui.py
557
lib/calibre/calibre/gui2/convert/djvu_input.py
549
lib/calibre/calibre/gui2/convert/epub_output.py
558
lib/calibre/calibre/gui2/convert/epub_output.py
550
lib/calibre/calibre/gui2/convert/epub_output_ui.py
559
lib/calibre/calibre/gui2/convert/epub_output_ui.py
551
lib/calibre/calibre/gui2/convert/fb2_input.py
560
lib/calibre/calibre/gui2/convert/fb2_input.py
Lines 766-772 Link Here
766
lib/calibre/calibre/gui2/store/opensearch_store.py
775
lib/calibre/calibre/gui2/store/opensearch_store.py
767
lib/calibre/calibre/gui2/store/web_store_dialog.py
776
lib/calibre/calibre/gui2/store/web_store_dialog.py
768
lib/calibre/calibre/gui2/store/basic_config_widget_ui.py
777
lib/calibre/calibre/gui2/store/basic_config_widget_ui.py
778
lib/calibre/calibre/gui2/store/stores/amazon_fr_plugin.py
769
lib/calibre/calibre/gui2/store/stores/beam_ebooks_de_plugin.py
779
lib/calibre/calibre/gui2/store/stores/beam_ebooks_de_plugin.py
780
lib/calibre/calibre/gui2/store/stores/ebookpoint_plugin.py
770
lib/calibre/calibre/gui2/store/stores/escapemagazine_plugin.py
781
lib/calibre/calibre/gui2/store/stores/escapemagazine_plugin.py
771
lib/calibre/calibre/gui2/store/stores/gandalf_plugin.py
782
lib/calibre/calibre/gui2/store/stores/gandalf_plugin.py
772
lib/calibre/calibre/gui2/store/stores/pragmatic_bookshelf_plugin.py
783
lib/calibre/calibre/gui2/store/stores/pragmatic_bookshelf_plugin.py
Lines 1218-1223 Link Here
1218
share/calibre/images/debug.png
1229
share/calibre/images/debug.png
1219
share/calibre/images/default_cover.png
1230
share/calibre/images/default_cover.png
1220
share/calibre/images/devices/bambook.png
1231
share/calibre/images/devices/bambook.png
1232
share/calibre/images/devices/boox.jpg
1221
share/calibre/images/devices/folder.png
1233
share/calibre/images/devices/folder.png
1222
share/calibre/images/devices/ipad.png
1234
share/calibre/images/devices/ipad.png
1223
share/calibre/images/devices/italica.png
1235
share/calibre/images/devices/italica.png
Lines 1548-1553 Link Here
1548
@dirrm lib/calibre/calibre/ebooks/fb2
1560
@dirrm lib/calibre/calibre/ebooks/fb2
1549
@dirrm lib/calibre/calibre/ebooks/epub/fix
1561
@dirrm lib/calibre/calibre/ebooks/epub/fix
1550
@dirrm lib/calibre/calibre/ebooks/epub
1562
@dirrm lib/calibre/calibre/ebooks/epub
1563
@dirrm lib/calibre/calibre/ebooks/djvu
1551
@dirrm lib/calibre/calibre/ebooks/conversion
1564
@dirrm lib/calibre/calibre/ebooks/conversion
1552
@dirrm lib/calibre/calibre/ebooks/compression
1565
@dirrm lib/calibre/calibre/ebooks/compression
1553
@dirrm lib/calibre/calibre/ebooks/comic
1566
@dirrm lib/calibre/calibre/ebooks/comic
Lines 1565-1570 Link Here
1565
@dirrm lib/calibre/calibre/devices/prs505
1578
@dirrm lib/calibre/calibre/devices/prs505
1566
@dirrm lib/calibre/calibre/devices/prs500/cli
1579
@dirrm lib/calibre/calibre/devices/prs500/cli
1567
@dirrm lib/calibre/calibre/devices/prs500
1580
@dirrm lib/calibre/calibre/devices/prs500
1581
@dirrm lib/calibre/calibre/devices/prst1
1568
@dirrm lib/calibre/calibre/devices/nuut2
1582
@dirrm lib/calibre/calibre/devices/nuut2
1569
@dirrm lib/calibre/calibre/devices/nook
1583
@dirrm lib/calibre/calibre/devices/nook
1570
@dirrm lib/calibre/calibre/devices/nokia
1584
@dirrm lib/calibre/calibre/devices/nokia

Return to bug 162384