From: Tim R. <ti...@pr...> - 2012-04-13 16:15:06
|
bob 295 wrote: > I'm still very much a USB/libusb-1.0 newbie. > > I've been trying to teach myself the libusb-1.0 library against a Phidgets SBC > board. OK, that tells us the computer you're running this on, but not the device you are trying to communicate with. What kind of device are you trying to contact? > This board comes with libusb-0.1 source code, albeit a tad > difficult to follow. The relevant libusb-0.1 call I'm trying to emulate in > async libusb-1.0 is: > > ========= begin Phidget lib snip ============= > BytesWritten = usb_control_msg((usb_dev_handle *)phid->deviceHandle, > USB_ENDPOINT_OUT | USB_TYPE_CLASS | > USB_RECIP_INTERFACE, > USB_REQ_SET_CONFIGURATION, > 0x0200, /* value */ > phid->deviceDef->pdd_iid, /* index*/ > (char *)buffer, > phid->outputReportByteLength, /* size > */ > 500); /* FIXME? timeout */ > =========== end Phidget lib snip =========== > > Recently I tried programming an async control transfer message by adding some > modifications to the dpfp.c example (documented at > http://www.icanprogram.com/opndrs/phidgets/2012Apr13.html). That sample is for a U.are.U 4000B fingerprint scanner. Do you actually have a U.are.U 4000B fingerprint scanner? If not, then the sample code is not going to be terribly helpful. > The relevant code is: > > ========== begin my dpfp.c snip ============= > > libusb_fill_control_setup(ctrlbuf, > LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | > LIBUSB_RECIPIENT_INTERFACE, > 0x09, > 0x0200, > 0, > 6); > > ctrlbuf[8]=0x1; That sets up a control transfer, but it does not actually SEND the command. You need libusb_submit_transfer to send this command to the device. > What does it mean when the control transfer returns a LIBUSB_TRANSFER_STALL? A stall means the device did not recognize your command. Do you actually have this device? -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |