From owner-svn-src-projects@FreeBSD.ORG Sun Oct 11 20:46:56 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C13D21065670; Sun, 11 Oct 2009 20:46:56 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEB928FC17; Sun, 11 Oct 2009 20:46:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9BKku1I030142; Sun, 11 Oct 2009 20:46:56 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9BKkuvX030117; Sun, 11 Oct 2009 20:46:56 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200910112046.n9BKkuvX030117@svn.freebsd.org> From: Lawrence Stewart Date: Sun, 11 Oct 2009 20:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197970 - in projects/tcp_ffcaia2008_head/sys: dev/usb dev/usb/controller dev/usb/input dev/usb/serial netinet/ipfw X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 20:46:56 -0000 Author: lstewart Date: Sun Oct 11 20:46:56 2009 New Revision: 197970 URL: http://svn.freebsd.org/changeset/base/197970 Log: Fix mismerged files. Sponsored by: FreeBSD Foundation Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/at91dci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/atmegadci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci_pci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/musb_otg.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci_pci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci_pci.c projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uss820dci.c projects/tcp_ffcaia2008_head/sys/dev/usb/input/ums.c projects/tcp_ffcaia2008_head/sys/dev/usb/serial/u3g.c projects/tcp_ffcaia2008_head/sys/dev/usb/serial/ulpt.c projects/tcp_ffcaia2008_head/sys/dev/usb/usb_compat_linux.h projects/tcp_ffcaia2008_head/sys/dev/usb/usb_controller.h projects/tcp_ffcaia2008_head/sys/dev/usb/usb_dev.h projects/tcp_ffcaia2008_head/sys/dev/usb/usb_device.c projects/tcp_ffcaia2008_head/sys/dev/usb/usb_hid.c projects/tcp_ffcaia2008_head/sys/dev/usb/usb_parse.c projects/tcp_ffcaia2008_head/sys/dev/usb/usb_request.c projects/tcp_ffcaia2008_head/sys/dev/usb/usbdevs projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_nat.c projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_pfil.c Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/at91dci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/at91dci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/at91dci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -2326,4 +2326,5 @@ struct usb_bus_methods at91dci_bus_metho .set_stall = &at91dci_set_stall, .clear_stall = &at91dci_clear_stall, .roothub_exec = &at91dci_roothub_exec, + .xfer_poll = &at91dci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/atmegadci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/atmegadci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -2143,4 +2143,5 @@ struct usb_bus_methods atmegadci_bus_met .set_stall = &atmegadci_set_stall, .clear_stall = &atmegadci_clear_stall, .roothub_exec = &atmegadci_roothub_exec, + .xfer_poll = &atmegadci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -3860,4 +3860,5 @@ struct usb_bus_methods ehci_bus_methods .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, .roothub_exec = ehci_roothub_exec, + .xfer_poll = ehci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci_pci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ehci_pci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -206,6 +206,8 @@ ehci_pci_match(device_t self) return "NVIDIA nForce3 250 USB 2.0 controller"; case 0x005b10de: return "NVIDIA nForce4 USB 2.0 controller"; + case 0x03f210de: + return "NVIDIA nForce MCP61 USB 2.0 controller"; case 0x15621131: return "Philips ISP156x USB 2.0 controller"; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/musb_otg.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/musb_otg.c Sun Oct 11 20:46:56 2009 (r197970) @@ -2736,4 +2736,5 @@ struct usb_bus_methods musbotg_bus_metho .set_stall = &musbotg_set_stall, .clear_stall = &musbotg_clear_stall, .roothub_exec = &musbotg_roothub_exec, + .xfer_poll = &musbotg_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -2756,4 +2756,5 @@ struct usb_bus_methods ohci_bus_methods .device_suspend = ohci_device_suspend, .set_hw_power = ohci_set_hw_power, .roothub_exec = ohci_roothub_exec, + .xfer_poll = ohci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci_pci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/ohci_pci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -172,6 +172,9 @@ ohci_pci_match(device_t self) case 0x00d710de: return ("nVidia nForce3 USB Controller"); + case 0x03f110de: + return ("nVidia nForce MCP61 USB Controller"); + case 0x70011039: return ("SiS 5571 USB controller"); Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -3251,4 +3251,5 @@ struct usb_bus_methods uhci_bus_methods .device_suspend = uhci_device_suspend, .set_hw_power = uhci_set_hw_power, .roothub_exec = uhci_roothub_exec, + .xfer_poll = uhci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci_pci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uhci_pci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -200,6 +200,15 @@ uhci_pci_match(device_t self) case 0x265b8086: return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-D"); + case 0x27c88086: + return ("Intel 82801G (ICH7) USB controller USB-A"); + case 0x27c98086: + return ("Intel 82801G (ICH7) USB controller USB-B"); + case 0x27ca8086: + return ("Intel 82801G (ICH7) USB controller USB-C"); + case 0x27cb8086: + return ("Intel 82801G (ICH7) USB controller USB-D"); + case 0x28308086: return ("Intel 82801H (ICH8) USB controller USB-A"); case 0x28318086: Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uss820dci.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/controller/uss820dci.c Sun Oct 11 20:46:56 2009 (r197970) @@ -2360,4 +2360,5 @@ struct usb_bus_methods uss820dci_bus_met .set_stall = &uss820dci_set_stall, .clear_stall = &uss820dci_clear_stall, .roothub_exec = &uss820dci_roothub_exec, + .xfer_poll = &uss820dci_do_poll, }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/input/ums.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/input/ums.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/input/ums.c Sun Oct 11 20:46:56 2009 (r197970) @@ -140,6 +140,8 @@ struct ums_softc { struct usb_xfer *sc_xfer[UMS_N_TRANSFER]; + int sc_pollrate; + uint8_t sc_buttons; uint8_t sc_iid; uint8_t sc_temp[64]; @@ -188,6 +190,7 @@ ums_intr_callback(struct usb_xfer *xfer, struct usb_page_cache *pc; uint8_t *buf = sc->sc_temp; int32_t buttons = 0; + int32_t buttons_found = 0; int32_t dw = 0; int32_t dx = 0; int32_t dy = 0; @@ -263,16 +266,24 @@ ums_intr_callback(struct usb_xfer *xfer, dt -= hid_get_data(buf, len, &info->sc_loc_t); for (i = 0; i < info->sc_buttons; i++) { + uint32_t mask; + mask = 1UL << UMS_BUT(i); + /* check for correct button ID */ if (id != info->sc_iid_btn[i]) continue; - if (hid_get_data(buf, len, &info->sc_loc_btn[i])) { - buttons |= (1 << UMS_BUT(i)); - } + /* check for button pressed */ + if (hid_get_data(buf, len, &info->sc_loc_btn[i])) + buttons |= mask; + /* register button mask */ + buttons_found |= mask; } if (++info != &sc->sc_info[UMS_INFO_MAX]) goto repeat; + /* keep old button value(s) for non-detected buttons */ + buttons |= sc->sc_status.button & ~buttons_found; + if (dx || dy || dz || dt || dw || (buttons != sc->sc_status.button)) { @@ -514,6 +525,8 @@ ums_attach(device_t dev) DPRINTF("error=%s\n", usbd_errstr(err)); goto detach; } + + /* Get HID descriptor */ err = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); @@ -531,6 +544,9 @@ ums_attach(device_t dev) * it has two addional buttons and a tilt wheel. */ if (usb_test_quirk(uaa, UQ_MS_BAD_CLASS)) { + + sc->sc_iid = 0; + info = &sc->sc_info[0]; info->sc_flags = (UMS_FLAG_X_AXIS | UMS_FLAG_Y_AXIS | @@ -540,11 +556,17 @@ ums_attach(device_t dev) isize = 5; /* 1st byte of descriptor report contains garbage */ info->sc_loc_x.pos = 16; + info->sc_loc_x.size = 8; info->sc_loc_y.pos = 24; + info->sc_loc_y.size = 8; info->sc_loc_z.pos = 32; + info->sc_loc_z.size = 8; info->sc_loc_btn[0].pos = 8; + info->sc_loc_btn[0].size = 1; info->sc_loc_btn[1].pos = 9; + info->sc_loc_btn[1].size = 1; info->sc_loc_btn[2].pos = 10; + info->sc_loc_btn[2].size = 1; /* Announce device */ device_printf(dev, "3 buttons and [XYZ] " @@ -653,6 +675,23 @@ static void ums_start_read(struct usb_fifo *fifo) { struct ums_softc *sc = usb_fifo_softc(fifo); + int rate; + + /* Check if we should override the default polling interval */ + rate = sc->sc_pollrate; + /* Range check rate */ + if (rate > 1000) + rate = 1000; + /* Check for set rate */ + if ((rate > 0) && (sc->sc_xfer[UMS_INTR_DT] != NULL)) { + DPRINTF("Setting pollrate = %d\n", rate); + /* Stop current transfer, if any */ + usbd_transfer_stop(sc->sc_xfer[UMS_INTR_DT]); + /* Set new interval */ + usbd_xfer_set_interval(sc->sc_xfer[UMS_INTR_DT], 1000 / rate); + /* Only set pollrate once */ + sc->sc_pollrate = 0; + } usbd_transfer_start(sc->sc_xfer[UMS_INTR_DT]); } @@ -791,6 +830,9 @@ ums_ioctl(struct usb_fifo *fifo, u_long sc->sc_mode.level = mode.level; } + /* store polling rate */ + sc->sc_pollrate = mode.rate; + if (sc->sc_mode.level == 0) { if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON) sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/serial/u3g.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/serial/u3g.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/serial/u3g.c Sun Oct 11 20:46:56 2009 (r197970) @@ -188,6 +188,7 @@ static const struct usb_device_id u3g_de U3G_DEV(QUALCOMMINC, CDMA_MSM, U3GFL_SCSI_EJECT), /* OEM: Huawei */ U3G_DEV(HUAWEI, MOBILE, U3GFL_HUAWEI_INIT), + U3G_DEV(HUAWEI, E180V, U3GFL_HUAWEI_INIT), U3G_DEV(HUAWEI, E220, U3GFL_HUAWEI_INIT), /* OEM: Novatel */ U3G_DEV(NOVATEL, CDMA_MODEM, 0), Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/serial/ulpt.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/serial/ulpt.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/serial/ulpt.c Sun Oct 11 20:46:56 2009 (r197970) @@ -426,6 +426,9 @@ ulpt_open(struct usb_fifo *fifo, int ffl /* we assume that open is a serial process */ if (sc->sc_fflags == 0) { + + /* reset USB paralell port */ + ulpt_reset(sc); } return (unlpt_open(fifo, fflags)); @@ -720,7 +723,12 @@ ulpt_watchdog(void *arg) mtx_assert(&sc->sc_mtx, MA_OWNED); - usbd_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]); + /* + * Only read status while the device is not opened, due to + * possible hardware or firmware bug in some printers. + */ + if (sc->sc_fflags == 0) + usbd_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]); usb_callout_reset(&sc->sc_watchdog, hz, &ulpt_watchdog, sc); Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_compat_linux.h ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_compat_linux.h Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_compat_linux.h Sun Oct 11 20:46:56 2009 (r197970) @@ -262,6 +262,7 @@ struct urb { uint8_t setup_dma; /* (in) not used on FreeBSD */ uint8_t transfer_dma; /* (in) not used on FreeBSD */ uint8_t bsd_isread; + uint8_t kill_count; /* FreeBSD specific */ struct usb_iso_packet_descriptor iso_frame_desc[]; /* (in) ISO ONLY */ }; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_controller.h ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_controller.h Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_controller.h Sun Oct 11 20:46:56 2009 (r197970) @@ -99,6 +99,9 @@ struct usb_bus_methods { void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall); void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep); + /* Optional transfer polling support */ + + void (*xfer_poll) (struct usb_bus *); }; /* Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_dev.h ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_dev.h Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_dev.h Sun Oct 11 20:46:56 2009 (r197970) @@ -130,6 +130,8 @@ struct usb_fifo { uint8_t flag_short; /* set if short_ok or force_short * transfer flags should be set */ uint8_t flag_stall; /* set if clear stall should be run */ + uint8_t flag_write_defrag; /* set to defrag written data */ + uint8_t flag_have_fragment; /* set if defragging */ uint8_t iface_index; /* set to the interface we belong to */ uint8_t fifo_index; /* set to the FIFO index in "struct * usb_device" */ @@ -144,11 +146,9 @@ extern struct cdevsw usb_devsw; int usb_fifo_wait(struct usb_fifo *fifo); void usb_fifo_signal(struct usb_fifo *fifo); uint8_t usb_fifo_opened(struct usb_fifo *fifo); -void usb_fifo_free(struct usb_fifo *f); struct usb_symlink *usb_alloc_symlink(const char *target); void usb_free_symlink(struct usb_symlink *ps); int usb_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len); -void usb_fifo_set_close_zlp(struct usb_fifo *, uint8_t); #endif /* _USB_DEV_H_ */ Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_device.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_device.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_device.c Sun Oct 11 20:46:56 2009 (r197970) @@ -847,18 +847,13 @@ usbd_set_alt_interface_index(struct usb_ err = USB_ERR_INVAL; goto done; } - if (udev->flags.usb_mode == USB_MODE_DEVICE) { - usb_detach_device(udev, iface_index, - USB_UNCFG_FLAG_FREE_SUBDEV); - } else { - if (iface->alt_index == alt_index) { - /* - * Optimise away duplicate setting of - * alternate setting in USB Host Mode! - */ - err = 0; - goto done; - } + if (iface->alt_index == alt_index) { + /* + * Optimise away duplicate setting of + * alternate setting in USB Host Mode! + */ + err = 0; + goto done; } #if USB_HAVE_UGEN /* @@ -872,6 +867,12 @@ usbd_set_alt_interface_index(struct usb_ if (err) { goto done; } + if (iface->alt_index != alt_index) { + /* the alternate setting does not exist */ + err = USB_ERR_INVAL; + goto done; + } + err = usbd_req_set_alt_interface_no(udev, NULL, iface_index, iface->idesc->bAlternateSetting); @@ -973,7 +974,6 @@ usb_reset_iface_endpoints(struct usb_dev { struct usb_endpoint *ep; struct usb_endpoint *ep_end; - usb_error_t err; ep = udev->endpoints; ep_end = udev->endpoints + udev->endpoints_max; @@ -985,10 +985,7 @@ usb_reset_iface_endpoints(struct usb_dev continue; } /* simulate a clear stall from the peer */ - err = usbd_set_endpoint_stall(udev, ep, 0); - if (err) { - /* just ignore */ - } + usbd_set_endpoint_stall(udev, ep, 0); } return (0); } @@ -1295,6 +1292,7 @@ usb_probe_and_attach(struct usb_device * uaa.info.bIfaceNum = iface->idesc->bInterfaceNumber; uaa.use_generic = 0; + uaa.driver_info = 0; /* reset driver_info */ DPRINTFN(2, "iclass=%u/%u/%u iindex=%u/%u\n", uaa.info.bInterfaceClass, @@ -1311,6 +1309,7 @@ usb_probe_and_attach(struct usb_device * /* try generic interface drivers last */ uaa.use_generic = 1; + uaa.driver_info = 0; /* reset driver_info */ if (usb_probe_and_attach_sub(udev, &uaa)) { /* ignore */ @@ -2377,6 +2376,7 @@ usb_notify_addq(const char *type, struct "devclass=0x%02x " "devsubclass=0x%02x " "sernum=\"%s\" " + "release=0x%04x " "at " "port=%u " "on " @@ -2388,6 +2388,7 @@ usb_notify_addq(const char *type, struct udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, udev->serial, + UGETW(udev->ddesc.bcdDevice), udev->port_no, udev->parent_hub != NULL ? udev->parent_hub->ugen_name : Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_hid.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_hid.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_hid.c Sun Oct 11 20:46:56 2009 (r197970) @@ -78,11 +78,19 @@ static uint8_t hid_get_byte(struct hid_d #define MAXUSAGE 64 #define MAXPUSH 4 +#define MAXID 16 + +struct hid_pos_data { + int32_t rid; + uint32_t pos; +}; + struct hid_data { const uint8_t *start; const uint8_t *end; const uint8_t *p; struct hid_item cur[MAXPUSH]; + struct hid_pos_data last_pos[MAXID]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; int32_t usage_last; /* last seen usage */ @@ -119,6 +127,58 @@ hid_clear_local(struct hid_item *c) c->set_delimiter = 0; } +static void +hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) +{ + uint8_t i; + + /* check for same report ID - optimise */ + + if (c->report_ID == next_rID) + return; + + /* save current position for current rID */ + + if (c->report_ID == 0) { + i = 0; + } else { + for (i = 1; i != MAXID; i++) { + if (s->last_pos[i].rid == c->report_ID) + break; + if (s->last_pos[i].rid == 0) + break; + } + } + if (i != MAXID) { + s->last_pos[i].rid = c->report_ID; + s->last_pos[i].pos = c->loc.pos; + } + + /* store next report ID */ + + c->report_ID = next_rID; + + /* lookup last position for next rID */ + + if (next_rID == 0) { + i = 0; + } else { + for (i = 1; i != MAXID; i++) { + if (s->last_pos[i].rid == next_rID) + break; + if (s->last_pos[i].rid == 0) + break; + } + } + if (i != MAXID) { + s->last_pos[i].rid = next_rID; + c->loc.pos = s->last_pos[i].pos; + } else { + DPRINTF("Out of RID entries, position is set to zero!\n"); + c->loc.pos = 0; + } +} + /*------------------------------------------------------------------------* * hid_start_parse *------------------------------------------------------------------------*/ @@ -373,9 +433,7 @@ hid_get_item(struct hid_data *s, struct s->loc_size = dval & mask; break; case 8: - c->report_ID = dval; - /* new report - reset position */ - c->loc.pos = 0; + hid_switch_rid(s, c, dval); break; case 9: /* mask because value is unsigned */ Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_parse.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_parse.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_parse.c Sun Oct 11 20:46:56 2009 (r197970) @@ -215,20 +215,29 @@ usbd_get_no_descriptors(struct usb_confi * usbd_get_no_alts * * Return value: - * Number of alternate settings for the given interface descriptor pointer. + * Number of alternate settings for the given interface descriptor + * pointer. If the USB descriptor is corrupt, the returned value can + * be greater than the actual number of alternate settings. *------------------------------------------------------------------------*/ uint8_t usbd_get_no_alts(struct usb_config_descriptor *cd, struct usb_interface_descriptor *id) { struct usb_descriptor *desc; - uint8_t n = 0; + uint8_t n; uint8_t ifaceno; + /* Reset interface count */ + + n = 0; + + /* Get the interface number */ + ifaceno = id->bInterfaceNumber; - desc = (struct usb_descriptor *)id; + /* Iterate all the USB descriptors */ + desc = NULL; while ((desc = usb_desc_foreach(cd, desc))) { if ((desc->bDescriptorType == UDESC_INTERFACE) && (desc->bLength >= sizeof(*id))) { @@ -237,8 +246,7 @@ usbd_get_no_alts(struct usb_config_descr n++; if (n == 0xFF) break; /* crazy */ - } else - break; /* end */ + } } } return (n); Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usb_request.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usb_request.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usb_request.c Sun Oct 11 20:46:56 2009 (r197970) @@ -1059,9 +1059,9 @@ usbd_req_get_alt_interface_no(struct usb struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL)) { + if ((iface == NULL) || (iface->idesc == NULL)) return (USB_ERR_INVAL); - } + req.bmRequestType = UT_READ_INTERFACE; req.bRequest = UR_GET_INTERFACE; USETW(req.wValue, 0); @@ -1085,9 +1085,9 @@ usbd_req_set_alt_interface_no(struct usb struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL)) { + if ((iface == NULL) || (iface->idesc == NULL)) return (USB_ERR_INVAL); - } + req.bmRequestType = UT_WRITE_INTERFACE; req.bRequest = UR_SET_INTERFACE; req.wValue[0] = alt_no; Modified: projects/tcp_ffcaia2008_head/sys/dev/usb/usbdevs ============================================================================== --- projects/tcp_ffcaia2008_head/sys/dev/usb/usbdevs Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/dev/usb/usbdevs Sun Oct 11 20:46:56 2009 (r197970) @@ -1128,6 +1128,8 @@ product CYPRESS THERMO 0x0002 thermomet product CYPRESS WISPY1A 0x0bad MetaGeek Wi-Spy product CYPRESS KBDHUB 0x0101 Keyboard/Hub product CYPRESS FMRADIO 0x1002 FM Radio +product CYPRESS IKARILASER 0x121f Ikari Laser SteelSeries ApS + product CYPRESS USBRS232 0x5500 USB-RS232 Interface product CYPRESS SLIM_HUB 0x6560 Slim Hub product CYPRESS XX6830XX 0x6830 PATA Storage Device @@ -1188,6 +1190,8 @@ product DLINK DSB650TX_PNA 0x4003 1/10/1 product DLINK DSB650TX3 0x400b 10/100 Ethernet product DLINK DSB650TX2 0x4102 10/100 Ethernet product DLINK DSB650 0xabc1 10/100 Ethernet +product DLINK2 DWA120_NF 0x3a0d DWA-120 (no firmware) +product DLINK2 DWA120 0x3a0e DWA-120 product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 product DLINK2 WUA1340 0x3c04 WUA-1340 product DLINK2 DWA111 0x3c06 DWA-111 @@ -1489,6 +1493,7 @@ product HTC SMARTPHONE 0x0a51 SmartPhon /* HUAWEI products */ product HUAWEI MOBILE 0x1001 Huawei Mobile product HUAWEI E220 0x1003 Huawei HSDPA modem +product HUAWEI E180V 0x140c Huawei Mobile E180V /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g Modified: projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_nat.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_nat.c Sun Oct 11 20:46:56 2009 (r197970) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 20:42:26 2009 (r197969) +++ projects/tcp_ffcaia2008_head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 20:46:56 2009 (r197970) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include