Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hid/hidbus.c
Show All 34 Lines | |||||
#include <sys/kdb.h> | #include <sys/kdb.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/libkern.h> | #include <sys/libkern.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/systm.h> | #include <sys/sbuf.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/systm.h> | |||||
#define HID_DEBUG_VAR hid_debug | #define HID_DEBUG_VAR hid_debug | ||||
#include <dev/hid/hid.h> | #include <dev/hid/hid.h> | ||||
#include <dev/hid/hidbus.h> | #include <dev/hid/hidbus.h> | ||||
#include <dev/hid/hidquirk.h> | #include <dev/hid/hidquirk.h> | ||||
#include "hid_if.h" | #include "hid_if.h" | ||||
▲ Show 20 Lines • Show All 415 Lines • ▼ Show 20 Lines | hidbus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) | ||||
default: | default: | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
/* Location hint for devctl(8) */ | /* Location hint for devctl(8) */ | ||||
static int | static int | ||||
hidbus_child_location_str(device_t bus, device_t child, char *buf, | hidbus_child_location(device_t bus, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
struct hidbus_ivars *tlc = device_get_ivars(child); | struct hidbus_ivars *tlc = device_get_ivars(child); | ||||
snprintf(buf, buflen, "index=%hhu", tlc->index); | sbuf_printf(sb, "index=%hhu", tlc->index); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* PnP information for devctl(8) */ | /* PnP information for devctl(8) */ | ||||
static int | static int | ||||
hidbus_child_pnpinfo_str(device_t bus, device_t child, char *buf, | hidbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
struct hidbus_ivars *tlc = device_get_ivars(child); | struct hidbus_ivars *tlc = device_get_ivars(child); | ||||
struct hid_device_info *devinfo = device_get_ivars(bus); | struct hid_device_info *devinfo = device_get_ivars(bus); | ||||
snprintf(buf, buflen, "page=0x%04x usage=0x%04x bus=0x%02hx " | sbuf_printf(sb, "page=0x%04x usage=0x%04x bus=0x%02hx " | ||||
"vendor=0x%04hx product=0x%04hx version=0x%04hx%s%s", | "vendor=0x%04hx product=0x%04hx version=0x%04hx%s%s", | ||||
HID_GET_USAGE_PAGE(tlc->usage), HID_GET_USAGE(tlc->usage), | HID_GET_USAGE_PAGE(tlc->usage), HID_GET_USAGE(tlc->usage), | ||||
devinfo->idBus, devinfo->idVendor, devinfo->idProduct, | devinfo->idBus, devinfo->idVendor, devinfo->idProduct, | ||||
devinfo->idVersion, devinfo->idPnP[0] == '\0' ? "" : " _HID=", | devinfo->idVersion, devinfo->idPnP[0] == '\0' ? "" : " _HID=", | ||||
devinfo->idPnP[0] == '\0' ? "" : devinfo->idPnP); | devinfo->idPnP[0] == '\0' ? "" : devinfo->idPnP); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | static device_method_t hidbus_methods[] = { | ||||
DEVMETHOD(device_resume, bus_generic_resume), | DEVMETHOD(device_resume, bus_generic_resume), | ||||
/* bus interface */ | /* bus interface */ | ||||
DEVMETHOD(bus_add_child, hidbus_add_child), | DEVMETHOD(bus_add_child, hidbus_add_child), | ||||
DEVMETHOD(bus_child_detached, hidbus_child_detached), | DEVMETHOD(bus_child_detached, hidbus_child_detached), | ||||
DEVMETHOD(bus_child_deleted, hidbus_child_deleted), | DEVMETHOD(bus_child_deleted, hidbus_child_deleted), | ||||
DEVMETHOD(bus_read_ivar, hidbus_read_ivar), | DEVMETHOD(bus_read_ivar, hidbus_read_ivar), | ||||
DEVMETHOD(bus_write_ivar, hidbus_write_ivar), | DEVMETHOD(bus_write_ivar, hidbus_write_ivar), | ||||
DEVMETHOD(bus_child_pnpinfo_str,hidbus_child_pnpinfo_str), | DEVMETHOD(bus_child_pnpinfo, hidbus_child_pnpinfo), | ||||
DEVMETHOD(bus_child_location_str,hidbus_child_location_str), | DEVMETHOD(bus_child_location, hidbus_child_location), | ||||
/* hid interface */ | /* hid interface */ | ||||
DEVMETHOD(hid_get_rdesc, hid_get_rdesc), | DEVMETHOD(hid_get_rdesc, hid_get_rdesc), | ||||
DEVMETHOD(hid_read, hid_read), | DEVMETHOD(hid_read, hid_read), | ||||
DEVMETHOD(hid_write, hidbus_write), | DEVMETHOD(hid_write, hidbus_write), | ||||
DEVMETHOD(hid_get_report, hid_get_report), | DEVMETHOD(hid_get_report, hid_get_report), | ||||
DEVMETHOD(hid_set_report, hid_set_report), | DEVMETHOD(hid_set_report, hid_set_report), | ||||
DEVMETHOD(hid_set_idle, hid_set_idle), | DEVMETHOD(hid_set_idle, hid_set_idle), | ||||
Show All 16 Lines |