Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, is there any news on this bugs? I wonder if it could be possibile to activate pthread to solve this problem. I have a patch now, but it's so ugly that I'm still not sure I want to release that in the wild. I'm actually poking into the internals of libusb. libusb can change any day and all hell will break loose. In Debian's context I can pay attention to that, but still it's very fragile and a complete HACK. By the way, could you please try to find out which other app on your system is buggy wrt ftok() usage and uses an IPC key of 0x? You can look that up in the ipcs -p output. JB. -- Julien BLACHE - Debian GNU/Linux Developer - [EMAIL PROTECTED] Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Hi Julien, Il giorno ven, 14/03/2008 alle 22.03 +0100, Julien BLACHE ha scritto: [...] By the way, could you please try to find out which other app on your system is buggy wrt ftok() usage and uses an IPC key of 0x? You can look that up in the ipcs -p output. I don't know. I am using the same machine right now but I cannot reproduce the error, nor I can find any 0x IPC key :-( If I'll find any process with such a key during next days, I will let you know. Bye, Giuseppe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, is there any news on this bugs? I wonder if it could be possibile to activate pthread to solve this problem. Sadly no, not much is happening on this front. Activating pthread is guaranteed to have side effects on the frontends, and such side effects won't be detected and fixed in time for the release, I'm afraid. I can't do that. I have the best part of a patch in the works to get back the device path and use that, fortunately this is only needed on Unix-like platforms, and I can certainly cover Linux FreeBSD without any issue as far as Debian is concerned. I need to get back at that patch, not that I like it very much as it's quite a hack (unfortunately libusb doesn't keep track of the device node it's used, so it's not possible to get it back from libusb). JB. -- Julien BLACHE [EMAIL PROTECTED] | Debian, because code matters more Debian GNU/Linux Developer| http://www.debian.org Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
If you may like it, I could test and maybe complete the patch you are working on. Bye, Giuseppe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Giuseppe Sacco [EMAIL PROTECTED] wrote: If you may like it, I could test and maybe complete the patch you are working on. I had just found a better solution, but then I realised that this patch (and the previous one) had side effects wrt the USB device and hence isn't suitable at all. I was that close from having a nice fix for this issue. Back to the drawing board. JB. -- Julien BLACHE [EMAIL PROTECTED] | Debian, because code matters more Debian GNU/Linux Developer| http://www.debian.org Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Hi Julien, is there any news on this bugs? I wonder if it could be possibile to activate pthread to solve this problem. Bye, Giuseppe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
tags 466855 +patch thanks Hi all, Il giorno sab, 23/02/2008 alle 15.05 +0100, Julien BLACHE ha scritto: Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, [snapscan] add_usb_device(libusb:001:002) [snapscan] add_usb_device: Detected (kind of) an USB device [snapscan] snapscani_usb_open(libusb:001:002) [snapscan] snapscani_usb_open: Can't get semaphore [snapscan] add_usb_device: error opening device libusb:001:002: Invalid argument Oliver, this happens on PowerPC with SANE 1.0.19. Any idea about what's going on here ? I think I found the problem, while I do not have any solution right now. The semaphore implementation used on linux/powerpc is not the pthread one, so the semaphore creation is done via static int snapscani_mutex_open(snapscan_mutex_t* sem_id, const char* dev) { *sem_id = semget( ftok(dev,0x12), 1, IPC_CREAT | 0660 ); if (*sem_id != -1) { semop(*sem_id, sem_signal, 1); return 1; } return 0; } This is a problem when dev is not a pathname. In my case dev=libusb:001:003 and this means ftok() returns -1, so that even semget() will return an error (Permission denied). Accourding to the ftok(3) manual page, the first argument must refer to an existing, accessible file. So, probably, we have to find a way to get a pathname like /dev/bus/usb/001/003 from libusb, or create a faked one. The following patch make the program working in this peculiar case. I don't know if this is a general solution, or if this might create new bugs. static int snapscani_mutex_open(snapscan_mutex_t* sem_id, const char* dev) { char x[24]; /* dev=libusb:001:003 01234567890123 */ if (strncmp(dev, libusb:, 7) == 0) { strcpy(x, /dev/bus/usb/); strncat(x, dev[7], 3); strcat(x, /); strncat(x, dev[11], 3); dev=x; } *sem_id = semget( ftok(dev,0x12), 1, IPC_CREAT | 0660 ); if (*sem_id != -1) { semop(*sem_id, sem_signal, 1); return 1; } return 0; } Bye, Giuseppe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
tag 466855 - patch thanks Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, I think I found the problem, while I do not have any solution right now. The semaphore implementation used on linux/powerpc is not the pthread one, so the semaphore creation is done via This is a problem when dev is not a pathname. In my case dev=libusb:001:003 and this means ftok() returns -1, so that even semget() will return an error (Permission denied). The following patch make the program working in this peculiar case. I don't know if this is a general solution, or if this might create new bugs. That solution is not acceptable, as it's not generic enough. Sorry, we'll have to find something else. JB. -- Julien BLACHE [EMAIL PROTECTED] | Debian, because code matters more Debian GNU/Linux Developer| http://www.debian.org Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, Version: 1.0.19~cvs20071213-5 Can you try 1.0.19-1 in unstable ? JB. -- Julien BLACHE - Debian GNU/Linux Developer - [EMAIL PROTECTED] Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Hi Julien, with latest version I get this log: [sanei_debug] Setting debug level of snapscan to 255. [snapscan] sane_snapscan_init [snapscan] sane_snapscan_init: Snapscan backend version 1.4.53 [sanei_debug] Setting debug level of sanei_usb to 255. [sanei_usb] sanei_usb_init: Looking for kernel scanner devices [sanei_usb] sanei_usb_init: can't stat /dev/usb/: No such file or directory [sanei_usb] sanei_usb_init: Looking for libusb devices usb_os_init: Found USB VFS at /dev/bus/usb usb_set_debug: Setting debugging level to 255 (on) [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: found libusb device (0x04b8/0x011f) interface 0 at libusb:001:002 [sanei_usb] sanei_usb_init: found 1 devices [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a20 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a26 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2022 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a2a [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2040 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2060 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x207e [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20be [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20c0 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20b0 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20de [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20f8 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20fc [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20fe [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2137 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x0002 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x0001 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2061 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2093 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2091 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2095 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2097 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x208d [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x20ff [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x208f [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x20fd [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0114 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x011f [snapscan] add_usb_device(libusb:001:002) [snapscan] add_usb_device: Detected (kind of) an USB device [snapscan] snapscani_usb_open(libusb:001:002) [snapscan] snapscani_usb_open: Can't get semaphore [snapscan] add_usb_device: error opening device libusb:001:002: Invalid argument [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0121 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0122 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x080c [snapscan] sane_snapscan_get_devices (0x7f9664b8, 0) [sanei_debug] Setting debug level of sanei_usb to 255. [sanei_usb] sanei_usb_init: Looking for kernel scanner devices [sanei_usb] sanei_usb_init: can't stat /dev/usb/: No such file or directory [sanei_usb] sanei_usb_init: Looking for libusb devices usb_os_init: Found USB VFS at /dev/bus/usb usb_set_debug: Setting debugging level to 255 (on) [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: found libusb device (0x04b8/0x011f) interface 0 at libusb:001:002 [sanei_usb] sanei_usb_init: found 1 devices [sanei_usb] sanei_usb_find_devices: vendor=0x05da, product=0x30d4 [sanei_usb] sanei_usb_find_devices: vendor=0x05da, product=0x30cf [sanei_debug] Setting debug level of sanei_usb to 255. [...] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Giuseppe Sacco [EMAIL PROTECTED] wrote: Hi, [snapscan] add_usb_device(libusb:001:002) [snapscan] add_usb_device: Detected (kind of) an USB device [snapscan] snapscani_usb_open(libusb:001:002) [snapscan] snapscani_usb_open: Can't get semaphore [snapscan] add_usb_device: error opening device libusb:001:002: Invalid argument Oliver, this happens on PowerPC with SANE 1.0.19. Any idea about what's going on here ? JB. -- Julien BLACHE [EMAIL PROTECTED] | Debian, because code matters more Debian GNU/Linux Developer| http://www.debian.org Public key available on http://www.jblache.org - KeyID: F5D6 5169 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#466855: [libsane] Cannot connect to scanner via libusb: Can't get semaphore
Package: libsane Version: 1.0.19~cvs20071213-5 Severity: important Machine is linux/ppc on powerbook. Scanner is Epson perfection 1670. When I run scanimage the scanner isn't recognized. $ env SANE_DEBUG_SNAPSCAN=255 SANE_DEBUG_SANEI_USB=255 scanimage -L produces a long output. The relevant part is probably this: [sanei_debug] Setting debug level of snapscan to 255. [snapscan] sane_snapscan_init [snapscan] sane_snapscan_init: Snapscan backend version 1.4.53 [sanei_debug] Setting debug level of sanei_usb to 255. [sanei_usb] sanei_usb_init: Looking for kernel scanner devices [sanei_usb] sanei_usb_init: can't stat /dev/usb/: No such file or directory [sanei_usb] sanei_usb_init: Looking for libusb devices usb_os_init: Found USB VFS at /dev/bus/usb usb_set_debug: Setting debugging level to 255 (on) [sanei_usb] sanei_usb_init: found libusb device (0x04b8/0x011f) interface 0 at libusb:002:003 [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: device 0x046d/0xc00e, interface 0 doesn't look like a scanner (0/3) [sanei_usb] sanei_usb_init: device 0x046d/0xc00e: no suitable interfaces [sanei_usb] sanei_usb_init: device 0x/0x looks like a root hub [sanei_usb] sanei_usb_init: found 1 devices [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a20 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a26 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2022 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x1a2a [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2040 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2060 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x207e [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20be [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20c0 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20b0 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20de [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20f8 [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20fc [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x20fe [sanei_usb] sanei_usb_find_devices: vendor=0x04a5, product=0x2137 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x0002 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x0001 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2061 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2093 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2091 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2095 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x2097 [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x208d [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x20ff [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x208f [sanei_usb] sanei_usb_find_devices: vendor=0x06bd, product=0x20fd [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0114 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x011f [snapscan] add_usb_device(libusb:002:003) [snapscan] add_usb_device: Detected (kind of) an USB device [snapscan] snapscani_usb_open(libusb:002:003) [snapscan] snapscani_usb_open: Can't get semaphore [snapscan] add_usb_device: error opening device libusb:002:003: Invalid argument [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0121 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x0122 [sanei_usb] sanei_usb_find_devices: vendor=0x04b8, product=0x080c libusb is version 2:0.1.12-9 kernel is version 2.6.22-6 Bye, Giuseppe -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]