[sane-devel] [RFC] SANE USB support for devices with multiple interfaces/endpoints

Ilia Sotnikov hostcc at gmail.com
Fri Mar 20 07:46:17 UTC 2009


I almost finished writing the backend for Konica-Minolta Bizhub
devices. The point to discuss is how to handle them using SANE USB
interface. The device has one configuration with two interfaces, one
of them has four endpoints. The USB information (part of
sane-find-scanner output) for Bizhub 162 is below:

<device descriptor of 0x132b/0x201a at 003:007 (KONICA MINOLTA KONICA
MINOLTA 162 TWAIN Device )>
bLength               18
bDescriptorType       1
bcdUSB                1.10
bDeviceClass          0
bDeviceSubClass       0
bDeviceProtocol       0
bMaxPacketSize0       64
idVendor              0x132B
idProduct             0x201A
bcdDevice             1.00
iManufacturer         1 (KONICA MINOLTA)
iProduct              2 (KONICA MINOLTA 162 TWAIN Device )
iSerialNumber         0 ()
bNumConfigurations    1
 <configuration 0>
 bLength              9
 bDescriptorType      2
 wTotalLength         69
 bNumInterfaces       2
 bConfigurationValue  1
 iConfiguration       0 ()
 bmAttributes         192 (Self-powered)
 MaxPower             0 mA
  <interface 0>
   <altsetting 0>
   bLength            9
   bDescriptorType    4
   bInterfaceNumber   0
   bAlternateSetting  0
   bNumEndpoints      4
   bInterfaceClass    255
   bInterfaceSubClass 255
   bInterfaceProtocol 255
   iInterface         0 ()
    <endpoint 0>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x03 (out 0x03)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0
    <endpoint 1>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x84 (in 0x04)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0
    <endpoint 2>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x05 (out 0x05)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0
    <endpoint 3>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x86 (in 0x06)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0
  <interface 1>
   <altsetting 0>
   bLength            9
   bDescriptorType    4
   bInterfaceNumber   1
   bAlternateSetting  0
   bNumEndpoints      2
   bInterfaceClass    7
   bInterfaceSubClass 1
   bInterfaceProtocol 2
   iInterface         0 ()
    <endpoint 0>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x01 (out 0x01)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0
    <endpoint 1>
    bLength           7
    bDescriptorType   5
    bEndpointAddress  0x82 (in 0x02)
    bmAttributes      2 (bulk)
    wMaxPacketSize    64
    bInterval         0 ms
    bRefresh          0
    bSynchAddress     0

The backend uses EPs 05/86 from interface 0 for scanning.

Now the questions to discuss:
1. what SANE USB call could select the interface?
2. what SANE USB call could select endpoints for the interface?

For p.1 sanei_usb_claim_interface() could be used (to modify
devices[I].interface_nr). To solve p.2 perhaps additional SANE USB
call or a callback for sani_usb_open() should be introduced.

Any thoughts?
-- 
 Ilia Sotnikov



More information about the sane-devel mailing list