uep.c (227309) | uep.c (233774) |
---|---|
1/*- 2 * Copyright 2010, Gleb Smirnoff <glebius@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright 2010, Gleb Smirnoff <glebius@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/usb/input/uep.c 227309 2011-11-07 15:43:11Z ed $ | 26 * $FreeBSD: head/sys/dev/usb/input/uep.c 233774 2012-04-02 10:50:42Z hselasky $ |
27 */ 28 29/* 30 * http://home.eeti.com.tw/web20/drivers/Software%20Programming%20Guide_v2.0.pdf 31 */ 32 33#include <sys/param.h> 34#include <sys/bus.h> --- 162 unchanged lines hidden (view full) --- 197 198 switch (USB_GET_STATE(xfer)) { 199 case USB_ST_TRANSFERRED: 200 { 201 struct usb_page_cache *pc; 202 u_char buf[17], *p; 203 int pkt_len; 204 | 27 */ 28 29/* 30 * http://home.eeti.com.tw/web20/drivers/Software%20Programming%20Guide_v2.0.pdf 31 */ 32 33#include <sys/param.h> 34#include <sys/bus.h> --- 162 unchanged lines hidden (view full) --- 197 198 switch (USB_GET_STATE(xfer)) { 199 case USB_ST_TRANSFERRED: 200 { 201 struct usb_page_cache *pc; 202 u_char buf[17], *p; 203 int pkt_len; 204 |
205 if (len > sizeof(buf)) { | 205 if (len > (int)sizeof(buf)) { |
206 DPRINTF("bad input length %d\n", len); 207 goto tr_setup; 208 } 209 210 pc = usbd_xfer_get_frame(xfer, 0); 211 usbd_copy_out(pc, 0, buf, len); 212 213 /* --- 110 unchanged lines hidden (view full) --- 324 sc->xfer, uep_config, UEP_N_TRANSFER, sc, &sc->mtx); 325 326 if (error) { 327 DPRINTF("usbd_transfer_setup error=%s\n", usbd_errstr(error)); 328 goto detach; 329 } 330 331 error = usb_fifo_attach(uaa->device, sc, &sc->mtx, &uep_fifo_methods, | 206 DPRINTF("bad input length %d\n", len); 207 goto tr_setup; 208 } 209 210 pc = usbd_xfer_get_frame(xfer, 0); 211 usbd_copy_out(pc, 0, buf, len); 212 213 /* --- 110 unchanged lines hidden (view full) --- 324 sc->xfer, uep_config, UEP_N_TRANSFER, sc, &sc->mtx); 325 326 if (error) { 327 DPRINTF("usbd_transfer_setup error=%s\n", usbd_errstr(error)); 328 goto detach; 329 } 330 331 error = usb_fifo_attach(uaa->device, sc, &sc->mtx, &uep_fifo_methods, |
332 &sc->fifo, device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex, | 332 &sc->fifo, device_get_unit(dev), -1, uaa->info.bIfaceIndex, |
333 UID_ROOT, GID_OPERATOR, 0644); 334 335 if (error) { 336 DPRINTF("usb_fifo_attach error=%s\n", usbd_errstr(error)); 337 goto detach; 338 } 339 340 sc->buf_len = 0; --- 103 unchanged lines hidden --- | 333 UID_ROOT, GID_OPERATOR, 0644); 334 335 if (error) { 336 DPRINTF("usb_fifo_attach error=%s\n", usbd_errstr(error)); 337 goto detach; 338 } 339 340 sc->buf_len = 0; --- 103 unchanged lines hidden --- |