help porting linux fxload app (#include <usbdevice_fs.h>)

Steve Franks stevefranks at ieee.org
Tue Apr 1 16:49:33 PDT 2008


Hi,

I have a need for fxload.  I think I've narrowed the issues down to
the following (namely USBDEVFS_CONTROL) , so if someone could give me
a leg up on that, I'd be grateful.  FreeBSD includes a predecessor
"EZload", but I don't think it works with recent devices as the
hardware technology has been sold to another company (cypress)...

Thanks,
Steve

# include  <dev/usb/usbdevice_fs.h>

static inline int ctrl_msg (
    int					device,
    unsigned char			requestType,
    unsigned char			request,
    unsigned short			value,
    unsigned short			index,
    unsigned char			*data,
    size_t				length
) {
    struct usbdevfs_ctrltransfer	ctrl;

    if (length > USHRT_MAX) {
	fputs ("length too big", stderr);
	return -EINVAL;
    }

    /* 8 bytes SETUP */
    ctrl.bRequestType = requestType;
    ctrl.bRequest = request;
    ctrl.wValue   = value;
    ctrl.wLength  = (unsigned short) length;
    ctrl.wIndex = index;

    /* "length" bytes DATA */
    ctrl.data = data;

    ctrl.timeout = 10000;

    return ioctl (device, USBDEVFS_CONTROL, &ctrl);
}


More information about the freebsd-usb mailing list