[sane-devel] sanei_usb.c

Gerald Murray gmurray@cloudnet.com
Wed, 29 Jun 2005 22:37:47 -0500


Quoting Paul Smedley <paul@smedley.info>:

> Hi Gerald,
>=20
> On 28/6/2005, "Gerald Murray" <gmurray@cloudnet.com> wrote:
>=20
> >Quoting Paul Smedley <paul@smedley.info>:
> >> One query I have though is about devname
> >>=20
> >> I see in sanei_usb.h that the libusb format for this is
> libusb:busno:devno
> >>=20
> >> Is this defined for all devices or just ones that sanei_usb_init thi=
nks=20
> >> are scanners?
> >
> >It is defined for each usb device.  Having this naming scheme allows t=
he=20
> >OS to use the same functionality that applies to filenames for usb dev=
ices.
> >So the permissions on that filename can be used to indicate the permis=
sions
> >for its associated usb device.=20
> Well permissions are pretty much non-existent on os/2...
>=20
> >> I assume that the format of devname really isn't important - so long=
 as=20
> >> it's useful to the usb method being used (ie kernel, libusb or usbca=
lls=20
> >> for OS/2) in determining which usb device is being attached to?
> >>=20
> >> In which case, I could use usbcalls:deviceno or even just deviceno?
> >
> >For portability, it would be best to use just one system for all usb
> devices
> >within that operating system.  This is a problem for the OS you are us=
ing..
> I don't see why it's a problem?

To clarify, I was suggesting that there should be a uniform way of using
the devices, and that 'problem' lies more in the OS, and less in the=20
driver author.  It eases portability in adapting any driver to another
system or in converting programs to any one specific computer.
I did not intend to suggest that there is an obstacle for you there.

> usbcalls uses a device number for each usb device that's attached to th=
e
> system.
>=20
> Using the format above, I could have for eg.
> usbcalls:0 - ie my USB Floppy
> usbcalls:1 - ie my USB Printer
> usbcalls:2 - ie my USB Scanner
>=20
> When usbcalls:2 is passed to sanei_usb_open, I know to open device numb=
er
> 2 via usbcalls?  Or am I missing something?

Looks like you are on the right path.

regards,
Gerald