7 Jul 2005 13:51
Re: usb_control_msg returns -32
Lonnie Mendez <lmendez19 <at> austin.rr.com>
2005-07-07 11:51:10 GMT
2005-07-07 11:51:10 GMT
On Wednesday 06 July 2005 3:38 pm, Sandro Weiser wrote: > we are developing a driver for shuttle lcd's for lcdproc: > http://www-user.tu-chemnitz.de/~sawei/twiki/bin/view/Projekte/ShuttleLCD > > What we do: > > usb_init(); > usb_find_busses(); > usb_find_devices(); > busses = usb_get_busses(); > > /* on all busses look for Shuttle VFD's */ > p->udh = NULL; > for (bus = busses; bus != NULL; bus = bus->next) { > struct usb_device *dev; > > for (dev = bus->devices; dev; dev = dev->next) { > /* Check if this device is a Shuttle VFD */ > if ( (dev->descriptor.idVendor == shvfdVendor) && > (dev->descriptor.idProduct == shvfdProd) ) { > > /* Shuttle VFD found; try to find it's description and serial number > */ > p->udh = usb_open(dev); > if (p->udh == NULL) { > report(RPT_WARNING, "PT6314: unable to open device"); > > ... > > if (p->udh != NULL) { > debug(RPT_DEBUG, "PT6314: opening device succeeded\n"); > > if (usb_set_configuration(p->udh, 1) < 0) { /* set bConfigurationValue=1 > */ > usb_close(p->udh); > report(RPT_ERR, "PT6314: unable to set configuration"); > return -1; > } > > if (usb_claim_interface(p->udh, 1) < 0) { /* claim bInterfaceNumber=1 */ > #if defined(LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP) > if ((usb_detach_kernel_driver_np(p->udh, 1) < 0) || > (usb_claim_interface(p->udh, 1) < 0)) { > usb_close(p->udh); > report(RPT_ERR, "PT6314: unable to re-claim interface"); > return -1; > } > #else > usb_close(p->udh); > report(RPT_ERR, "PT6314: unable to claim interface"); > return -1; > #endif > } > } > else { > report(RPT_ERR, "PT6314: no (matching) ShuttleVFD device found"); > return -1; > } > > ... > > /* USB_DT_HID 0x21 */ > /* USB_REQ_SET_REPORT 0x09 */ > int ret; > ret = usb_control_msg(udh, USB_DT_HID, USB_REQ_SET_REPORT, 0, 1, > data, 8, shvfdTimeout); > if (8 == ret) > return PT6314_OK; > else { > debug(RPT_DEBUG, "only %d bytes written", ret); > return PT6314_ERROR; > } > } > > but usb_control_msg returns only -32 (only -32 bytes written) > > What does this mean? > > int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, int > value, int index, char *bytes, int size, int timeout); > > we are also not sure about value = 0 and index = 2 > where can we find doku for these 2 parameters, especially the value parameter > > thx Hello again. Generally, functions returning <0 indicate an error condition. The standard error numbers and their meanings can be found in: (an example hierarchy from my system) /usr/include/errno.h /usr/include/bits/errno.h /usr/include/linux/errno.h /usr/include/asm/errno.h /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h This will be dependent upon how the distribution has headers set up. You can view this file online via kernel source trees located at http://www.kernel.org/git: http://kernel.org/git/?p=linux/kernel/git/gregkh/linux-2.6.11.y.git;a=blob;h=65115978510ff2a2a8f6cd3610007b844746be78;hb=8e63197ffe7750c94c8ea9d159ce3e46a76bfcf2;f=include/asm-generic/errno-base.h As for your inquery into wIndex and wValue, a good place to start is in the usb 1.1 specification. Specifically, chapter 9 -section 3. The usb 1.1 spec is available to developers here: http://www.usb.org/developers/docs/ (near the bottom) Best of luck, Lonnie Mendez ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
RSS Feed