[sane-devel] sane_init(), sane_get_devices() and SANE_Authorization_Callback()
On Wednesday 26 May 2010 15:48:08 m. allan noah wrote: > 2010/5/26 K?re S?rs : > > Hi, > > > > I have a couple of somewhat related problems regarding > > sane_get_devices(), sane_init() and SANE_Authorization_Callback(). > > > > 1) sane_get_devices() does not update the available devices list without > > calling sane_init(). I asked about this some time ago and got the answer > > that it was a bug. With the version in (K)Ubuntu Lucid and the > > pashazz-sane PPA, I still have the problem that the scanner is not found > > if turned on after sane_init(). I use the epson2 and v4l backends. With > > epson2 I get a crash if the scanner is on the first time but is turned > > off before the second sane_get_devices(). > > > > Do you have any hints on where to start digging? > > Many backends do not properly re-scan for devices. Those backends > should be fixed. Which version of sane-backends is this? This was sane-backends 1.0.21 from the ubunntu ppa mentioned in a couple of mails back. The backends I use are epson2 and v4l > > > 2) With sane_get_devices() I can get the vendor, model, type and backend > > names for the available scanners. Is there a way to get the same > > information about the currently opened device? I do not find an API for > > that. Have I missed something? The problem is that I can specify a > > backend like "test" and sane_open() will open either "test:0" or > > "test:1", but I do not know which one and I do not get the vendor, model > > and type strings. > > Correct. This is a deficiency in the sane API. You have to keep the > device list, and open a device by the given name. If you ask a backend > for the NULL device, it is impossible to know which one you will get. > > > 3) libksane can be used in multi threaded applications and at the moment > > I'm making sure that sane_exit() is only called when the last instance > > exits, as sane_exit() will invalidate the other running instances. > > Should I do the same for sane_init()?. So far it has not resulted in > > problems, but when I tried a workaround for the sane_get_devices() > > problem I noticed that I got unwanted behavior. > > sane-backends is not designed to be thread safe, as only one function > (sane_cancel) is explicitly required to be reentrant. So, arrange your > app to only call sane from one thread. But, more to your question- you > should only call sane_init once. If you call it again (particularly > without calling sane_exit first), I would not be surprised to hear of > bad things happening. OK, I'll ensure that sane_init is called only once. Does this also mean that the sane callbacks that take a sane handle can have local variables that would conflict? Since libksane provides a "widget" it always runs in the main event loop and will not reenter the same function twice. Only sane_start and sane_read are called from real threads. At the moment I have sane_get_devices() in a singleton with separate thread to enable updating the GUI. Should I here also ensure that no other sane functions are called at the same time? One workaround I can think of would be to start a separate process that would read the available devices... > > > 4) Again in a multi threaded application there might be two scanners that > > require authentication. The resource string that is provided to > > SANE_Authorization_Callback() contains the backend name and a md5 hash, > > but it does not contain the same ":libusb:001:004" extra info type of > > sting that sane_get_devices() returns for the backend. > > Which backend? At least "epson2" and "test" through the net backend. > > > How should I identify the different scanners with the same backend? Or is > > the authorization restricted to the backend with the same authentication > > for all the scanners with the same backend? > > Personally, I'd probably skip the auth callback... It is there already, but it only works if invoked from sane_open :) > > allan Thanks for the answers, K?re
[sane-devel] New scanner: Plustek OpticFilm 7600i
I managed to fix the sane-backends 1.0.21 (port for FreeBSD), so here is more output: root at kg-v2# sane-find-scanner -q found USB scanner (vendor=0x07b3 [Plustek INC], product=0x0c3b [Film Scanner ], chip=GL843) at libusb:/dev/usb:/dev/ugen3.2 found USB scanner (vendor=0x03f0 [HP], product=0xc202 [Photosmart 8200 series]) at libusb:/dev/usb:/dev/ugen1.2 found USB scanner (vendor=0x06bd [AGFA], product=0x2061 [ Snapscan1212u_2]) at libusb:/dev/usb:/dev/ugen2.2 It still says that the chip is a GL843. Oh welll -- Regards, Torfinn Ingolfsen -- next part -- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100526/8224be7e/attachment.htm>
[sane-devel] New scanner: Plustek OpticFilm 7600i
I goit myself a new scanner: a Plustek OpticFilm 7600i[1] film scanner. Testing it (under FreeBSD) yields the following result: root at kg-v2# uname -a FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #2: Sun Apr 11 19:39:02 CEST 2010 root at kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64 root at kg-v2# sane-find-scanner -q found USB scanner (vendor=0x07b3 [Plustek INC], product=0x0c3b [Film Scanner ], chip=GL843) at libusb:/dev/usb:/dev/ugen3.2 found USB scanner (vendor=0x03f0 [HP], product=0xc202 [Photosmart 8200 series]) at libusb:/dev/usb:/dev/ugen1.2 found USB scanner (vendor=0x06bd [AGFA], product=0x2061 [ Snapscan1212u_2]) at libusb:/dev/usb:/dev/ugen2.2 root at kg-v2# scanimage -L device `snapscan:libusb:/dev/usb:/dev/ugen2.2' is a AGFA SNAPSCAN 1212U_2 flatbed scanner This is done with sane-backends-1.0.20_6, becaise the sane-backends-1.0.21 port currently have a problem on FreeBSD. root at kg-v2# usbconfig -u 3 -a 2 dump_info ugen3.2: at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON root at kg-v2# usbconfig -u 3 -a 2 dump_info ugen3.2: at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON root at kg-v2# usbconfig -u 3 -a 2 dump_device_desc ugen3.2: at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x00ff bDeviceSubClass = 0x00ff bDeviceProtocol = 0x00ff bMaxPacketSize0 = 0x0040 idVendor = 0x07b3 idProduct = 0x0c3b bcdDevice = 0x0400 iManufacturer = 0x000a iProduct = 0x000b iSerialNumber = 0x000c <1> bNumConfigurations = 0x0001 I take it this scanner isn't supported? Anyway, if anyone is working on a driver, I'm game for testing, debugging etc. References: 1) http://www.plustek.com/product/7600i_se.asp -- Regards, Torfinn Ingolfsen -- next part -- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100526/4e759fe6/attachment.htm>
[sane-devel] sane_init(), sane_get_devices() and SANE_Authorization_Callback()
>> Many backends do not properly re-scan for devices. Those backends >> should be fixed. Which version of sane-backends is this? > This was sane-backends 1.0.21 from the ubunntu ppa mentioned in a couple of > mails back. The backends I use are epson2 and v4l v4l is pretty much unmaintained, so I don't know that will get fixed, and A. Zummo has been too busy to work on epson2 lately, but I might step in a fix that. >> sane-backends is not designed to be thread safe, as only one function >> (sane_cancel) is explicitly required to be reentrant. So, arrange your >> app to only call sane from one thread. But, more to your question- you >> should only call sane_init once. If you call it again (particularly >> without calling sane_exit first), I would not be surprised to hear of >> bad things happening. > > OK, I'll ensure that sane_init is called only once. Does this also mean that > the sane callbacks that take a sane handle can have local variables that would > conflict? > > Since libksane provides a "widget" it always runs in the main event loop and > will not reenter the same function twice. Any sane function could step on the toes of another sane function. I did not say that calling the same function twice was a problem- calling ANY two functions simultaneously is a problem, except sane_cancel. You must ensure > One workaround I can think of would be to start a separate process that would > read the available devices... only if you are going to use that process to also do the scanning, since the device list would have to be rescanned in any other process. >> > 4) Again in a multi threaded application there might be two scanners that >> > require authentication. The resource string that is provided to >> > SANE_Authorization_Callback() contains the backend name and a md5 hash, >> > but it does not contain the same ":libusb:001:004" extra info type of >> > sting that sane_get_devices() returns for the backend. >> >> Which backend? > At least "epson2" and "test" through the net backend. weird- i've never used the auth callback, and none of my backends need it, so I'd have to play around with it to comment further... allan -- "The truth is an offense, but not a sin"
[sane-devel] RGBI file format
I am looking for a good file format to save scanned RGBI images, that is like a RGBA file but an infrared instead of a transparency byte for each pixel. Sane once (and maybe still) transfered RGBI info but I am not sure it was ever written to a file. An additional requirement is that the file must specify the resolution it was scanned at. The best I can up with is the SGI RGB format. It includes any number of channels, does not explicitly declare resolution but that could be written in the NAME field. I mildly dislike the consecutive rather than interlaced writing of sample values but otherwise it looks good. I prefer to stick to (or close to) some existing format, preferably one with an open source library for reading/writing. Would appreciate comments or better suggestions. Regards, Enno
[sane-devel] sane_init(), sane_get_devices() and SANE_Authorization_Callback()
Hi, I have a couple of somewhat related problems regarding sane_get_devices(), sane_init() and SANE_Authorization_Callback(). 1) sane_get_devices() does not update the available devices list without calling sane_init(). I asked about this some time ago and got the answer that it was a bug. With the version in (K)Ubuntu Lucid and the pashazz-sane PPA, I still have the problem that the scanner is not found if turned on after sane_init(). I use the epson2 and v4l backends. With epson2 I get a crash if the scanner is on the first time but is turned off before the second sane_get_devices(). Do you have any hints on where to start digging? 2) With sane_get_devices() I can get the vendor, model, type and backend names for the available scanners. Is there a way to get the same information about the currently opened device? I do not find an API for that. Have I missed something? The problem is that I can specify a backend like "test" and sane_open() will open either "test:0" or "test:1", but I do not know which one and I do not get the vendor, model and type strings. 3) libksane can be used in multi threaded applications and at the moment I'm making sure that sane_exit() is only called when the last instance exits, as sane_exit() will invalidate the other running instances. Should I do the same for sane_init()?. So far it has not resulted in problems, but when I tried a workaround for the sane_get_devices() problem I noticed that I got unwanted behavior. 4) Again in a multi threaded application there might be two scanners that require authentication. The resource string that is provided to SANE_Authorization_Callback() contains the backend name and a md5 hash, but it does not contain the same ":libusb:001:004" extra info type of sting that sane_get_devices() returns for the backend. How should I identify the different scanners with the same backend? Or is the authorization restricted to the backend with the same authentication for all the scanners with the same backend? Thanks in advance, K?re
[sane-devel] Epson Stylus SX410 is not recognized although it is listed as supported
Am 26.05.2010 01:28, schrieb Alesh Slovak: > Have you tried this PPA? > https://launchpad.net/~pzinin/+archive/pashazz-sane I hadn't found this PPA during my previous searches. I installed the packages from there and I now have 'scanimage (sane-backends) 1.0.22git; backend version 1.0.22' but the 'scanimage -L' still doesn't detect my scanner, even when I'm sudo.
[sane-devel] Epson Stylus SX410 is not recognized although it is listed as supported
Ok, lets get a debugging log: SANE_DEBUG_EPSON2=255 scanimage -L 2>sx410.log then send sx410.log to the list, compressed if its > 100K. allan On Wed, May 26, 2010 at 4:06 AM, kltrg wrote: > Am 26.05.2010 01:28, schrieb Alesh Slovak: >> Have you tried this PPA? >> https://launchpad.net/~pzinin/+archive/pashazz-sane > > I hadn't found this PPA during my previous searches. I installed the packages > from there and I now have 'scanimage (sane-backends) 1.0.22git; backend > version 1.0.22' but the 'scanimage -L' still doesn't detect my scanner, even > when I'm sudo. > > -- > sane-devel mailing list: sane-devel at lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/sane-devel > Unsubscribe: Send mail with subject "unsubscribe your_password" > ? ? ? ? ? ? to sane-devel-request at lists.alioth.debian.org > -- "The truth is an offense, but not a sin"
[sane-devel] sane_init(), sane_get_devices() and SANE_Authorization_Callback()
2010/5/26 K?re S?rs : > Hi, > > I have a couple of somewhat related problems regarding ?sane_get_devices(), > sane_init() and SANE_Authorization_Callback(). > > 1) sane_get_devices() does not update the available devices list without > calling sane_init(). I asked about this some time ago and got the answer that > it was a bug. With the version in (K)Ubuntu Lucid and the pashazz-sane PPA, I > still have the problem that the scanner is not found if turned on after > sane_init(). I use the epson2 and v4l backends. With epson2 I get a crash if > the scanner is on the first time but is turned off before the second > sane_get_devices(). > > Do you have any hints on where to start digging? Many backends do not properly re-scan for devices. Those backends should be fixed. Which version of sane-backends is this? > 2) With ?sane_get_devices() I can get the vendor, model, type and backend > names for the available scanners. Is there a way to get the same information > about the currently opened device? I do not find an API for that. ?Have I > missed something? The problem is that I can specify a backend like "test" and > sane_open() will open either "test:0" or "test:1", but I do not know which one > and I do not get the vendor, model and type strings. Correct. This is a deficiency in the sane API. You have to keep the device list, and open a device by the given name. If you ask a backend for the NULL device, it is impossible to know which one you will get. > 3) libksane can be used in multi threaded applications and at the moment I'm > making sure that sane_exit() is only called when the last instance exits, as > sane_exit() will invalidate the other running instances. Should I do the same > for sane_init()?. So far it has not resulted in problems, but when I tried a > workaround for the ?sane_get_devices() problem I noticed that I got unwanted > behavior. sane-backends is not designed to be thread safe, as only one function (sane_cancel) is explicitly required to be reentrant. So, arrange your app to only call sane from one thread. But, more to your question- you should only call sane_init once. If you call it again (particularly without calling sane_exit first), I would not be surprised to hear of bad things happening. > 4) Again in a multi threaded application there might be two scanners that > require authentication. The resource string that is provided to > SANE_Authorization_Callback() contains the backend name and a md5 hash, but it > does not contain the same ":libusb:001:004" extra info type of sting that > sane_get_devices() returns for the backend. Which backend? > How should I identify the different scanners with the same backend? Or is the > authorization restricted to the backend with the same authentication for all > the scanners with the same backend? Personally, I'd probably skip the auth callback... allan -- "The truth is an offense, but not a sin"
[sane-devel] RGBI file format
On Wed, May 26, 2010 at 6:26 AM, Enno Fennema wrote: > I am looking for a good file format to save scanned RGBI images, that is > ?like a RGBA file but an infrared instead of a transparency byte for > each pixel. Sane once (and maybe still) transfered RGBI info but I am > not sure it was ever written to a file. There are some commented out FRAME types in sane-backends. They are not officially supported, as someone may come up with a better mechanism. I don't know of any image type that would support RGBI, though it might be possible to use one of the more extensible formats like TIFF to store an RGB and IR frame separately. > > An additional requirement is that the file must specify the resolution > it was scanned at. TIFF supports that. allan -- "The truth is an offense, but not a sin"
[sane-devel] Epson Stylus SX410 is not recognized although it is listed as supported
On 05/25/2010 04:40 PM, kltrg wrote: > Am 25.05.2010 01:25, schrieb Alesh Slovak: >> Could this be a permissions issue? Can you scan as root? > > No. 'sudo scanimage -L' says no scanners where found, too. > > I still didn't manage to scan although I now have 1.0.21 installed. Using Debian packages on Ubuntu is not exactly guaranteed to work. Have you tried this PPA? https://launchpad.net/~pzinin/+archive/pashazz-sane Happy scanning, -- Alesh SlovakLinux Team -- AVASYS Corporation alesh.slovak at avasys.jp http://avasys.jp