Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/input/wsp.c
Show All 38 Lines | |||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/fcntl.h> | #include <sys/fcntl.h> | ||||
#include <sys/file.h> | #include <sys/file.h> | ||||
#include <sys/selinfo.h> | #include <sys/selinfo.h> | ||||
#include <sys/poll.h> | #include <sys/poll.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <dev/hid/hid.h> | |||||
#include <dev/usb/usb.h> | #include <dev/usb/usb.h> | ||||
#include <dev/usb/usbdi.h> | #include <dev/usb/usbdi.h> | ||||
#include <dev/usb/usbdi_util.h> | #include <dev/usb/usbdi_util.h> | ||||
#include <dev/usb/usbhid.h> | #include <dev/usb/usbhid.h> | ||||
#include "usbdevs.h" | #include "usbdevs.h" | ||||
#define USB_DEBUG_VAR wsp_debug | #define USB_DEBUG_VAR wsp_debug | ||||
▲ Show 20 Lines • Show All 673 Lines • ▼ Show 20 Lines | wsp_attach(device_t dev) | ||||
DPRINTFN(WSP_LLEVEL_INFO, "sc=%p\n", sc); | DPRINTFN(WSP_LLEVEL_INFO, "sc=%p\n", sc); | ||||
/* Get HID descriptor */ | /* Get HID descriptor */ | ||||
err = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, | err = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, | ||||
&d_len, M_TEMP, uaa->info.bIfaceIndex); | &d_len, M_TEMP, uaa->info.bIfaceIndex); | ||||
if (err == USB_ERR_NORMAL_COMPLETION) { | if (err == USB_ERR_NORMAL_COMPLETION) { | ||||
/* Get HID report descriptor length */ | /* Get HID report descriptor length */ | ||||
sc->tp_datalen = hid_report_size(d_ptr, d_len, hid_input, NULL); | sc->tp_datalen = hid_report_size_max(d_ptr, d_len, hid_input, | ||||
NULL); | |||||
free(d_ptr, M_TEMP); | free(d_ptr, M_TEMP); | ||||
if (sc->tp_datalen <= 0 || sc->tp_datalen > WSP_BUFFER_MAX) { | if (sc->tp_datalen <= 0 || sc->tp_datalen > WSP_BUFFER_MAX) { | ||||
DPRINTF("Invalid datalength or too big " | DPRINTF("Invalid datalength or too big " | ||||
"datalength: %d\n", sc->tp_datalen); | "datalength: %d\n", sc->tp_datalen); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 664 Lines • Show Last 20 Lines |