[Libusb-devel] [PATCH] FreeBSD fix for usb_control_msg()
Rene Ladan
r.c.ladan at gmail.com
Fri Aug 4 07:39:15 UTC 2006
Konrad.Jankowski at master.ether.net schreef:
> I don't know how Net- or Open- handle this, but
> FreeBSD returns the number of transmited bytes in
> req.ucr_actlen, not in req.ucr_request.wLength.
> (/usr/include/dev/usb/usb.h:544:
> int ucr_actlen; /* actual length transferred */
>
> So then:
> --- bsd.c Sat Mar 4 03:52:46 2006
> +++ ../../bsd.c Thu Aug 3 19:19:15 2006
> @@ -476,8 +476,11 @@
> if (ret < 0)
> USB_ERROR_STR(-errno, "error sending control message: %s",
> strerror(errno));
> -
> +#ifdef __FreeBSD_kernel__
> + return req.ucr_actlen;
> +#else
> return UGETW(req.ucr_request.wLength);
> +#endif
> }
>
> int usb_os_find_busses(struct usb_bus **busses)
>
This seems correct, wLength is a uWord defined in usb_device_request_t
(usb/usb.h:112).
usb_device_request_t is included in usb_ctl_request (usb/usb.h:542),
which is the structure in which ucr_actlen (int) is defined (usb/usb.h:546)
I am cc'ing freebsd-usb@ since I'm not sure about this patch...
Regards,
Rene
--
GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)
"It won't fit on the line."
-- me, 2001
More information about the freebsd-usb
mailing list