diff options
author | alfred <alfred@FreeBSD.org> | 2009-02-02 00:49:39 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2009-02-02 00:49:39 +0000 |
commit | cbd30dee28ea9c348eda811275b088898dd9724b (patch) | |
tree | aa7463911cd2ff8c202e86c06090486f3bd452b5 /sys | |
parent | 70a17b78b00a4d260220142eb627c102ddeb18a7 (diff) | |
download | FreeBSD-src-cbd30dee28ea9c348eda811275b088898dd9724b.zip FreeBSD-src-cbd30dee28ea9c348eda811275b088898dd9724b.tar.gz |
src/usr.bin/usbhidaction/usbhidaction.c
src/usr.bin/usbhidctl/usbhid.c
src/sys/dev/usb2/include/usb2_hid.h
src/sys/dev/usb2/input/uhid2.c
src/lib/libusbhid/Makefile
src/lib/libusbhid/descr.c
src/lib/libusbhid/descr_compat.c
src/lib/libusbhid/usbhid.3
src/lib/libusbhid/usbhid.h
src/lib/libusbhid/usbvar.h
Patches to make libusbhid and HID userland utilities compatible with
the new USB stack. All HID ioctls should go through the libusbhid
library to ensure compatibility. I have found at least one piece of
software in /usr/ports which needs to get updated before USB HID
devices will work. This is the X joystick input driver.
Reported and tested by:
Daichi GOTO and Masanori OZAWA.
src/sys/dev/usb2/core/usb2_process.c
Correct USB process names.
Reported by:
Andre Guibert de Bruet
src/sys/dev/usb2/serial/uftdi2.c
Integrate changes from old USB stack.
Submitted by: hps
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb2/bluetooth/ubtbcmfw2.c | 4 | ||||
-rw-r--r-- | sys/dev/usb2/core/usb2_process.c | 6 | ||||
-rw-r--r-- | sys/dev/usb2/include/usb2_hid.h | 2 | ||||
-rw-r--r-- | sys/dev/usb2/input/uhid2.c | 49 | ||||
-rw-r--r-- | sys/dev/usb2/serial/uftdi2.c | 1 |
5 files changed, 19 insertions, 43 deletions
diff --git a/sys/dev/usb2/bluetooth/ubtbcmfw2.c b/sys/dev/usb2/bluetooth/ubtbcmfw2.c index 16403fc..34ccf9f 100644 --- a/sys/dev/usb2/bluetooth/ubtbcmfw2.c +++ b/sys/dev/usb2/bluetooth/ubtbcmfw2.c @@ -385,8 +385,8 @@ ubtbcmfw_open(struct usb2_fifo *fifo, int fflags, struct thread *td) else if (fflags & FWRITE) xfer = sc->sc_xfer[UBTBCMFW_BULK_DT_WR]; else - return (EINVAL); /* XXX can happen? */ - + return (EINVAL); /* should not happen */ + if (usb2_fifo_alloc_buffer(fifo, xfer->max_data_length, UBTBCMFW_IFQ_MAXLEN) != 0) return (ENOMEM); diff --git a/sys/dev/usb2/core/usb2_process.c b/sys/dev/usb2/core/usb2_process.c index 468bb30..facd84e 100644 --- a/sys/dev/usb2/core/usb2_process.c +++ b/sys/dev/usb2/core/usb2_process.c @@ -184,11 +184,11 @@ usb2_proc_setup(struct usb2_process *up, struct mtx *p_mtx, uint8_t prio) TAILQ_INIT(&up->up_qhead); - usb2_cv_init(&up->up_cv, "WMSG"); - usb2_cv_init(&up->up_drain, "DMSG"); + usb2_cv_init(&up->up_cv, "wmsg"); + usb2_cv_init(&up->up_drain, "dmsg"); if (USB_THREAD_CREATE(&usb2_process, up, - &up->up_ptr, "USBPROC")) { + &up->up_ptr, "usbproc")) { DPRINTFN(0, "Unable to create USB process."); up->up_ptr = NULL; goto error; diff --git a/sys/dev/usb2/include/usb2_hid.h b/sys/dev/usb2/include/usb2_hid.h index ee07a03..1a8650e 100644 --- a/sys/dev/usb2/include/usb2_hid.h +++ b/sys/dev/usb2/include/usb2_hid.h @@ -29,6 +29,8 @@ #ifndef _USB2_HID_H_ #define _USB2_HID_H_ +#include <dev/usb2/include/usb2_endian.h> + #define UR_GET_HID_DESCRIPTOR 0x06 #define UDESC_HID 0x21 #define UDESC_REPORT 0x22 diff --git a/sys/dev/usb2/input/uhid2.c b/sys/dev/usb2/input/uhid2.c index 4713b06..cc16bbc 100644 --- a/sys/dev/usb2/input/uhid2.c +++ b/sys/dev/usb2/input/uhid2.c @@ -87,10 +87,9 @@ SYSCTL_INT(_hw_usb2_uhid, OID_AUTO, debug, CTLFLAG_RW, enum { UHID_INTR_DT_RD, - UHID_INTR_CS_RD, UHID_CTRL_DT_WR, UHID_CTRL_DT_RD, - UHID_N_TRANSFER = 4, + UHID_N_TRANSFER, }; struct uhid_softc { @@ -114,7 +113,6 @@ struct uhid_softc { uint8_t sc_fid; uint8_t sc_flags; #define UHID_FLAG_IMMED 0x01 /* set if read should be immediate */ -#define UHID_FLAG_INTR_STALL 0x02 /* set if interrupt transfer stalled */ #define UHID_FLAG_STATIC_DESC 0x04 /* set if report descriptors are * static */ }; @@ -130,7 +128,6 @@ static device_attach_t uhid_attach; static device_detach_t uhid_detach; static usb2_callback_t uhid_intr_callback; -static usb2_callback_t uhid_intr_clear_stall_callback; static usb2_callback_t uhid_write_callback; static usb2_callback_t uhid_read_callback; @@ -174,41 +171,25 @@ uhid_intr_callback(struct usb2_xfer *xfer) } case USB_ST_SETUP: - if (sc->sc_flags & UHID_FLAG_INTR_STALL) { - usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]); - } else { - if (usb2_fifo_put_bytes_max( - sc->sc_fifo.fp[USB_FIFO_RX]) != 0) { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } +re_submit: + if (usb2_fifo_put_bytes_max( + sc->sc_fifo.fp[USB_FIFO_RX]) != 0) { + xfer->frlengths[0] = sc->sc_isize; + usb2_start_hardware(xfer); } return; default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= UHID_FLAG_INTR_STALL; - usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]); + xfer->flags.stall_pipe = 1; + goto re_submit; } return; } } static void -uhid_intr_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct uhid_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[UHID_INTR_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~UHID_FLAG_INTR_STALL; - usb2_transfer_start(xfer_other); - } -} - -static void uhid_fill_set_report(struct usb2_device_request *req, uint8_t iface_no, uint8_t type, uint8_t id, uint16_t size) { @@ -337,20 +318,10 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = { .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .mh.bufsize = 0, /* use wMaxPacketSize */ + .mh.bufsize = UHID_BSIZE, .mh.callback = &uhid_intr_callback, }, - [UHID_INTR_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = &uhid_intr_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - [UHID_CTRL_DT_WR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ @@ -530,6 +501,8 @@ uhid_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, size = sc->sc_repdesc_size; } ugd->ugd_actlen = size; + if (ugd->ugd_data == NULL) + break; /* descriptor length only */ error = copyout(sc->sc_repdesc_ptr, ugd->ugd_data, size); break; diff --git a/sys/dev/usb2/serial/uftdi2.c b/sys/dev/usb2/serial/uftdi2.c index 663e702..c0170df 100644 --- a/sys/dev/usb2/serial/uftdi2.c +++ b/sys/dev/usb2/serial/uftdi2.c @@ -233,6 +233,7 @@ MODULE_DEPEND(uftdi, usb2_serial, 1, 1, 1); MODULE_DEPEND(uftdi, usb2_core, 1, 1, 1); static struct usb2_device_id uftdi_devs[] = { + {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)}, |