Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Apr 2008 16:21:43 -0700
From:      "Steve Franks" <stevefranks@ieee.org>
To:        freebsd-usb@freebsd.org
Subject:   help porting linux fxload app (#include <usbdevice_fs.h>)
Message-ID:  <539c60b90804011621u10b040fifb1fa51093e1393f@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?539c60b90804011621u10b040fifb1fa51093e1393f>