Re: SANE vs USB scanner on 8.0

2010-05-28 Thread Torfinn Ingolfsen
On Mon, 25 Jan 2010 12:19:23 +0100
Torfinn Ingolfsen torfinn.ingolf...@broadpark.no wrote:

 On Mon, 25 Jan 2010 15:57:20 +1100
 Andrew Reilly arei...@bigpond.net.au wrote:
 
  OK, I've fixed my copy of the snapscan backend, to behave
  nicely with FreeBSD's new libusb.  Here's my patch, to be
  applied in 
  /usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/backend:
 
 This patch fixes my problem too. Thanks!

FWIW, sane-backends 1.0.21 works nicely without this patch.
but yopu must remve the patch file
(files/patch-backend_snapscan-mutex.c) in order for it to build.

More info here:
http://lists.freebsd.org/pipermail/freebsd-ports/2010-May/061505.html
HTH
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-02-04 Thread Daniel O'Connor
On Thu, 29 Oct 2009, Hans Petter Selasky wrote:
 The libUSB device pointer usage in sane needs to be audited. Probably
 it is best to figure out where the following functions are called:

  usb_find_busses() usb_find_devices() usb_device()
      usb_get_busses()

 And carefully check how the libusb device handle pointers are
 updated.

I wasn't really up to that unfortunately :(
I had a look and I couldn't see it free anything, but I am not 100% sure 
how the libusb stuff works internally. I note that the pdev does not 
appear free'd but uninitialised.

However I did notice that SANE has 1.0 API support and using that does 
not trigger this problem.

Now to convince configure to pick it up by default :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2010-01-25 Thread Torfinn Ingolfsen
On Mon, 25 Jan 2010 15:57:20 +1100
Andrew Reilly arei...@bigpond.net.au wrote:

 OK, I've fixed my copy of the snapscan backend, to behave
 nicely with FreeBSD's new libusb.  Here's my patch, to be
 applied in 
 /usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/backend:

