|
From: Dave H. <DAV...@ni...> - 2007-06-06 14:47:46
|
OK, now it returns -116. What next? (What does -116 mean?)
Thanks,
Dave
> -----Original Message-----
> From: lib...@li...=20
> [mailto:lib...@li...] On=20
> Behalf Of Stephan Meyer
> Sent: 2007 June 06 15:44
> To: lib...@li...
> Subject: Re: [Libusb-win32-devel] Help, please
>=20
> Check the 'ep' parameter. This parameter must be the
> full endpoint address including the direction bit (bit7).
>=20
> Stephan
>=20
>=20
>=20
> > I just checked the return value of the usb_interrupt_read=20
> () call - it's
> > always -22.
> >=20
> > Dave
> >=20
> > > -----Original Message-----
> > > From: lib...@li...=20
> > > [mailto:lib...@li...] On=20
> > > Behalf Of Dave Higton
> > > Sent: 2007 June 06 15:20
> > > To: lib...@li...
> > > Subject: Re: [Libusb-win32-devel] Help, please
> > >=20
> > > Wow, what a rapid reply! Thanks. I tried your fix, and=20
> it has got me
> > > one step further.
> > >=20
> > > (I note that usb_set_configuration (udev, 0) gives the same=20
> > > error -22 as
> > > not calling it. The only configuration I have is=20
> numbered 0; is this
> > > OK?)
> > >=20
> > > Setting configuration to 1 makes the call return 0, so it=20
> looks like
> > > it's working, but it fails at the next step. In the main=20
> loop, I do:
> > >=20
> > > printf ("Starting...\n");
> > > while (1)
> > > {
> > > if (usb_interrupt_read (contact_closure_usb_dev,
> > > contact_closure_usb_input_endpoint,
> > > cBuf,
> > > 4,
> > > 0) > 0)
> > > {
> > > printf ("Got some\n");
> > > }
> > > }
> > >=20
> > > but the printf statement is never executed, although I am=20
> doing things
> > > that should cause the interface to send messages - which=20
> are 4 bytes
> > > each.
> > >=20
> > > Any more ideas?
> > >=20
> > > Dave
> > >=20
> > > > -----Original Message-----
> > > > From: lib...@li...=20
> > > > [mailto:lib...@li...] On=20
> > > > Behalf Of Stephan Meyer
> > > > Sent: 2007 June 06 14:05
> > > > To: lib...@li...
> > > > Subject: Re: [Libusb-win32-devel] Help, please
> > > >=20
> > > > Try to replace:
> > > >=20
> > > > uci =3D usb_claim_interface (udev, 0);
> > > >=20
> > > > with
> > > >=20
> > > > usb_set_configuation(udev, 1);
> > > > uci =3D usb_claim_interface (udev, 0);
> > > >=20
> > > > It should work then.
> > > >=20
> > > >=20
> > > > Stephan
> > > >=20
> > > >=20
> > > >=20
> > > >=20
> > > > > Help, please. I've started writing a programme to use=20
> > > > libusb-win32, but
> > > > > I'm getting an error right at the start.
> > > > >=20
> > > > > First, some background. I've used libusb under Linux=20
> > > > (Fedora Core 5)
> > > > > successfully, to write driver functions for the first USB=20
> > > > device that I
> > > > > wrote firmware for. That device works entirely happily=20
> > > > under FC5 and
> > > > > under RISC O (yes, the Acorn/Pace/Castle one). I=20
> have now written
> > > > > firmware for a second device. Perhaps unsurprisingly,=20
> > > this device's
> > > > > firmware is very heavily based on the previous one. This=20
> > > > device also
> > > > > works entirely happily under RISC OS. I thought I'd try=20
> > > > this Windows
> > > > > thing, but I'm having no success.
> > > > >=20
> > > > > The entire programme is here:
> > > > >=20
> > > > > // Can I get this system to do what I want?
> > > > > #include <usb.h>
> > > > > #include <stdio.h>
> > > > >=20
> > > > > #define VENDOR_ID_NICE 0x16A8
> > > > > #define PRODUCT_ID_CONTACT_CLOSURE 0x0004
> > > > >=20
> > > > > int init (void)
> > > > > {
> > > > > //int usb_busses;
> > > > > struct usb_bus* bus;
> > > > > struct usb_device* dev;
> > > > > usb_dev_handle *udev;
> > > > > int retval =3D -1;
> > > > > int uci;
> > > > > int done =3D 0;
> > > > >=20
> > > > > printf ("Hello\n");
> > > > >=20
> > > > > usb_init ();
> > > > > usb_find_busses ();
> > > > > usb_find_devices ();
> > > > > for (bus =3D usb_get_busses (); bus; bus =3D bus->next)
> > > > > {
> > > > > for (dev =3D bus->devices; dev && (done =3D=3D 0); dev =3D
> > > > > dev->next)
> > > > > {
> > > > > udev =3D usb_open (dev);
> > > > > printf ("udev =3D %p\n", udev);
> > > > > if ((dev->descriptor.idVendor =3D=3D VENDOR_ID_NICE)
> > > > > && (dev->descriptor.idProduct =3D=3D
> > > > > PRODUCT_ID_CONTACT_CLOSURE))
> > > > > {
> > > > > printf ("Found it!\n");
> > > > > uci =3D usb_claim_interface (udev, 0);
> > > > > printf ("Return value from
> > > > > usb_claim_interface: %d\n", uci);
> > > > > retval =3D uci;
> > > > > done =3D 1;
> > > > > }
> > > > > else
> > > > > {
> > > > > printf ("Not ours, VID =3D %04X, PID =3D
> > > > > %04X\n", dev->descriptor.idVendor, dev->descriptor.idProduct);
> > > > > usb_close (udev);
> > > > > printf ("Closed: %p\n", udev);
> > > > > }
> > > > > }
> > > > > }
> > > > > return retval;
> > > > > }
> > > > >=20
> > > > > int main (void)
> > > > > {
> > > > > int init_result;
> > > > >=20
> > > > > init_result =3D init ();
> > > > > if (init_result =3D=3D 0)
> > > > > {
> > > > > printf ("Starting...\n");
> > > > > }
> > > > > else
> > > > > {
> > > > > printf ("Failed\n");
> > > > > }
> > > > > }
> > > > >=20
> > > > > When I run it, I get a couple of "Not ours, VID =3D " etc.=20
> > > > messages for
> > > > > other USB items I have, followed by "Found it!" But then=20
> > > > "Return value
> > > > > from usb_claim_interface: -22" which I don't understand.=20
> > > I think it
> > > > > indicates an illegal parameter. udev must be OK, I assume.=20
> > > > My device
> > > > > only has interface 0. It's a very simple device, with a=20
> > > > vendor-specific
> > > > > protocol, specified at interface level.
> > > > >=20
> > > > > Can anyone see what I'm doing wrong, please?
> > > > >=20
> > > > > libusb-win32 downloaded from the main libusb-win32 site=20
> > > > this week. No
> > > > > previous copy on this computer. Windows XP.
> > > > >=20
> > > > > Dave
***************************************************************************=
***************************************************************************=
***************************************************************************=
****************
NICE CTI Systems UK Limited ("NICE") is registered in England under company=
number, 3403044. The registered office of NICE is at Tollbar Way, Hedge E=
nd, Southampton, Hampshire SO30 2ZP.
Confidentiality: This communication and any attachments are intended for th=
e above-named persons only and may be confidential and/or legally privilege=
d. Any opinions expressed in this communication are not necessarily those o=
f NICE. If this communication has come to you in error you must take no act=
ion based on it, nor must you copy or show it to anyone; please delete/dest=
roy and inform the sender by e-mail immediately.
Monitoring: NICE may monitor incoming and outgoing e-mails.
Viruses: Although we have taken steps toward ensuring that this e-mail and=
attachments are free from any virus, we advise that in keeping with good c=
omputing practice the recipient should ensure they are actually virus free.
***************************************************************************=
***************************************************************************=
***************************************************************************=
*******************
=20
|