On Thu, 22 Apr 2004, Vasilios Anagnostopoulos wrote:

>I have installed the javax.usb package and I try to write a simple
>program for printing to the notorious HP1000 Laserjet . But I have a
>problem . According to the class specification , a printer class must
>have at least a DATA interface with one Bulk OUT or one BULK IN and
>one BULK OUT endpoint (plus the standard bi-directional default
>control endpoint ) . When I issue a getDescriptor
>IRP+getConfiguration descriptor I get the correct answer (according
>to the standard) , I am very happy . When I issue a getDescriptor
>IRP+getInterface , the device hangs .

You can't get interface descriptors directly.  They are part of the
configuration descriptor, as the USB spec says.  Why are you trying to
get and parse binary descriptors?  Everything is there already in the
javax.usb API.

>When I try to interf.claim() (logged as
>root) , the try block throws an exception .

It's probably claimed at a native level by a OS native (Linux kernel)
driver.  Try using an UsbInterfacePolicy with "forceClaim" set to
"true".  You'll need a kernel later than 2.4.24 (or patch your
kernel).

>What is the problem : Does this means that the printer has no other
>endpoints except the control endpoints ? Is this a violation of the
>specification ?  Do I make something wrong ?

Yes you did somethings wrong.  Use the descriptors provided in the
javax.usb interface, also you probably want to use vendor/product ID
to identify your device instead of logical topology (i.e. just
looking for a device with a bulk in/out pipe doesn't mean it's your
printer, many other devices have bulk pipes).  Also since some other
driver is (probably) driving yours, you need to either prevent the
other driver from taking over, or take over from the driver (i.e.
using forceClaim).


-- 
Dan Streetman
[EMAIL PROTECTED]
--------------------------------------------------
186,282 miles per second:
It isn't just a good idea, it's the law!


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
javax-usb-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to