[sane-devel] On using the files

2003-12-11 Thread Jason Anderson
I've been trying to make a simple app which opens up the proper file 
(/dev/usb/scanner0), and return a message saying it is opened.  But I don't 
think I have it right.
Since SANE uses libusb, I've been using those functions, in part the usb_open() 
function.  I've used the for loop to go through the various devices in the 
usb_devices structure of libusb to try and open it.  Can anyone help me with 
this little problem?
-- 
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




[sane-devel] On using the files

2003-12-11 Thread m. allan noah
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to m...@docserver.cac.washington.edu for more info.

--1386611826-1471615762-1071153391=:9523
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Thu, 11 Dec 2003, Jason Anderson wrote:

 I've been trying to make a simple app which opens up the proper file 
 (/dev/usb/scanner0), and return a message saying it is opened.  But I don't 
 think I have it right.
 Since SANE uses libusb, I've been using those functions, in part the 
 usb_open() function.  I've used the for loop to go through the various 
 devices in the usb_devices structure of libusb to try and open it.  Can 
 anyone help me with this little problem?
 

your question is really vague, but is sounds like you are asking for a bit 
of code to open a scanner device file so you can send your own packets to 
it?

i would not use the kernel usb scanner module (rmmod scanner) i would 
instead use libusb and the usbdevfs instead. see the attached bit of code. 
you will have to change the vendor and device ids.

allan

-- 
so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls - Max Cavalera

--1386611826-1471615762-1071153391=:9523
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=foo.c
Content-Transfer-Encoding: BASE64
Content-ID: pine.lnx.4.44.0312110936310.9...@thanatos.pfeiffer.edu
Content-Description: 
Content-Disposition: attachment; filename=foo.c

DQp1c2JfZGV2X2hhbmRsZSAqbG9jYXRlX2Z1KHZvaWQpIA0Kew0KCXVuc2ln
bmVkIGNoYXIgbG9jYXRlZCA9IDA7DQoJc3RydWN0IHVzYl9idXMgKmJ1czsN
CglzdHJ1Y3QgdXNiX2RldmljZSAqZGV2Ow0KCXVzYl9kZXZ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ZXZpY2VfaGFuZGxlLDApOw0KICAgIHByaW50ZigiY2xh
aW1fc3RhdD0lZFxuIixvcGVuX3N0YXR1cyk7DQoJDQogICAgLy9vcGVuX3N0
YXR1cyA9IHVzYl9zZXRfYWx0aW50ZXJmYWNlKGRldmljZV9oYW5kbGUsMCk7
DQogICAgLy9wcmludGYoImFsdF9zdGF0PSVkXG4iLG9wZW5fc3RhdHVzKTsN
Cg0KICAgIHJldHVybiAoZGV2aWNlX2hhbmRsZSk7DQp9DQoNCg==
--1386611826-1471615762-1071153391=:9523--



[sane-devel] On using the files

2003-12-11 Thread Major A
 Since SANE uses libusb, I've been using those functions, in part the
 usb_open() function.  I've used the for loop to go through the
 various devices in the usb_devices structure of libusb to try and
 open it.  Can anyone help me with this little problem?

SANE uses libusb through sanei_usb, which is what I suggest you try
and use. If it's versatile enough for your needs (I guess it is), then
you gain a whole lot of portability by using it instead of libusb.

  Andras

===
Major Andras
e-mail: and...@users.sourceforge.net
www:http://andras.webhop.org/
===