[sane-devel] microtek2 - libusb ?

2005-05-21 Thread gerard klaver
On Fri, 2005-05-20 at 16:36 -0500, Steven Palm wrote:
 On May 14, 2005, at 7:18 AM, Henning Meier-Geinitz wrote:
  Any notes on how to go about (or general guidelines for) converting a
  driver to support libusb?
 
  You shouldn't use libusb directly but the sanei_usb functions. AFAIK
  the avision backend has been changed to use direct USB access instead
  of using the kernel driver hpusbscsi so you may want to have a look at
  its code.
 
   I'm running into a few issues that are beyond the scope of my  
 ignorance... :-)  (Well, the scope of my ignorance is pretty large in  
 this area, so maybe I should say beyond the scope of my understanding.)
 
   A few things seem to be different between the avision and microtek2  
 that are complicating my efforts.
 
   1)  The avision does a status read on an interrupt endpoint, the  
 microtek2 USB config has none. Not a big deal, I just do a bulk_read  
 and it seems to catch it OK.
 
   2)  The microtek has three endpoints, one output and two input.   
 Using the sanei_open() and related functions I see this happening:
 
 [sanei_usb] sanei_usb_open: trying to open device `libusb: 
 003:002-05da-00a3-ff-03'
 usb_os_open: 05da:00a3
 usb_set_configuration: called for config 1
 usb_claim_interface: called for interface 0
 Interface 0 of device is 0x11cf
 claim_interface: Interface 0 of device from QueryInterface is 0x303c80
 libusb/darwin.c get_endpoints: building table of endpoints.
 get_endpoints: Pipe 1: DIR: 0 number: 1
 get_endpoints: Pipe 2: DIR: 1 number: 2
 get_endpoints: Pipe 3: DIR: 1 number: 3
 libusb/darwin.c get_endpoints: complete.
 [sanei_usb] sanei_usb_open: configuration nr: 0
 [sanei_usb] sanei_usb_open: interface nr: 0
 [sanei_usb] sanei_usb_open:   alt_setting nr: 0
 [sanei_usb] sanei_usb_open:num: 0 endpoint: 0x304260
 [sanei_usb] sanei_usb_open: direction: 0)
 [sanei_usb] sanei_usb_open:  address: 1 transfertype: 2
 [sanei_usb] sanei_usb_open: found bulk-out endpoint (address 0x01)
 [sanei_usb] sanei_usb_open:num: 1 endpoint: 0x304274
 [sanei_usb] sanei_usb_open: direction: 128)
 [sanei_usb] sanei_usb_open:  address: 2 transfertype: 2
 [sanei_usb] sanei_usb_open: found bulk-in endpoint (address 0x02)
 [sanei_usb] sanei_usb_open:num: 2 endpoint: 0x304288
 [sanei_usb] sanei_usb_open: direction: 128)
 [sanei_usb] sanei_usb_open:  address: 3 transfertype: 2
 [sanei_usb] sanei_usb_open: found bulk-in endpoint (address 0x03)
 [sanei_usb] sanei_usb_open: we already have a bulk-in endpoint  
 (address: 0x82), ignoring the new one
 [sanei_usb] sanei_usb_open: opened usb device `libusb: 
 003:002-05da-00a3-ff-03' (*dn=0)
 
   The trouble is, I can't have it throwing away the other endpoint,  
 because apparently the microtek scanner sends command responses back  
 on endpoint 2, but scan data comes back on endpoint 3. sigh Anyway  
 to get this type of behavior out of the sanei_ routines?
 
   FWIW, I gleaned this little bit of info from the microtek linux  
 kernel driver code:
 
 * The X6 USB has three bulk endpoints, one output (0x1) down which
 * commands and outgoing data are sent, and two input: 0x82 from which
 * normal data is read from the scanner (in packets of maximum 32
 * bytes) and from which the status byte is read, and 0x83 from which
 * the results of a scan (or preview) are read in up to 64 * 1024 byte
 * chunks by the Windows driver. We don't know how much it is possible
 * to read at a time from 0x83.
 *
 * It seems possible to read (with URB transfers) everything from 0x82
 * in one go, without bothering to read in 32 byte chunks.
 *
 * There seems to be an optimisation of a further READ implicit if
 * you simply read from 0x83.
 
 
 (MY NOTE: I have no clue what that last bit means... Anyone? :-)
 
 *
 * Guessed protocol:
 *
 *Send raw SCSI command to EP 0x1
 *
 *If there is data to receive:
 *If the command was READ datatype=image:
 *Read a lot of data from EP 0x83
 *Else:
 *Read data from EP 0x82
 *Else:
 *If there is data to transmit:
 *Write it to EP 0x1
 *
 *Read status byte from EP 0x82
 
 
   So far, it is talking to the scanner anyway, sending some commands  
 and getting data back right up until it calls the READ microtek  
 opcode and times out on waiting for response, my guess is that this  
 response needs to be obtained over the other endpoint.  THe above  
 said READ datatype=image, and in this case the READ is type=system  
 status.
 
 Thanks!
 
   Steve
 

Advantage for a bulk endpoint with a greater size should be that its
faster.
To select in SANE in the same configuration (conf 0, interface 0 and
altsetting ) a different endpoint is not possible yet.
It can be done by adding a a sanei_usb_read_bulk_ep routine
(at least thats how i called it) if needed.

For some example see this page and the sanei_usb.c and .h files.

I have not added these routines to SANE CVS because i used them for
testing but didn't needed them at this 

[sane-devel] microtek2 - libusb ?

2005-05-21 Thread Steven Palm
On May 21, 2005, at 11:08 AM, gerard klaver wrote:
 To select in SANE in the same configuration (conf 0, interface 0 and
 altsetting ) a different endpoint is not possible yet.

  And there is only one configuration in this scanner, and I had  
tried altsetting with no luck, it seems there is no altsettings for  
the single configuration either.

 It can be done by adding a a sanei_usb_read_bulk_ep routine
 (at least thats how i called it) if needed.

 For some example see this page and the sanei_usb.c and .h files.

 I have not added these routines to SANE CVS because i used them for
 testing but didn't needed them at this moment.

  Thank you, I will test them and report back.  If they do work, I  
will vote to include them in the main sane distribution. :-)

  Steve



[sane-devel] The Genesys backend and the HP 2300C

2005-05-21 Thread Jason Anderson
In the previous messages, someone said that the HP 2300C is now well suppor=
ted.  However, I've taken the Genesys backend, the latest CVS version for S=
ane, and compiled them together, and found that I couldn't even make my HP =
2300C scanner move.  I'm not a very picky person, but am I missing somethin=
g here?

Best regards.

--
Jason A.
ICQ# 148434286

--=20
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




[sane-devel] microtek2 - libusb ?

2005-05-21 Thread Steven Palm
OK, although I will need to read the other endpoint for image data,  
that apparently is not the issue I'm hitting right now.

I can open the scanner.

I can send it short INQUIRY and get the requested data block back  
then read status.

I can send it long INQUIRY and get the requested data block back then  
read status.

I can send it READ ATTRIBUTES and get the requested data block back  
then read status.

I can send it READ SYSTEM STATUS, but instead of getting my data  
block back, I get one byte (00), and it timeout on trying to read  
additional bytes.

It is almost like the RSS data block is not being sent and the status  
byte is the one byte I am reading.

It appears that both prior developers of the microtek2 backend are  
not involved any longer, so I guess there is no help from them.

Steve