This patch fixes my problem too. Thanks!
-- 
Torfinn

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Hans Petter Selasky
On Sunday 24 January 2010 03:10:45 Torfinn Ingolfsen wrote:
 Another question about scanners and FreeBSD 8.0-stable: what happened
 to uscanner(4)?
 The man page is there, but the module is not?
 
 ti...@kg-v2$ uname -a
 FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #1: Wed Jan  6
 21:21:40 CET 2010 r...@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC
 amd64 ti...@kg-v2$ man -k uscanner uscanner(4)  - USB
 Scanners ti...@kg-v2$ ls -l /boot/kernel/uscan*
 ls: /boot/kernel/uscan*: No such file or directory
 ti...@kg-v2$ ls -l /boot/kernel/*uscan*
 ls: /boot/kernel/*uscan*: No such file or directory
 
 Yes, I am still trying to get my Agfa Snapscan 1212u to work under
 FreeBSD 8.0-stable.
 

Hi,

It was removed and replaced by libusb. Report a bug report to the sane-backend 
developers, so that they get aware about the problem.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Torfinn Ingolfsen
On Sat, 23 Jan 2010 20:41:53 -0700 (MST)
Warren Block wbl...@wonkity.com wrote:

 Don't know about the firmware upload for that scanner, but I've recently 

There is a firmware file, and the upload just works under FreeBSD 7.x and 
earlier.
I have this in /usr/local/etc/sane.d/snapscan.conf:
firmware /usr/local/share/sane/snapscan/SnapScan_1212U_2_Scanwise_2.00.bin

 found the easier way to set up USB scanners for SANE. Just use the USB 
 vendor/product IDs in the SANE config file as they are shown (but didn't 
 work way back when on FreeBSD, AFAIR).  So epson.conf has
 
 usb 0x04b8 0x010a

This is already in snapscan.conf:
# Agfa 1212U
usb 0x06bd 0x0001
usb 0x06bd 0x2061

The last one is the id; why there are two lines I don't know.

 scanimage -d epson --mode gray ...

Doesn't work for mine:
r...@kg-v2# scanimage -d snapscan  /tmp/test.pnm
scanimage: open of device snapscan failed: Invalid argument
r...@kg-v2# scanimage -v -d snapscan  /tmp/test.pnm
scanimage: open of device snapscan failed: Invalid argument

r...@kg-v2# scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

 Maybe using the USB vendor/product IDs won't trigger the problem with 
 the snapscan backend?

Goiod idea, but that wasn't the case.

 Just to add: due to the popularity of all-in-one inkjet/scanner/coffee 
 machine/clock radio units, flatbed scanners are getting really cheap at 
 thrift stores.  I bought an HP 2300C for the princely sum of $2 last 
 week.  It's not much of a scanner, but it works fine with FreeBSD and 
 doesn't need a firmware download.  The Epsons are better (IMO), but not 
 as common.

I agree; flatbed scanners are cheap. However; I have this unit already taking 
up some space here,
it works with earlier versions of FreeBSD, so I would prefer that I could get 
it working
with FreeBSD 8 as well.

-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Warren Block

On Sun, 24 Jan 2010, Torfinn Ingolfsen wrote:


This is already in snapscan.conf:
# Agfa 1212U
usb 0x06bd 0x0001
usb 0x06bd 0x2061

The last one is the id; why there are two lines I don't know.


There are two versions of the Agfa 1212U.


Just to add: due to the popularity of all-in-one inkjet/scanner/coffee
machine/clock radio units, flatbed scanners are getting really cheap at
thrift stores.  I bought an HP 2300C for the princely sum of $2 last
week.  It's not much of a scanner, but it works fine with FreeBSD and
doesn't need a firmware download.  The Epsons are better (IMO), but not
as common.


I agree; flatbed scanners are cheap. However; I have this unit already taking 
up some space here,
it works with earlier versions of FreeBSD, so I would prefer that I could get 
it working
with FreeBSD 8 as well.


Understood.  It looks like it's going to take some work on the backend 
for that to happen.  As Hans said, best to file a bug report at 
http://www.sane-project.org/bugs.html.


-Warren Block * Rapid City, South Dakota USA
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Torfinn Ingolfsen
On Sun, 24 Jan 2010 09:39:22 +0100
Hans Petter Selasky hsela...@c2i.net wrote:

 It was removed and replaced by libusb. 

Ok.

 Report a bug report to the sane-backend 
 developers, so that they get aware about the problem.

I am not sure that the bug is with SANE and the snapscan backend, and not in 
our libusb?
Anyway, I have posted a message[1] to the sane-devel mailing list, we will see 
if that helps.


References:
1) http://lists.alioth.debian.org/pipermail/sane-devel/2010-January/025968.html
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Andrew Reilly
On Sun, Jan 24, 2010 at 09:32:43AM -0700, Warren Block wrote:
 On Sun, 24 Jan 2010, Torfinn Ingolfsen wrote:
 
 This is already in snapscan.conf:
 # Agfa 1212U
 usb 0x06bd 0x0001
 usb 0x06bd 0x2061
 
 The last one is the id; why there are two lines I don't know.
 
 There are two versions of the Agfa 1212U.
 
 Just to add: due to the popularity of all-in-one inkjet/scanner/coffee
 machine/clock radio units, flatbed scanners are getting really cheap at
 thrift stores.  I bought an HP 2300C for the princely sum of $2 last
 week.  It's not much of a scanner, but it works fine with FreeBSD and
 doesn't need a firmware download.  The Epsons are better (IMO), but not
 as common.
 
 I agree; flatbed scanners are cheap. However; I have this unit already 
 taking up some space here,
 it works with earlier versions of FreeBSD, so I would prefer that I could 
 get it working
 with FreeBSD 8 as well.
 
 Understood.  It looks like it's going to take some work on the backend 
 for that to happen.  As Hans said, best to file a bug report at 
 http://www.sane-project.org/bugs.html.

For what it's worth, I appear to be in exactly the same
situation as Torfinn, with my snapscan-e20.  I've now run the
back-end with the SANE_DEBUG_SNAPSCAN env set to 255, and it is
clear that it is running into the same device string parsing
issue:

[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen0.3)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen0.3)
[snapscan] snapscani_mutex_open: could not parse device string: Invalid argument
[snapscan] snapscani_usb_open: Can't get semaphore
[snapscan] add_usb_device: error opening device libusb:/dev/usb:/dev/ugen0.3: 
Invalid argument
[snapscan] sane_snapscan_get_devices (0x7fffcbe0, 0)
[snapscan] sane_snapscan_exit

I'll see if I can help with the bug reportage.  I know scanners
are inexpensive (this one was), but it used to work very nicely
for my purposes, so I'd like to un-break the software, by
preference.

Cheers,

-- 
Andrew
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-24 Thread Andrew Reilly
On Mon, Jan 25, 2010 at 02:57:21PM +1100, Andrew Reilly wrote:
 On Sun, Jan 24, 2010 at 09:32:43AM -0700, Warren Block wrote:
  Understood.  It looks like it's going to take some work on the backend 
  for that to happen.  As Hans said, best to file a bug report at 
  http://www.sane-project.org/bugs.html.
 
 For what it's worth, I appear to be in exactly the same
 situation as Torfinn, with my snapscan-e20.  I've now run the
 back-end with the SANE_DEBUG_SNAPSCAN env set to 255, and it is
 clear that it is running into the same device string parsing
 issue:

OK, I've fixed my copy of the snapscan backend, to behave
nicely with FreeBSD's new libusb.  Here's my patch, to be
applied in /usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/backend:

--- snapscan-mutex.c.orig   2008-03-29 07:39:02.0 +1100
+++ snapscan-mutex.c2010-01-25 15:36:47.0 +1100
@@ -130,7 +130,7 @@
return 0;
}
 
-   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
+   if (sscanf(dev, libusb:/dev/usb:/dev/ugen%d.%d, busnum, devnum) != 
2)
{
DBG (DL_MAJOR_ERROR, %s: could not parse device string: %s\n, me, 
strerror(errno));
return 0;

As you can see, this is pretty stupid: it looks as though the
snapscan driver was trying to extract the bus number and device
number from the libusb device string, so that it could use it to
uniquify the SysV-IPC semaphore key it is about to generate.  I
suspect that anything that caused this test to not fail would
have worked just as well.

I don't have a login on the sane-project.org bug list mentioned
above, so if someone who does wouldn't mind adding this info to
the aforementioned bug, I'm sure someone would appreciate it.

In the mean-time, I'll submit a pr on the FreeBSD ports list, in
the hope that a ports patch might work in lieu of an up-stream
fix.

Cheers,

-- 
Andrew
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-23 Thread Torfinn Ingolfsen
Another question about scanners and FreeBSD 8.0-stable: what happened
to uscanner(4)?
The man page is there, but the module is not?

ti...@kg-v2$ uname -a
FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #1: Wed Jan  6
21:21:40 CET 2010 r...@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC
amd64 ti...@kg-v2$ man -k uscanner uscanner(4)  - USB
Scanners ti...@kg-v2$ ls -l /boot/kernel/uscan*
ls: /boot/kernel/uscan*: No such file or directory
ti...@kg-v2$ ls -l /boot/kernel/*uscan*
ls: /boot/kernel/*uscan*: No such file or directory

Yes, I am still trying to get my Agfa Snapscan 1212u to work under
FreeBSD 8.0-stable.

-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-23 Thread Warren Block

On Sun, 24 Jan 2010, Torfinn Ingolfsen wrote:


Another question about scanners and FreeBSD 8.0-stable: what happened
to uscanner(4)?


uscanner didn't provide much (uscanner0 rather than ugenX.Y) and was 
actually functionality of some scanners with front panel buttons.  It 
only recognized scanners through a built-in list, which had to be 
maintained as part of the FreeBSD source and was always incomplete. 
It's not needed any more.



The man page is there, but the module is not?


The man page is probably a leftover from a build of FreeBSD 7.  It 
should go away if you do check-old/delete-old in src.


...

Yes, I am still trying to get my Agfa Snapscan 1212u to work under
FreeBSD 8.0-stable.


Don't know about the firmware upload for that scanner, but I've recently 
found the easier way to set up USB scanners for SANE. Just use the USB 
vendor/product IDs in the SANE config file as they are shown (but didn't 
work way back when on FreeBSD, AFAIR).  So epson.conf has


usb 0x04b8 0x010a

for my Epson 1640SU.  Then scanimage only needs -d and the backend name 
to work:


scanimage -d epson --mode gray ...

(Actually, I think that'd work without the -d spec but epson is 
commented in SANE's dll.conf.)  Note how that doesn't care about USB 
unit and address.


Maybe using the USB vendor/product IDs won't trigger the problem with 
the snapscan backend?


Just to add: due to the popularity of all-in-one inkjet/scanner/coffee 
machine/clock radio units, flatbed scanners are getting really cheap at 
thrift stores.  I bought an HP 2300C for the princely sum of $2 last 
week.  It's not much of a scanner, but it works fine with FreeBSD and 
doesn't need a firmware download.  The Epsons are better (IMO), but not 
as common.


-Warren Block * Rapid City, South Dakota USA
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-20 Thread Torfinn Ingolfsen
On Tue, 12 Jan 2010 22:20:35 +0100
Torfinn Ingolfsen torfinn.ingolf...@broadpark.no wrote:

 Hmm, werer do I find documentation on libusb as implemted in FreeBSD
 8.0? The docs at linusb.sf.net talks a lot of data types, etc. nut
 doeen't mention how device names (for lack of a better description)
 is supposed to work.
 is libusb on FreeBSD 8 supposed to work with libusb:2:2 format
 descriptors?

Nobody knows?
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-20 Thread Hans Petter Selasky
On Wednesday 20 January 2010 16:38:46 Torfinn Ingolfsen wrote:
 On Tue, 12 Jan 2010 22:20:35 +0100
 
 Torfinn Ingolfsen torfinn.ingolf...@broadpark.no wrote:
  Hmm, werer do I find documentation on libusb as implemted in FreeBSD
  8.0? The docs at linusb.sf.net talks a lot of data types, etc. nut
  doeen't mention how device names (for lack of a better description)
  is supposed to work.
  is libusb on FreeBSD 8 supposed to work with libusb:2:2 format
  descriptors?
 
 Nobody knows?
 

Hi,

The FreeBSD LibUSB should be feature compliant with libusb from sourceforge.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-10 Thread Torfinn Ingolfsen
Hi,

Did anything more come out of this discussion?
I recently upgraded my main workstation to FreeBSD 8.0-stable:
ti...@kg-v2$ uname -a
FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #1: Wed Jan  6 21:21:40 CET 
2010 r...@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64

Attached to the machine is a Agfa SnapScan 1212U scanner:
r...@kg-v2# usbconfig -u 2
ugen2.1: OHCI root HUB nVidia at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=ON
ugen2.2: Snapscan1212u_2 AGFA at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) 
pwr=ON

r...@kg-v2# sane-find-scanner -q
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

(I don't know why sane-find-scanner thiunks that my HP printer have a scanner, 
but that doesn't matter)

r...@kg-v2# SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen2.2)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen2.2)
[snapscan] snapscani_mutex_open: could not parse device string: No such file or 
directory
[snapscan] snapscani_usb_open: Can't get semaphore
[snapscan] add_usb_device: error opening device libusb:/dev/usb:/dev/ugen2.2: 
Invalid argument
[snapscan] sane_snapscan_get_devices (0x7fffe220, 0)

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

r...@kg-v2# portversion -v | grep ^sane
sane-backends-1.0.20_4  =  up-to-date with port 
sane-frontends-1.0.14_5 =  up-to-date with port 

I did Google a bit, but that didn't turn up anything useful.
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-10 Thread Hans Petter Selasky
Hi,

Try to find the source code that is printing those errors.

--HPS

On Sunday 10 January 2010 18:42:52 Torfinn Ingolfsen wrote:
 Hi,
 
 Did anything more come out of this discussion?
 I recently upgraded my main workstation to FreeBSD 8.0-stable:
 ti...@kg-v2$ uname -a
 FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #1: Wed Jan  6 21:21:40
  CET 2010 r...@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
 
 Attached to the machine is a Agfa SnapScan 1212U scanner:
 r...@kg-v2# usbconfig -u 2
 ugen2.1: OHCI root HUB nVidia at usbus2, cfg=0 md=HOST spd=FULL (12Mbps)
  pwr=ON ugen2.2: Snapscan1212u_2 AGFA at usbus2, cfg=0 md=HOST spd=FULL
  (12Mbps) pwr=ON
 
 r...@kg-v2# sane-find-scanner -q
 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
 
 (I don't know why sane-find-scanner thiunks that my HP printer have a
  scanner, but that doesn't matter)
 
 r...@kg-v2# SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
 [sanei_debug] Setting debug level of snapscan to 255.
 [snapscan] sane_snapscan_init
 [snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
 [snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen2.2)
 [snapscan] add_usb_device: Detected (kind of) an USB device
 [snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen2.2)
 [snapscan] snapscani_mutex_open: could not parse device string: No such
  file or directory [snapscan] snapscani_usb_open: Can't get semaphore
 [snapscan] add_usb_device: error opening device
  libusb:/dev/usb:/dev/ugen2.2: Invalid argument [snapscan]
  sane_snapscan_get_devices (0x7fffe220, 0)
 
 No scanners were identified. If you were expecting something different,
 check that the scanner is plugged in, turned on and detected by the
 sane-find-scanner tool (if appropriate). Please read the documentation
 which came with this software (README, FAQ, manpages).
 Calling sane_exit
 [snapscan] sane_snapscan_exit
 scanimage: finished
 
 r...@kg-v2# portversion -v | grep ^sane
 sane-backends-1.0.20_4  =  up-to-date with port
 sane-frontends-1.0.14_5 =  up-to-date with port
 
 I did Google a bit, but that didn't turn up anything useful.
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2010-01-10 Thread Warren Block

On Sun, 10 Jan 2010, Hans Petter Selasky wrote:

On Sunday 10 January 2010 18:42:52 Torfinn Ingolfsen wrote:



r...@kg-v2# SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen2.2)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen2.2)
[snapscan] snapscani_mutex_open: could not parse device string: No such
 file or directory [snapscan] snapscani_usb_open: Can't get semaphore
[snapscan] add_usb_device: error opening device
 libusb:/dev/usb:/dev/ugen2.2: Invalid argument [snapscan]
 sane_snapscan_get_devices (0x7fffe220, 0)


Try to find the source code that is printing those errors.


It's in graphics/sane-backends/work/sane-backends-1.0.20/backend/ in 
snapscan-mutex.c, line 135.


Looks to me like it wants libusb:2:2 rather than 
libusb:/dev/usb:/dev/ugen2.2.  Maybe an old format.


-Warren Block * Rapid City, South Dakota USA
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2009-10-29 Thread Hans Petter Selasky
On Thursday 29 October 2009 13:43:23 Daniel O'Connor wrote:
 On Thu, 29 Oct 2009, Hans Petter Selasky wrote:
  On Thursday 29 October 2009 04:55:53 Daniel O'Connor wrote:
   On Wed, 30 Sep 2009, Daniel O'Connor wrote:
On Mon, 28 Sep 2009, Hans Petter Selasky wrote:
 -   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
 +   if ((sscanf(dev, libusb:%d:%d, busnum, devnum) !=
 2)  +   (sscanf(dev, libusb:/dev/usb:ugen%d.%d,
 busnum, devnum) != 2)) {
 DBG (DL_MAJOR_ERROR, %s: could not parse device
 string: %s\n, me, strerror(errno));
 return 0;

 If it works, get the patch sent to the sane developers.
   
Unfortunately no (I reworked it to match the path it uses) and
now it segfaults. I rebuilt sane with debugging (is there some
way to make libtool not strip on install? It's so tedious
manually editing makefiles to remove -s..) as well as libusb.
  
   Have you had a chance to look at this? :)
  
   Thanks.
  
   PS I'm not subscribed to usb@ so perhaps I missed a reply.
 
  No. Please file a bug-report on the sane mailing list.

 Hmm, but isn't the crash in libusb?

 (I understand that it may be possible that sane is using libusb badly
 however!)

I think it is some freed' libusb memory structure pointers which are passed 
into libusb. There was a similar issue fixed in another sane USB driver 
recently.

Existing drivers have some assumptions about that after a USB bus scan that 
the device nodes are still existing for already existing devices returned in 
previous scans, which is not true for LibUSB under FreeBSD.

The libUSB device pointer usage in sane needs to be audited. Probably it is 
best to figure out where the following functions are called:

 usb_find_busses() usb_find_devices() usb_device()
 usb_get_busses()

And carefully check how the libusb device handle pointers are updated.

--HPS

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: SANE vs USB scanner on 8.0

2009-10-28 Thread Daniel O'Connor
On Wed, 30 Sep 2009, Daniel O'Connor wrote:
 On Mon, 28 Sep 2009, Hans Petter Selasky wrote:
  -   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
  +   if ((sscanf(dev, libusb:%d:%d, busnum, devnum) != 2) 
  +   (sscanf(dev, libusb:/dev/usb:ugen%d.%d, busnum,
  devnum) != 2)) {
  DBG (DL_MAJOR_ERROR, %s: could not parse device
  string: %s\n, me, strerror(errno));
  return 0;
 
  If it works, get the patch sent to the sane developers.

 Unfortunately no (I reworked it to match the path it uses) and now it
 segfaults. I rebuilt sane with debugging (is there some way to make
 libtool not strip on install? It's so tedious manually editing
 makefiles to remove -s..) as well as libusb.

Have you had a chance to look at this? :)

Thanks.

PS I'm not subscribed to usb@ so perhaps I missed a reply.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2009-09-30 Thread Daniel O'Connor
On Mon, 28 Sep 2009, Hans Petter Selasky wrote:

 -   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
 +   if ((sscanf(dev, libusb:%d:%d, busnum, devnum) != 2) 
 +   (sscanf(dev, libusb:/dev/usb:ugen%d.%d, busnum,
 devnum) != 2)) {
 DBG (DL_MAJOR_ERROR, %s: could not parse device string:
 %s\n, me, strerror(errno));
 return 0;

 If it works, get the patch sent to the sane developers.

Unfortunately no (I reworked it to match the path it uses) and now it 
segfaults. I rebuilt sane with debugging (is there some way to make libtool
not strip on install? It's so tedious manually editing makefiles to remove
-s..) as well as libusb.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801b021c0 (LWP 100292)]
0x00080140e715 in libusb20_dev_open (pdev=0x801b13d00, nTransferMax=32)
at /usr/src/lib/libusb/libusb20.c:550
550 error = pdev-beMethods-open_device(pdev, nTransferMax);
(gdb) bt
#0  0x00080140e715 in libusb20_dev_open (pdev=0x801b13d00, nTransferMax=32)
at /usr/src/lib/libusb/libusb20.c:550
#1  0x000801408f15 in usb_open (dev=0x801b1ae00)
at /usr/src/lib/libusb/libusb20_compat01.c:150
#2  0x00080065c34f in sanei_usb_open (
devname=0x801b09380 libusb:/dev/usb:/dev/ugen0.5, dn=0x7fffdc0c)
at sanei_usb.c:1143
#3  0x0008025e5ad3 in snapscani_usb_open (
dev=0x801b09380 libusb:/dev/usb:/dev/ugen0.5, fdp=0x7fffdc0c,
sense_handler=0x8025df7c0 sense_handler, pss=0x0) at snapscan-usb.c:178
#4  0x0008025eb985 in add_usb_device (
full_name=0x801b09080 libusb:/dev/usb:/dev/ugen0.5) at snapscan.c:590
#5  0x00080065c0ed in sanei_usb_find_devices (vendor=1189, product=8288,
attach=0x8025eb880 add_usb_device) at sanei_usb.c:1091
#6  0x00080065bb3e in sanei_usb_attach_matching_devices 
(name=0x7fffdcc1 ,
attach=0x8025eb880 add_usb_device) at sanei_usb.c:965
#7  0x0008025ebdac in sane_snapscan_init (version_code=0x7fffe0f8,
authorize=0x401b50 auth_callback) at snapscan.c:735
#8  0x00080066579b in init (be=0x801b0da00) at dll.c:613
#9  0x00080066621b in sane_dll_get_devices (device_list=0x7fffea00,
---Type return to continue, or q return to quit---
local_only=0) at dll.c:1034
#10 0x000800658bbb in sane_get_devices (dl=0x7fffea00, local=0) at 
dll-s.c:17
#11 0x00405a11 in main (argc=4, argv=0x7fffeb30) at scanimage.c:1771
(gdb) print *pdev
$1 = {ddesc = {LIBUSB20_DEVICE_DESC_FORMAT = 0x0, bLength = 0 '\0',
bDescriptorType = 0 '\0', bcdUSB = 0, bDeviceClass = 0 '\0',
bDeviceSubClass = 0 '\0', bDeviceProtocol = 0 '\0', bMaxPacketSize0 = 0 
'\0',
idVendor = 0, idProduct = 0, bcdDevice = 0, iManufacturer = 0 '\0',
iProduct = 0 '\0', iSerialNumber = 0 '\0', bNumConfigurations = 0 '\0'},
  session_data = {session_data = 0, tv = {tv_sec = 0, tv_nsec = 0}, plugtime = 
0},
  dev_entry = {tqe_next = 0x0, tqe_prev = 0x0}, methods = 0x0, beMethods = 0x0,
  pTransfer = 0x801b48500, privBeData = 0x0, privLuData = 0x0,
  claimed_interface = 0 '\0', file = 0, file_ctrl = 0, debug = 0, nTransfer = 
32,
  bus_number = 0 '\0', device_address = 0 '\0', usb_mode = 0 '\0',
  usb_speed = 0 '\0', is_opened = 0 '\0', usb_desc = '\0' repeats 95 times}
(gdb) up
#1  0x000801408f15 in usb_open (dev=0x801b1ae00)
at /usr/src/lib/libusb/libusb20_compat01.c:150
150 err = libusb20_dev_open(dev-dev, 16 * 2);
(gdb) print *dev
$2 = {next = 0x0, prev = 0x0, filename = /dev/ugen0.5, '\0' repeats 1012 
times,
  bus = 0x801510020, descriptor = {bLength = 18 '\022', bDescriptorType = 1 
'\001',
bcdUSB = 256, bDeviceClass = 255 'ÿ', bDeviceSubClass = 255 'ÿ',
bDeviceProtocol = 255 'ÿ', bMaxPacketSize0 = 8 '\b', idVendor = 1189,
idProduct = 8288, bcdDevice = 256, iManufacturer = 1 '\001',
iProduct = 2 '\002', iSerialNumber = 0 '\0', bNumConfigurations = 1 '\001'},
  config = 0x801b23280, dev = 0x801b13d00, devnum = 0 '\0', num_children = 0 
'\0',
  children = 0x0}
(gdb) print dev-dev
$3 = (void *) 0x801b13d00
(gdb) up
#2  0x00080065c34f in sanei_usb_open (
devname=0x801b09380 libusb:/dev/usb:/dev/ugen0.5, dn=0x7fffdc0c)
at sanei_usb.c:1143
1143  devices[devcount].libusb_handle =
(gdb) list
1138#ifdef HAVE_LIBUSB
1139  struct usb_device *dev;
1140  struct usb_interface_descriptor *interface;
1141  int result, num;
1142
1143  devices[devcount].libusb_handle =
1144usb_open (devices[devcount].libusb_device);
1145  if (!devices[devcount].libusb_handle)
1146{
1147  SANE_Status status = SANE_STATUS_INVAL;
(gdb) print *devices[devcount].libusb_device
$4 = {next = 0x0, prev = 0x0, filename = /dev/ugen0.5, '\0' repeats 1012 
times,
  bus = 0x801510020, descriptor = {bLength = 18 '\022', bDescriptorType = 1 
'\001',
bcdUSB = 256, bDeviceClass = 255 'ÿ', bDeviceSubClass = 255 'ÿ',
bDeviceProtocol = 255 'ÿ', 

SANE vs USB scanner on 8.0

2009-09-28 Thread Daniel O'Connor
Hi,
I'm trying to get a USB scanner to work with FreeBSD 8.0, it did work 
with 7.2 via uscanner.

It's an AcerScan 620U and I have the firmware and 
modified /usr/local/etc/sane.d/snapscan.conf.

sane-find-scanner sees it, eg
[midget 22:37] ~ sudo sane-find-scanner  -q
found USB scanner (vendor=0x04a5 [Color], product=0x2060 [ FlatbedScanner 13]) 
at libusb:/dev/usb:/dev/ugen0.5
found USB scanner (vendor=0x0403 [FTDI], product=0xee18 [MaxStream PKG-U]) at 
libusb:/dev/usb:/dev/ugen1.2

I have no idea why the FTDI serial device appears there..

However scanimage -L doesn't show the scanner..
[midget 22:40] ~ sudo env SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen0.5)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen0.5)
[snapscan] snapscani_mutex_open: could not parse device string: No such file or 
directory
[snapscan] snapscani_usb_open: Can't get semaphore
[snapscan] add_usb_device: error opening device libusb:/dev/usb:/dev/ugen0.5: 
Invalid argument
[snapscan] sane_snapscan_get_devices (0x7fffe200, 0)

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

Anyone have any suggestions?

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2009-09-28 Thread Hans Petter Selasky
On Monday 28 September 2009 15:10:52 Daniel O'Connor wrote:
 Hi,
 I'm trying to get a USB scanner to work with FreeBSD 8.0, it did work
 with 7.2 via uscanner.

 It's an AcerScan 620U and I have the firmware and
 modified /usr/local/etc/sane.d/snapscan.conf.

 sane-find-scanner sees it, eg
 [midget 22:37] ~ sudo sane-find-scanner  -q
 found USB scanner (vendor=0x04a5 [Color], product=0x2060 [ FlatbedScanner
 13]) at libusb:/dev/usb:/dev/ugen0.5 found USB scanner (vendor=0x0403
 [FTDI], product=0xee18 [MaxStream PKG-U]) at libusb:/dev/usb:/dev/ugen1.2

 I have no idea why the FTDI serial device appears there..

 However scanimage -L doesn't show the scanner..
 [midget 22:40] ~ sudo env SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
 [sanei_debug] Setting debug level of snapscan to 255.
 [snapscan] sane_snapscan_init
 [snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
 [snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen0.5)
 [snapscan] add_usb_device: Detected (kind of) an USB device
 [snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen0.5)
 [snapscan] snapscani_mutex_open: could not parse device string: No such
 file or directory [snapscan] snapscani_usb_open: Can't get semaphore
 [snapscan] add_usb_device: error opening device
 libusb:/dev/usb:/dev/ugen0.5: Invalid argument [snapscan]
 sane_snapscan_get_devices (0x7fffe200, 0)

 No scanners were identified. If you were expecting something different,
 check that the scanner is plugged in, turned on and detected by the
 sane-find-scanner tool (if appropriate). Please read the documentation
 which came with this software (README, FAQ, manpages).
 Calling sane_exit
 [snapscan] sane_snapscan_exit
 scanimage: finished

 Anyone have any suggestions?

Hi,

Try this patch:

diff -u ./work/sane-backends-1.0.20/backend/snapscan-mutex.c ./snapscan-
mutex.c
--- ./work/sane-backends-1.0.20/backend/snapscan-mutex.c2008-03-28 
21:39:02.0 +0100
+++ ./snapscan-mutex.c  2009-09-28 15:33:41.0 +0200
@@ -130,7 +130,8 @@
return 0;
}
 
-   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
+   if ((sscanf(dev, libusb:%d:%d, busnum, devnum) != 2) 
+   (sscanf(dev, libusb:/dev/usb:ugen%d.%d, busnum, devnum) != 2))
{
DBG (DL_MAJOR_ERROR, %s: could not parse device string: %s\n, 
me, strerror(errno));
return 0;

If it works, get the patch sent to the sane developers.

--HPS

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org