diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/hid/files.hid | 18 | ||||
-rw-r--r-- | sys/dev/hid/hid.c (renamed from sys/dev/usb/hid.c) | 7 | ||||
-rw-r--r-- | sys/dev/hid/hid.h | 404 | ||||
-rw-r--r-- | sys/dev/hid/hidkbd.c (renamed from sys/dev/usb/hidkbd.c) | 14 | ||||
-rw-r--r-- | sys/dev/hid/hidkbdsc.h (renamed from sys/dev/usb/hidkbdsc.h) | 5 | ||||
-rw-r--r-- | sys/dev/hid/hidkbdvar.h (renamed from sys/dev/usb/hidkbdvar.h) | 2 | ||||
-rw-r--r-- | sys/dev/hid/hidms.c (renamed from sys/dev/usb/hidms.c) | 20 | ||||
-rw-r--r-- | sys/dev/hid/hidmsvar.h (renamed from sys/dev/usb/hidmsvar.h) | 3 | ||||
-rw-r--r-- | sys/dev/isa/pcppi.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/files.usb | 10 | ||||
-rw-r--r-- | sys/dev/usb/hid.h | 89 | ||||
-rw-r--r-- | sys/dev/usb/ucycom.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/ugold.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/uhidev.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/uhidev.h | 6 | ||||
-rw-r--r-- | sys/dev/usb/ukbd.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/ums.c | 19 | ||||
-rw-r--r-- | sys/dev/usb/uoaklux.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/uoakrh.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/uoakv.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/upd.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/usbhid.h | 314 | ||||
-rw-r--r-- | sys/dev/usb/uslhcom.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/uthum.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/uticom.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/utrh.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/utwitch.c | 5 |
28 files changed, 512 insertions, 482 deletions
diff --git a/sys/dev/hid/files.hid b/sys/dev/hid/files.hid new file mode 100644 index 00000000000..c2bd1d2ce80 --- /dev/null +++ b/sys/dev/hid/files.hid @@ -0,0 +1,18 @@ +# $OpenBSD: files.hid,v 1.1 2016/01/08 15:54:13 jcs Exp $ + +# Human Interface Devices + +# HID "bus" +define hidbus {[reportid = -1]} + +# HID processing +define hid +file dev/hid/hid.c hid + +# Keyboards +define hidkbd +file dev/hid/hidkbd.c hidkbd needs-flag + +# Mice +define hidms +file dev/hid/hidms.c hidms diff --git a/sys/dev/usb/hid.c b/sys/dev/hid/hid.c index bae5cb23720..94a9bcf01f0 100644 --- a/sys/dev/usb/hid.c +++ b/sys/dev/hid/hid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hid.c,v 1.28 2014/07/12 18:48:52 tedu Exp $ */ +/* $OpenBSD: hid.c,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: hid.c,v 1.23 2002/07/11 21:14:25 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */ @@ -36,10 +36,7 @@ #include <sys/systm.h> #include <sys/malloc.h> -#include <dev/usb/usb.h> -#include <dev/usb/usbhid.h> - -#include <dev/usb/hid.h> +#include <dev/hid/hid.h> #ifdef USBHID_DEBUG #define DPRINTF(x...) do { printf(x); } while (0) diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h new file mode 100644 index 00000000000..53af2bae669 --- /dev/null +++ b/sys/dev/hid/hid.h @@ -0,0 +1,404 @@ +/* $OpenBSD: hid.h,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ +/* $NetBSD: hid.h,v 1.8 2002/07/11 21:14:25 augustss Exp $ */ +/* $FreeBSD: src/sys/dev/usb/hid.h,v 1.7 1999/11/17 22:33:40 n_hibma Exp $ */ + +/* + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _HIDHID_H_ +#define _HIDHID_H_ + +enum hid_kind { + hid_input, + hid_output, + hid_feature, + hid_collection, + hid_endcollection, + hid_none +}; + +struct hid_location { + u_int32_t size; + u_int32_t count; + u_int32_t pos; +}; + +struct hid_item { + /* Global */ + int32_t _usage_page; + int32_t logical_minimum; + int32_t logical_maximum; + int32_t physical_minimum; + int32_t physical_maximum; + int32_t unit_exponent; + int32_t unit; + int32_t report_ID; + /* Local */ + int32_t usage; + int32_t usage_minimum; + int32_t usage_maximum; + int32_t designator_index; + int32_t designator_minimum; + int32_t designator_maximum; + int32_t string_index; + int32_t string_minimum; + int32_t string_maximum; + int32_t set_delimiter; + /* Misc */ + int32_t collection; + int collevel; + enum hid_kind kind; + u_int32_t flags; + /* Location */ + struct hid_location loc; + /* */ + struct hid_item *next; +}; + +struct hid_data *hid_start_parse(const void *, int, enum hid_kind); +void hid_end_parse(struct hid_data *); +int hid_get_item(struct hid_data *, struct hid_item *); +int hid_report_size(const void *, int, enum hid_kind, uint8_t); +int hid_locate(const void *, int, int32_t, uint8_t, enum hid_kind, + struct hid_location *, uint32_t *); +int32_t hid_get_data(const uint8_t *buf, int, struct hid_location *); +int hid_is_collection(const void *, int, uint8_t, int32_t); + +/* Usage pages */ +#define HUP_UNDEFINED 0x0000 +#define HUP_GENERIC_DESKTOP 0x0001 +#define HUP_SIMULATION 0x0002 +#define HUP_VR_CONTROLS 0x0003 +#define HUP_SPORTS_CONTROLS 0x0004 +#define HUP_GAMING_CONTROLS 0x0005 +#define HUP_KEYBOARD 0x0007 +#define HUP_LED 0x0008 +#define HUP_BUTTON 0x0009 +#define HUP_ORDINALS 0x000a +#define HUP_TELEPHONY 0x000b +#define HUP_CONSUMER 0x000c +#define HUP_DIGITIZERS 0x000d +#define HUP_PHYSICAL_IFACE 0x000e +#define HUP_UNICODE 0x0010 +#define HUP_ALPHANUM_DISPLAY 0x0014 +#define HUP_MONITOR 0x0080 +#define HUP_MONITOR_ENUM_VAL 0x0081 +#define HUP_VESA_VC 0x0082 +#define HUP_VESA_CMD 0x0083 +#define HUP_POWER 0x0084 +#define HUP_BATTERY 0x0085 +#define HUP_BARCODE_SCANNER 0x008b +#define HUP_SCALE 0x008c +#define HUP_CAMERA_CONTROL 0x0090 +#define HUP_ARCADE 0x0091 +#define HUP_APPLE 0x00ff +#define HUP_MICROSOFT 0xff00 + +/* Usages, Power Device */ +#define HUP_INAME 0x0001 +#define HUP_PRESENT_STATUS 0x0002 +#define HUP_CHANGED_STATUS 0x0003 +#define HUP_UPS 0x0004 +#define HUP_POWER_SUPPLY 0x0005 +#define HUP_BATTERY_SYSTEM 0x0010 +#define HUP_BATTERY_SYSTEM_ID 0x0011 +#define HUP_PD_BATTERY 0x0012 +#define HUP_BATTERY_ID 0x0013 +#define HUP_CHARGER 0x0014 +#define HUP_CHARGER_ID 0x0015 +#define HUP_POWER_CONVERTER 0x0016 +#define HUP_POWER_CONVERTER_ID 0x0017 +#define HUP_OUTLET_SYSTEM 0x0018 +#define HUP_OUTLET_SYSTEM_ID 0x0019 +#define HUP_INPUT 0x001a +#define HUP_INPUT_ID 0x001b +#define HUP_OUTPUT 0x001c +#define HUP_OUTPUT_ID 0x001d +#define HUP_FLOW 0x001e +#define HUP_FLOW_ID 0x001f +#define HUP_OUTLET 0x0020 +#define HUP_OUTLET_ID 0x0021 +#define HUP_GANG 0x0022 +#define HUP_GANG_ID 0x0023 +#define HUP_POWER_SUMMARY 0x0024 +#define HUP_POWER_SUMMARY_ID 0x0025 +#define HUP_VOLTAGE 0x0030 +#define HUP_CURRENT 0x0031 +#define HUP_FREQUENCY 0x0032 +#define HUP_APPARENT_POWER 0x0033 +#define HUP_ACTIVE_POWER 0x0034 +#define HUP_PERCENT_LOAD 0x0035 +#define HUP_TEMPERATURE 0x0036 +#define HUP_HUMIDITY 0x0037 +#define HUP_BADCOUNT 0x0038 +#define HUP_CONFIG_VOLTAGE 0x0040 +#define HUP_CONFIG_CURRENT 0x0041 +#define HUP_CONFIG_FREQUENCY 0x0042 +#define HUP_CONFIG_APP_POWER 0x0043 +#define HUP_CONFIG_ACT_POWER 0x0044 +#define HUP_CONFIG_PERCENT_LOAD 0x0045 +#define HUP_CONFIG_TEMPERATURE 0x0046 +#define HUP_CONFIG_HUMIDITY 0x0047 +#define HUP_SWITCHON_CONTROL 0x0050 +#define HUP_SWITCHOFF_CONTROL 0x0051 +#define HUP_TOGGLE_CONTROL 0x0052 +#define HUP_LOW_VOLT_TRANSF 0x0053 +#define HUP_HIGH_VOLT_TRANSF 0x0054 +#define HUP_DELAYBEFORE_REBOOT 0x0055 +#define HUP_DELAYBEFORE_STARTUP 0x0056 +#define HUP_DELAYBEFORE_SHUTDWN 0x0057 +#define HUP_TEST 0x0058 +#define HUP_MODULE_RESET 0x0059 +#define HUP_AUDIBLE_ALRM_CTL 0x005a +#define HUP_PRESENT 0x0060 +#define HUP_GOOD 0x0061 +#define HUP_INTERNAL_FAILURE 0x0062 +#define HUP_PD_VOLT_OUTOF_RANGE 0x0063 +#define HUP_FREQ_OUTOFRANGE 0x0064 +#define HUP_OVERLOAD 0x0065 +#define HUP_OVERCHARGED 0x0066 +#define HUP_OVERTEMPERATURE 0x0067 +#define HUP_SHUTDOWN_REQUESTED 0x0068 +#define HUP_SHUTDOWN_IMMINENT 0x0069 +#define HUP_SWITCH_ON_OFF 0x006b +#define HUP_SWITCHABLE 0x006c +#define HUP_USED 0x006d +#define HUP_BOOST 0x006e +#define HUP_BUCK 0x006f +#define HUP_INITIALIZED 0x0070 +#define HUP_TESTED 0x0071 +#define HUP_AWAITING_POWER 0x0072 +#define HUP_COMMUNICATION_LOST 0x0073 +#define HUP_IMANUFACTURER 0x00fd +#define HUP_IPRODUCT 0x00fe +#define HUP_ISERIALNUMBER 0x00ff + +/* Usages, Battery */ +#define HUB_SMB_BATTERY_MODE 0x0001 +#define HUB_SMB_BATTERY_STATUS 0x0002 +#define HUB_SMB_ALARM_WARNING 0x0003 +#define HUB_SMB_CHARGER_MODE 0x0004 +#define HUB_SMB_CHARGER_STATUS 0x0005 +#define HUB_SMB_CHARGER_SPECINF 0x0006 +#define HUB_SMB_SELECTR_STATE 0x0007 +#define HUB_SMB_SELECTR_PRESETS 0x0008 +#define HUB_SMB_SELECTR_INFO 0x0009 +#define HUB_SMB_OPT_MFGFUNC1 0x0010 +#define HUB_SMB_OPT_MFGFUNC2 0x0011 +#define HUB_SMB_OPT_MFGFUNC3 0x0012 +#define HUB_SMB_OPT_MFGFUNC4 0x0013 +#define HUB_SMB_OPT_MFGFUNC5 0x0014 +#define HUB_CONNECTIONTOSMBUS 0x0015 +#define HUB_OUTPUT_CONNECTION 0x0016 +#define HUB_CHARGER_CONNECTION 0x0017 +#define HUB_BATTERY_INSERTION 0x0018 +#define HUB_USENEXT 0x0019 +#define HUB_OKTOUSE 0x001a +#define HUB_BATTERY_SUPPORTED 0x001b +#define HUB_SELECTOR_REVISION 0x001c +#define HUB_CHARGING_INDICATOR 0x001d +#define HUB_MANUFACTURER_ACCESS 0x0028 +#define HUB_REM_CAPACITY_LIM 0x0029 +#define HUB_REM_TIME_LIM 0x002a +#define HUB_ATRATE 0x002b +#define HUB_CAPACITY_MODE 0x002c +#define HUB_BCAST_TO_CHARGER 0x002d +#define HUB_PRIMARY_BATTERY 0x002e +#define HUB_CHANGE_CONTROLLER 0x002f +#define HUB_TERMINATE_CHARGE 0x0040 +#define HUB_TERMINATE_DISCHARGE 0x0041 +#define HUB_BELOW_REM_CAP_LIM 0x0042 +#define HUB_REM_TIME_LIM_EXP 0x0043 +#define HUB_CHARGING 0x0044 +#define HUB_DISCHARGING 0x0045 +#define HUB_FULLY_CHARGED 0x0046 +#define HUB_FULLY_DISCHARGED 0x0047 +#define HUB_CONDITIONING_FLAG 0x0048 +#define HUB_ATRATE_OK 0x0049 +#define HUB_SMB_ERROR_CODE 0x004a +#define HUB_NEED_REPLACEMENT 0x004b +#define HUB_ATRATE_TIMETOFULL 0x0060 +#define HUB_ATRATE_TIMETOEMPTY 0x0061 +#define HUB_AVERAGE_CURRENT 0x0062 +#define HUB_MAXERROR 0x0063 +#define HUB_REL_STATEOF_CHARGE 0x0064 +#define HUB_ABS_STATEOF_CHARGE 0x0065 +#define HUB_REM_CAPACITY 0x0066 +#define HUB_FULLCHARGE_CAPACITY 0x0067 +#define HUB_RUNTIMETO_EMPTY 0x0068 +#define HUB_AVERAGETIMETO_EMPTY 0x0069 +#define HUB_AVERAGETIMETO_FULL 0x006a +#define HUB_CYCLECOUNT 0x006b +#define HUB_BATTPACKMODEL_LEVEL 0x0080 +#define HUB_INTERNAL_CHARGE_CTL 0x0081 +#define HUB_PRIMARY_BATTERY_SUP 0x0082 +#define HUB_DESIGN_CAPACITY 0x0083 +#define HUB_SPECIFICATION_INFO 0x0084 +#define HUB_MANUFACTURER_DATE 0x0085 +#define HUB_SERIAL_NUMBER 0x0086 +#define HUB_IMANUFACTURERNAME 0x0087 +#define HUB_IDEVICENAME 0x0088 +#define HUB_IDEVICECHEMISTERY 0x0089 +#define HUB_MANUFACTURERDATA 0x008a +#define HUB_RECHARGABLE 0x008b +#define HUB_WARN_CAPACITY_LIM 0x008c +#define HUB_CAPACITY_GRANUL1 0x008d +#define HUB_CAPACITY_GRANUL2 0x008e +#define HUB_IOEM_INFORMATION 0x008f +#define HUB_INHIBIT_CHARGE 0x00c0 +#define HUB_ENABLE_POLLING 0x00c1 +#define HUB_RESTORE_TO_ZERO 0x00c2 +#define HUB_AC_PRESENT 0x00d0 +#define HUB_BATTERY_PRESENT 0x00d1 +#define HUB_POWER_FAIL 0x00d2 +#define HUB_ALARM_INHIBITED 0x00d3 +#define HUB_THERMISTOR_UNDRANGE 0x00d4 +#define HUB_THERMISTOR_HOT 0x00d5 +#define HUB_THERMISTOR_COLD 0x00d6 +#define HUB_THERMISTOR_OVERANGE 0x00d7 +#define HUB_BS_VOLT_OUTOF_RANGE 0x00d8 +#define HUB_BS_CURR_OUTOF_RANGE 0x00d9 +#define HUB_BS_CURR_NOT_REGULTD 0x00da +#define HUB_BS_VOLT_NOT_REGULTD 0x00db +#define HUB_MASTER_MODE 0x00dc +#define HUB_CHARGER_SELECTR_SUP 0x00f0 +#define HUB_CHARGER_SPEC 0x00f1 +#define HUB_LEVEL2 0x00f2 +#define HUB_LEVEL3 0x00f3 + +/* Usages, generic desktop */ +#define HUG_POINTER 0x0001 +#define HUG_MOUSE 0x0002 +#define HUG_FN_KEY 0x0003 +#define HUG_JOYSTICK 0x0004 +#define HUG_GAME_PAD 0x0005 +#define HUG_KEYBOARD 0x0006 +#define HUG_KEYPAD 0x0007 +#define HUG_X 0x0030 +#define HUG_Y 0x0031 +#define HUG_Z 0x0032 +#define HUG_RX 0x0033 +#define HUG_RY 0x0034 +#define HUG_RZ 0x0035 +#define HUG_SLIDER 0x0036 +#define HUG_DIAL 0x0037 +#define HUG_WHEEL 0x0038 +#define HUG_HAT_SWITCH 0x0039 +#define HUG_COUNTED_BUFFER 0x003a +#define HUG_BYTE_COUNT 0x003b +#define HUG_MOTION_WAKEUP 0x003c +#define HUG_VX 0x0040 +#define HUG_VY 0x0041 +#define HUG_VZ 0x0042 +#define HUG_VBRX 0x0043 +#define HUG_VBRY 0x0044 +#define HUG_VBRZ 0x0045 +#define HUG_VNO 0x0046 +#define HUG_TWHEEL 0x0048 +#define HUG_SYSTEM_CONTROL 0x0080 +#define HUG_SYSTEM_POWER_DOWN 0x0081 +#define HUG_SYSTEM_SLEEP 0x0082 +#define HUG_SYSTEM_WAKEUP 0x0083 +#define HUG_SYSTEM_CONTEXT_MENU 0x0084 +#define HUG_SYSTEM_MAIN_MENU 0x0085 +#define HUG_SYSTEM_APP_MENU 0x0086 +#define HUG_SYSTEM_MENU_HELP 0x0087 +#define HUG_SYSTEM_MENU_EXIT 0x0088 +#define HUG_SYSTEM_MENU_SELECT 0x0089 +#define HUG_SYSTEM_MENU_RIGHT 0x008a +#define HUG_SYSTEM_MENU_LEFT 0x008b +#define HUG_SYSTEM_MENU_UP 0x008c +#define HUG_SYSTEM_MENU_DOWN 0x008d + +/* Usages, Digitizers */ +#define HUD_UNDEFINED 0x0000 +#define HUD_DIGITIZER 0x0001 +#define HUD_PEN 0x0002 +#define HUD_TOUCHSCREEN 0x0004 +#define HUD_TOUCHPAD 0x0005 +#define HUD_FINGER 0x0022 +#define HUD_TIP_PRESSURE 0x0030 +#define HUD_BARREL_PRESSURE 0x0031 +#define HUD_IN_RANGE 0x0032 +#define HUD_TOUCH 0x0033 +#define HUD_UNTOUCH 0x0034 +#define HUD_TAP 0x0035 +#define HUD_QUALITY 0x0036 +#define HUD_DATA_VALID 0x0037 +#define HUD_TRANSDUCER_INDEX 0x0038 +#define HUD_TABLET_FKEYS 0x0039 +#define HUD_PROGRAM_CHANGE_KEYS 0x003a +#define HUD_BATTERY_STRENGTH 0x003b +#define HUD_INVERT 0x003c +#define HUD_X_TILT 0x003d +#define HUD_Y_TILT 0x003e +#define HUD_AZIMUTH 0x003f +#define HUD_ALTITUDE 0x0040 +#define HUD_TWIST 0x0041 +#define HUD_TIP_SWITCH 0x0042 +#define HUD_SEC_TIP_SWITCH 0x0043 +#define HUD_BARREL_SWITCH 0x0044 +#define HUD_ERASER 0x0045 +#define HUD_TABLET_PICK 0x0046 + +/* Usages, LED */ +#define HUL_NUM_LOCK 0x0001 +#define HUL_CAPS_LOCK 0x0002 +#define HUL_SCROLL_LOCK 0x0003 +#define HUL_COMPOSE 0x0004 +#define HUL_KANA 0x0005 + +/* Usages, Consumer */ +#define HUC_AC_PAN 0x0238 + +#define HID_USAGE2(p, u) (((p) << 16) | u) +#define HID_GET_USAGE(u) ((u) & 0xffff) +#define HID_GET_USAGE_PAGE(u) (((u) >> 16) & 0xffff) + +#define HCOLL_PHYSICAL 0 +#define HCOLL_APPLICATION 1 +#define HCOLL_LOGICAL 2 + +/* Bits in the input/output/feature items */ +#define HIO_CONST 0x001 +#define HIO_VARIABLE 0x002 +#define HIO_RELATIVE 0x004 +#define HIO_WRAP 0x008 +#define HIO_NONLINEAR 0x010 +#define HIO_NOPREF 0x020 +#define HIO_NULLSTATE 0x040 +#define HIO_VOLATILE 0x080 +#define HIO_BUFBYTES 0x100 + +/* Valid values for the country codes */ +#define HCC_UNDEFINED 0x00 +#define HCC_MAX 0x23 + +#endif /* _HIDHID_H_ */ diff --git a/sys/dev/usb/hidkbd.c b/sys/dev/hid/hidkbd.c index f22583472e4..241ffc7bc3e 100644 --- a/sys/dev/usb/hidkbd.c +++ b/sys/dev/hid/hidkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbd.c,v 1.16 2015/07/15 14:15:46 miod Exp $ */ +/* $OpenBSD: hidkbd.c,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -43,18 +43,13 @@ #include <sys/ioctl.h> #include <sys/malloc.h> -#include <dev/usb/usb.h> -#include <dev/usb/usbhid.h> - -#include <dev/usb/usb_quirks.h> -#include <dev/usb/hid.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wskbdvar.h> #include <dev/wscons/wsksymdef.h> #include <dev/wscons/wsksymvar.h> -#include <dev/usb/hidkbdsc.h> +#include <dev/hid/hid.h> +#include <dev/hid/hidkbdsc.h> #ifdef HIDKBD_DEBUG #define DPRINTF(x) do { if (hidkbddebug) printf x; } while (0) @@ -178,7 +173,8 @@ hidkbd_attach(struct device *self, struct hidkbd *kbd, int console, #endif kbd->sc_device = self; - kbd->sc_debounce = (qflags & UQ_SPUR_BUT_UP) != 0; + kbd->sc_debounce = (qflags & HIDKBD_SPUR_BUT_UP) != 0; + /* * Remember if we're the console keyboard. * diff --git a/sys/dev/usb/hidkbdsc.h b/sys/dev/hid/hidkbdsc.h index 3156886e633..02c67fb2ff0 100644 --- a/sys/dev/usb/hidkbdsc.h +++ b/sys/dev/hid/hidkbdsc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbdsc.h,v 1.4 2012/07/13 12:33:08 shadchin Exp $ */ +/* $OpenBSD: hidkbdsc.h,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -36,6 +36,9 @@ #define MAXKEYS (MAXVARS+2*MAXKEYCODE) +/* quirks */ +#define HIDKBD_SPUR_BUT_UP 0x001 /* spurious button up events */ + struct hidkbd_variable { struct hid_location loc; u_int8_t mask; diff --git a/sys/dev/usb/hidkbdvar.h b/sys/dev/hid/hidkbdvar.h index 44b3d6408c2..17efebe3624 100644 --- a/sys/dev/usb/hidkbdvar.h +++ b/sys/dev/hid/hidkbdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbdvar.h,v 1.1 2010/07/31 16:04:50 miod Exp $ */ +/* $OpenBSD: hidkbdvar.h,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* diff --git a/sys/dev/usb/hidms.c b/sys/dev/hid/hidms.c index 1f9c0bfadef..e52c3cb7622 100644 --- a/sys/dev/usb/hidms.c +++ b/sys/dev/hid/hidms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidms.c,v 1.8 2015/11/05 15:41:15 jcs Exp $ */ +/* $OpenBSD: hidms.c,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -41,16 +41,11 @@ #include <sys/device.h> #include <sys/ioctl.h> -#include <dev/usb/usb.h> -#include <dev/usb/usbhid.h> - -#include <dev/usb/usb_quirks.h> -#include <dev/usb/hid.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsmousevar.h> -#include <dev/usb/hidmsvar.h> +#include <dev/hid/hid.h> +#include <dev/hid/hidmsvar.h> #ifdef HIDMS_DEBUG #define DPRINTF(x) do { if (hidmsdebug) printf x; } while (0) @@ -78,12 +73,7 @@ hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks, ms->sc_device = self; ms->sc_rawmode = 1; - if (quirks & UQ_MS_REVZ) - ms->sc_flags |= HIDMS_REVZ; - if (quirks & UQ_SPUR_BUT_UP) - ms->sc_flags |= HIDMS_SPUR_BUT_UP; - if (quirks & UQ_MS_LEADING_BYTE) - ms->sc_flags |= HIDMS_LEADINGBYTE; + ms->sc_flags = quirks; if (!hid_locate(desc, dlen, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), id, hid_input, &ms->sc_loc_x, &flags)) { @@ -228,7 +218,7 @@ hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks, * all of its other button positions are all off. It also reports that * it has two addional buttons and a tilt wheel. */ - if (quirks & UQ_MS_BAD_CLASS) { + if (ms->sc_flags & HIDMS_MS_BAD_CLASS) { /* HIDMS_LEADINGBYTE cleared on purpose */ ms->sc_flags = HIDMS_Z | HIDMS_SPUR_BUT_UP; ms->sc_num_buttons = 3; diff --git a/sys/dev/usb/hidmsvar.h b/sys/dev/hid/hidmsvar.h index d4a14149bf2..355cb8b553d 100644 --- a/sys/dev/usb/hidmsvar.h +++ b/sys/dev/hid/hidmsvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hidmsvar.h,v 1.3 2013/08/09 22:10:17 edd Exp $ */ +/* $OpenBSD: hidmsvar.h,v 1.1 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -54,6 +54,7 @@ struct hidms { #define HIDMS_TIP 0x100 /* Tip switch on a digitiser pen */ #define HIDMS_BARREL 0x200 /* Barrel switch on a digitiser pen */ #define HIDMS_ERASER 0x400 /* Eraser switch on a digitiser pen */ +#define HIDMS_MS_BAD_CLASS 0x800 /* Mouse doesn't identify properly */ int sc_num_buttons; u_int32_t sc_buttons; /* mouse button status */ diff --git a/sys/dev/isa/pcppi.c b/sys/dev/isa/pcppi.c index c7133c7b686..16e2f2cf0cf 100644 --- a/sys/dev/isa/pcppi.c +++ b/sys/dev/isa/pcppi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcppi.c,v 1.12 2014/09/21 04:29:42 jsg Exp $ */ +/* $OpenBSD: pcppi.c,v 1.13 2016/01/08 15:54:13 jcs Exp $ */ /* $NetBSD: pcppi.c,v 1.1 1998/04/15 20:26:18 drochner Exp $ */ /* @@ -49,7 +49,7 @@ #if NPCKBD > 0 || NHIDKBD > 0 #include <dev/ic/pckbcvar.h> #include <dev/pckbc/pckbdvar.h> -#include <dev/usb/hidkbdvar.h> +#include <dev/hid/hidkbdvar.h> void pcppi_kbd_bell(void *, u_int, u_int, u_int, int); #endif diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb index 03a158ad607..4b8fcc96374 100644 --- a/sys/dev/usb/files.usb +++ b/sys/dev/usb/files.usb @@ -1,4 +1,4 @@ -# $OpenBSD: files.usb,v 1.125 2016/01/08 09:36:59 mpi Exp $ +# $OpenBSD: files.usb,v 1.126 2016/01/08 15:54:13 jcs Exp $ # $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $ # # Config file and device description for machine-independent USB code. @@ -61,10 +61,6 @@ file dev/usb/ugen.c ugen needs-flag # HID "bus" define uhidbus {[reportid = -1]} -# HID processing -define hid -file dev/usb/hid.c hid - # HID root device for multiple report IDs device uhidev: hid, uhidbus attach uhidev at uhub @@ -76,16 +72,12 @@ attach uhid at uhidbus file dev/usb/uhid.c uhid needs-flag # Keyboards -define hidkbd -file dev/usb/hidkbd.c hidkbd needs-flag file dev/usb/ukbdmap.c hidkbd device ukbd: hid, hidkbd, wskbddev attach ukbd at uhidbus file dev/usb/ukbd.c ukbd needs-flag # Mice -define hidms -file dev/usb/hidms.c hidms device ums: hid, hidms, wsmousedev attach ums at uhidbus file dev/usb/ums.c ums diff --git a/sys/dev/usb/hid.h b/sys/dev/usb/hid.h deleted file mode 100644 index fba36617228..00000000000 --- a/sys/dev/usb/hid.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $OpenBSD: hid.h,v 1.11 2014/05/12 09:50:44 mpi Exp $ */ -/* $NetBSD: hid.h,v 1.8 2002/07/11 21:14:25 augustss Exp $ */ -/* $FreeBSD: src/sys/dev/usb/hid.h,v 1.7 1999/11/17 22:33:40 n_hibma Exp $ */ - -/* - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Lennart Augustsson (lennart@augustsson.net) at - * Carlstedt Research & Technology. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -enum hid_kind { - hid_input, - hid_output, - hid_feature, - hid_collection, - hid_endcollection, - hid_none -}; - -struct hid_location { - u_int32_t size; - u_int32_t count; - u_int32_t pos; -}; - -struct hid_item { - /* Global */ - int32_t _usage_page; - int32_t logical_minimum; - int32_t logical_maximum; - int32_t physical_minimum; - int32_t physical_maximum; - int32_t unit_exponent; - int32_t unit; - int32_t report_ID; - /* Local */ - int32_t usage; - int32_t usage_minimum; - int32_t usage_maximum; - int32_t designator_index; - int32_t designator_minimum; - int32_t designator_maximum; - int32_t string_index; - int32_t string_minimum; - int32_t string_maximum; - int32_t set_delimiter; - /* Misc */ - int32_t collection; - int collevel; - enum hid_kind kind; - u_int32_t flags; - /* Location */ - struct hid_location loc; - /* */ - struct hid_item *next; -}; - -struct hid_data *hid_start_parse(const void *, int, enum hid_kind); -void hid_end_parse(struct hid_data *); -int hid_get_item(struct hid_data *, struct hid_item *); -int hid_report_size(const void *, int, enum hid_kind, uint8_t); -int hid_locate(const void *, int, int32_t, uint8_t, enum hid_kind, - struct hid_location *, uint32_t *); -int32_t hid_get_data(const uint8_t *buf, int, struct hid_location *); -int hid_is_collection(const void *, int, uint8_t, int32_t); diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c index a75c1fd484f..47ce48065e5 100644 --- a/sys/dev/usb/ucycom.c +++ b/sys/dev/usb/ucycom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucycom.c,v 1.32 2015/01/04 08:42:04 jsg Exp $ */ +/* $OpenBSD: ucycom.c,v 1.33 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: ucycom.c,v 1.3 2005/08/05 07:27:47 skrll Exp $ */ /* @@ -54,10 +54,11 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> #include <dev/usb/ucomvar.h> +#include <dev/hid/hid.h> + #ifdef UCYCOM_DEBUG #define DPRINTF(x) if (ucycomdebug) printf x #define DPRINTFN(n, x) if (ucycomdebug > (n)) printf x diff --git a/sys/dev/usb/ugold.c b/sys/dev/usb/ugold.c index 9eb90d1277b..fb5cf286ac3 100644 --- a/sys/dev/usb/ugold.c +++ b/sys/dev/usb/ugold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugold.c,v 1.10 2015/08/12 07:21:15 yuo Exp $ */ +/* $OpenBSD: ugold.c,v 1.11 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2013 Takayoshi SASANO <uaa@openbsd.org> @@ -36,7 +36,8 @@ #include <dev/usb/usbdi.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> #define UGOLD_INNER 0 #define UGOLD_OUTER 1 diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index d64c889d1da..4c73f4f1cdc 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.61 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: uhid.c,v 1.62 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -56,10 +56,11 @@ #include <dev/usb/usbdevs.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> -#include <dev/usb/hid.h> #include <dev/usb/uhidev.h> +#include <dev/hid/hid.h> + #ifdef UHID_DEBUG #define DPRINTF(x) do { if (uhiddebug) printf x; } while (0) #define DPRINTFN(n,x) do { if (uhiddebug>(n)) printf x; } while (0) diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 135b918a00a..ed4abe6ec5b 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.71 2015/12/08 09:49:22 mpi Exp $ */ +/* $OpenBSD: uhidev.c,v 1.72 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -54,11 +54,12 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdivar.h> #include <dev/usb/usb_mem.h> -#include <dev/usb/hid.h> #include <dev/usb/usb_quirks.h> #include <dev/usb/uhidev.h> +#include <dev/hid/hid.h> + #ifndef SMALL_KERNEL /* Replacement report descriptors for devices shipped with broken ones */ #include <dev/usb/uhid_rdesc.h> diff --git a/sys/dev/usb/uhidev.h b/sys/dev/usb/uhidev.h index ad00e8f8bf7..761d278b962 100644 --- a/sys/dev/usb/uhidev.h +++ b/sys/dev/usb/uhidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.h,v 1.22 2015/01/09 12:07:50 mpi Exp $ */ +/* $OpenBSD: uhidev.h,v 1.23 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: uhidev.h,v 1.3 2002/10/08 09:56:17 dan Exp $ */ /* @@ -37,6 +37,10 @@ #define uhidevcf_reportid cf_loc[UHIDBUSCF_REPORTID] #define UHIDEV_UNK_REPORTID UHIDBUSCF_REPORTID_DEFAULT +#define UHID_INPUT_REPORT 0x01 +#define UHID_OUTPUT_REPORT 0x02 +#define UHID_FEATURE_REPORT 0x03 + struct uhidev_softc { struct device sc_dev; /* base device */ struct usbd_device *sc_udev; diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index 5ad06f3139c..531080a22c7 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukbd.c,v 1.73 2015/12/25 20:28:48 jung Exp $ */ +/* $OpenBSD: ukbd.c,v 1.74 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -65,7 +65,6 @@ #include <dev/usb/usbdevs.h> #include <dev/usb/usb_quirks.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> #include <dev/usb/ukbdvar.h> #include <dev/wscons/wsconsio.h> @@ -73,7 +72,8 @@ #include <dev/wscons/wsksymdef.h> #include <dev/wscons/wsksymvar.h> -#include <dev/usb/hidkbdsc.h> +#include <dev/hid/hid.h> +#include <dev/hid/hidkbdsc.h> #ifdef UKBD_DEBUG #define DPRINTF(x) do { if (ukbddebug) printf x; } while (0) @@ -208,7 +208,7 @@ ukbd_attach(struct device *parent, struct device *self, void *aux) struct hidkbd *kbd = &sc->sc_kbd; struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux; struct usb_hid_descriptor *hid; - u_int32_t qflags; + u_int32_t quirks, qflags; int dlen, repid; int console = 1; void *desc; @@ -233,7 +233,10 @@ ukbd_attach(struct device *parent, struct device *self, void *aux) uha->uaa->product == USB_PRODUCT_APPLE_BLUETOOTH_HCI) console = 0; - qflags = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags; + quirks = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags; + if (quirks & UQ_SPUR_BUT_UP) + qflags |= HIDKBD_SPUR_BUT_UP; + if (hidkbd_attach(self, kbd, console, qflags, repid, desc, dlen) != 0) return; diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 2576f414d3a..0ad2d057cf9 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ums.c,v 1.40 2014/12/28 15:24:08 matthieu Exp $ */ +/* $OpenBSD: ums.c,v 1.41 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -49,12 +49,12 @@ #include <dev/usb/usbdevs.h> #include <dev/usb/usb_quirks.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsmousevar.h> -#include <dev/usb/hidmsvar.h> +#include <dev/hid/hid.h> +#include <dev/hid/hidmsvar.h> struct ums_softc { struct uhidev sc_hdev; @@ -122,7 +122,7 @@ ums_attach(struct device *parent, struct device *self, void *aux) struct usb_attach_arg *uaa = uha->uaa; int size, repid; void *desc; - u_int32_t quirks; + u_int32_t quirks, qflags; sc->sc_hdev.sc_intr = ums_intr; sc->sc_hdev.sc_parent = uha->parent; @@ -136,7 +136,16 @@ ums_attach(struct device *parent, struct device *self, void *aux) sc->sc_hdev.sc_osize = hid_report_size(desc, size, hid_output, repid); sc->sc_hdev.sc_fsize = hid_report_size(desc, size, hid_feature, repid); - if (hidms_setup(self, ms, quirks, uha->reportid, desc, size) != 0) + if (quirks & UQ_MS_REVZ) + qflags |= HIDMS_REVZ; + if (quirks & UQ_SPUR_BUT_UP) + qflags |= HIDMS_SPUR_BUT_UP; + if (quirks & UQ_MS_BAD_CLASS) + qflags |= HIDMS_MS_BAD_CLASS; + if (quirks & UQ_MS_LEADING_BYTE) + qflags |= HIDMS_LEADINGBYTE; + + if (hidms_setup(self, ms, qflags, uha->reportid, desc, size) != 0) return; /* diff --git a/sys/dev/usb/uoaklux.c b/sys/dev/usb/uoaklux.c index 8828a366357..e441241af29 100644 --- a/sys/dev/usb/uoaklux.c +++ b/sys/dev/usb/uoaklux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uoaklux.c,v 1.10 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: uoaklux.c,v 1.11 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2012 Yojiro UO <yuo@nui.org> @@ -32,7 +32,9 @@ #include <dev/usb/usbdi.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> + #include "uoak.h" #ifdef UOAKLUX_DEBUG diff --git a/sys/dev/usb/uoakrh.c b/sys/dev/usb/uoakrh.c index c27f9fcd512..4181bc51da5 100644 --- a/sys/dev/usb/uoakrh.c +++ b/sys/dev/usb/uoakrh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uoakrh.c,v 1.11 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: uoakrh.c,v 1.12 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2012 Yojiro UO <yuo@nui.org> @@ -32,7 +32,9 @@ #include <dev/usb/usbdi.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> + #include "uoak.h" #ifdef OARKRH_DEBUG diff --git a/sys/dev/usb/uoakv.c b/sys/dev/usb/uoakv.c index 788ae6c4549..3cd049f7698 100644 --- a/sys/dev/usb/uoakv.c +++ b/sys/dev/usb/uoakv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uoakv.c,v 1.10 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: uoakv.c,v 1.11 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2012 Yojiro UO <yuo@nui.org> @@ -32,7 +32,9 @@ #include <dev/usb/usbdi.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> + #include "uoak.h" #ifdef UOAKV_DEBUG diff --git a/sys/dev/usb/upd.c b/sys/dev/usb/upd.c index b67908479b7..7b7c4cb53ee 100644 --- a/sys/dev/usb/upd.c +++ b/sys/dev/usb/upd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upd.c,v 1.23 2015/10/01 14:03:44 mpi Exp $ */ +/* $OpenBSD: upd.c,v 1.24 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2015 David Higgs <higgsd@gmail.com> @@ -27,7 +27,6 @@ #include <sys/queue.h> #include <sys/sensors.h> -#include <dev/usb/hid.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdevs.h> @@ -35,6 +34,8 @@ #include <dev/usb/uhidev.h> #include <dev/usb/usbdi_util.h> +#include <dev/hid/hid.h> + #ifdef UPD_DEBUG #define DPRINTF(x) do { printf x; } while (0) #else diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 5f5422fad29..f6a17d798d2 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbhid.h,v 1.18 2015/06/17 08:31:55 mpi Exp $ */ +/* $OpenBSD: usbhid.h,v 1.19 2016/01/08 15:54:14 jcs Exp $ */ /* $NetBSD: usbhid.h,v 1.11 2001/12/28 00:20:24 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbhid.h,v 1.7 1999/11/17 22:33:51 n_hibma Exp $ */ @@ -61,316 +61,4 @@ struct usb_hid_descriptor { } __packed; #define USB_HID_DESCRIPTOR_SIZE(n) (9+(n)*3) -/* Usage pages */ -#define HUP_UNDEFINED 0x0000 -#define HUP_GENERIC_DESKTOP 0x0001 -#define HUP_SIMULATION 0x0002 -#define HUP_VR_CONTROLS 0x0003 -#define HUP_SPORTS_CONTROLS 0x0004 -#define HUP_GAMING_CONTROLS 0x0005 -#define HUP_KEYBOARD 0x0007 -#define HUP_LED 0x0008 -#define HUP_BUTTON 0x0009 -#define HUP_ORDINALS 0x000a -#define HUP_TELEPHONY 0x000b -#define HUP_CONSUMER 0x000c -#define HUP_DIGITIZERS 0x000d -#define HUP_PHYSICAL_IFACE 0x000e -#define HUP_UNICODE 0x0010 -#define HUP_ALPHANUM_DISPLAY 0x0014 -#define HUP_MONITOR 0x0080 -#define HUP_MONITOR_ENUM_VAL 0x0081 -#define HUP_VESA_VC 0x0082 -#define HUP_VESA_CMD 0x0083 -#define HUP_POWER 0x0084 -#define HUP_BATTERY 0x0085 -#define HUP_BARCODE_SCANNER 0x008b -#define HUP_SCALE 0x008c -#define HUP_CAMERA_CONTROL 0x0090 -#define HUP_ARCADE 0x0091 -#define HUP_APPLE 0x00ff -#define HUP_MICROSOFT 0xff00 - -/* Usages, Power Device */ -#define HUP_INAME 0x0001 -#define HUP_PRESENT_STATUS 0x0002 -#define HUP_CHANGED_STATUS 0x0003 -#define HUP_UPS 0x0004 -#define HUP_POWER_SUPPLY 0x0005 -#define HUP_BATTERY_SYSTEM 0x0010 -#define HUP_BATTERY_SYSTEM_ID 0x0011 -#define HUP_PD_BATTERY 0x0012 -#define HUP_BATTERY_ID 0x0013 -#define HUP_CHARGER 0x0014 -#define HUP_CHARGER_ID 0x0015 -#define HUP_POWER_CONVERTER 0x0016 -#define HUP_POWER_CONVERTER_ID 0x0017 -#define HUP_OUTLET_SYSTEM 0x0018 -#define HUP_OUTLET_SYSTEM_ID 0x0019 -#define HUP_INPUT 0x001a -#define HUP_INPUT_ID 0x001b -#define HUP_OUTPUT 0x001c -#define HUP_OUTPUT_ID 0x001d -#define HUP_FLOW 0x001e -#define HUP_FLOW_ID 0x001f -#define HUP_OUTLET 0x0020 -#define HUP_OUTLET_ID 0x0021 -#define HUP_GANG 0x0022 -#define HUP_GANG_ID 0x0023 -#define HUP_POWER_SUMMARY 0x0024 -#define HUP_POWER_SUMMARY_ID 0x0025 -#define HUP_VOLTAGE 0x0030 -#define HUP_CURRENT 0x0031 -#define HUP_FREQUENCY 0x0032 -#define HUP_APPARENT_POWER 0x0033 -#define HUP_ACTIVE_POWER 0x0034 -#define HUP_PERCENT_LOAD 0x0035 -#define HUP_TEMPERATURE 0x0036 -#define HUP_HUMIDITY 0x0037 -#define HUP_BADCOUNT 0x0038 -#define HUP_CONFIG_VOLTAGE 0x0040 -#define HUP_CONFIG_CURRENT 0x0041 -#define HUP_CONFIG_FREQUENCY 0x0042 -#define HUP_CONFIG_APP_POWER 0x0043 -#define HUP_CONFIG_ACT_POWER 0x0044 -#define HUP_CONFIG_PERCENT_LOAD 0x0045 -#define HUP_CONFIG_TEMPERATURE 0x0046 -#define HUP_CONFIG_HUMIDITY 0x0047 -#define HUP_SWITCHON_CONTROL 0x0050 -#define HUP_SWITCHOFF_CONTROL 0x0051 -#define HUP_TOGGLE_CONTROL 0x0052 -#define HUP_LOW_VOLT_TRANSF 0x0053 -#define HUP_HIGH_VOLT_TRANSF 0x0054 -#define HUP_DELAYBEFORE_REBOOT 0x0055 -#define HUP_DELAYBEFORE_STARTUP 0x0056 -#define HUP_DELAYBEFORE_SHUTDWN 0x0057 -#define HUP_TEST 0x0058 -#define HUP_MODULE_RESET 0x0059 -#define HUP_AUDIBLE_ALRM_CTL 0x005a -#define HUP_PRESENT 0x0060 -#define HUP_GOOD 0x0061 -#define HUP_INTERNAL_FAILURE 0x0062 -#define HUP_PD_VOLT_OUTOF_RANGE 0x0063 -#define HUP_FREQ_OUTOFRANGE 0x0064 -#define HUP_OVERLOAD 0x0065 -#define HUP_OVERCHARGED 0x0066 -#define HUP_OVERTEMPERATURE 0x0067 -#define HUP_SHUTDOWN_REQUESTED 0x0068 -#define HUP_SHUTDOWN_IMMINENT 0x0069 -#define HUP_SWITCH_ON_OFF 0x006b -#define HUP_SWITCHABLE 0x006c -#define HUP_USED 0x006d -#define HUP_BOOST 0x006e -#define HUP_BUCK 0x006f -#define HUP_INITIALIZED 0x0070 -#define HUP_TESTED 0x0071 -#define HUP_AWAITING_POWER 0x0072 -#define HUP_COMMUNICATION_LOST 0x0073 -#define HUP_IMANUFACTURER 0x00fd -#define HUP_IPRODUCT 0x00fe -#define HUP_ISERIALNUMBER 0x00ff - -/* Usages, Battery */ -#define HUB_SMB_BATTERY_MODE 0x0001 -#define HUB_SMB_BATTERY_STATUS 0x0002 -#define HUB_SMB_ALARM_WARNING 0x0003 -#define HUB_SMB_CHARGER_MODE 0x0004 -#define HUB_SMB_CHARGER_STATUS 0x0005 -#define HUB_SMB_CHARGER_SPECINF 0x0006 -#define HUB_SMB_SELECTR_STATE 0x0007 -#define HUB_SMB_SELECTR_PRESETS 0x0008 -#define HUB_SMB_SELECTR_INFO 0x0009 -#define HUB_SMB_OPT_MFGFUNC1 0x0010 -#define HUB_SMB_OPT_MFGFUNC2 0x0011 -#define HUB_SMB_OPT_MFGFUNC3 0x0012 -#define HUB_SMB_OPT_MFGFUNC4 0x0013 -#define HUB_SMB_OPT_MFGFUNC5 0x0014 -#define HUB_CONNECTIONTOSMBUS 0x0015 -#define HUB_OUTPUT_CONNECTION 0x0016 -#define HUB_CHARGER_CONNECTION 0x0017 -#define HUB_BATTERY_INSERTION 0x0018 -#define HUB_USENEXT 0x0019 -#define HUB_OKTOUSE 0x001a -#define HUB_BATTERY_SUPPORTED 0x001b -#define HUB_SELECTOR_REVISION 0x001c -#define HUB_CHARGING_INDICATOR 0x001d -#define HUB_MANUFACTURER_ACCESS 0x0028 -#define HUB_REM_CAPACITY_LIM 0x0029 -#define HUB_REM_TIME_LIM 0x002a -#define HUB_ATRATE 0x002b -#define HUB_CAPACITY_MODE 0x002c -#define HUB_BCAST_TO_CHARGER 0x002d -#define HUB_PRIMARY_BATTERY 0x002e -#define HUB_CHANGE_CONTROLLER 0x002f -#define HUB_TERMINATE_CHARGE 0x0040 -#define HUB_TERMINATE_DISCHARGE 0x0041 -#define HUB_BELOW_REM_CAP_LIM 0x0042 -#define HUB_REM_TIME_LIM_EXP 0x0043 -#define HUB_CHARGING 0x0044 -#define HUB_DISCHARGING 0x0045 -#define HUB_FULLY_CHARGED 0x0046 -#define HUB_FULLY_DISCHARGED 0x0047 -#define HUB_CONDITIONING_FLAG 0x0048 -#define HUB_ATRATE_OK 0x0049 -#define HUB_SMB_ERROR_CODE 0x004a -#define HUB_NEED_REPLACEMENT 0x004b -#define HUB_ATRATE_TIMETOFULL 0x0060 -#define HUB_ATRATE_TIMETOEMPTY 0x0061 -#define HUB_AVERAGE_CURRENT 0x0062 -#define HUB_MAXERROR 0x0063 -#define HUB_REL_STATEOF_CHARGE 0x0064 -#define HUB_ABS_STATEOF_CHARGE 0x0065 -#define HUB_REM_CAPACITY 0x0066 -#define HUB_FULLCHARGE_CAPACITY 0x0067 -#define HUB_RUNTIMETO_EMPTY 0x0068 -#define HUB_AVERAGETIMETO_EMPTY 0x0069 -#define HUB_AVERAGETIMETO_FULL 0x006a -#define HUB_CYCLECOUNT 0x006b -#define HUB_BATTPACKMODEL_LEVEL 0x0080 -#define HUB_INTERNAL_CHARGE_CTL 0x0081 -#define HUB_PRIMARY_BATTERY_SUP 0x0082 -#define HUB_DESIGN_CAPACITY 0x0083 -#define HUB_SPECIFICATION_INFO 0x0084 -#define HUB_MANUFACTURER_DATE 0x0085 -#define HUB_SERIAL_NUMBER 0x0086 -#define HUB_IMANUFACTURERNAME 0x0087 -#define HUB_IDEVICENAME 0x0088 -#define HUB_IDEVICECHEMISTERY 0x0089 -#define HUB_MANUFACTURERDATA 0x008a -#define HUB_RECHARGABLE 0x008b -#define HUB_WARN_CAPACITY_LIM 0x008c -#define HUB_CAPACITY_GRANUL1 0x008d -#define HUB_CAPACITY_GRANUL2 0x008e -#define HUB_IOEM_INFORMATION 0x008f -#define HUB_INHIBIT_CHARGE 0x00c0 -#define HUB_ENABLE_POLLING 0x00c1 -#define HUB_RESTORE_TO_ZERO 0x00c2 -#define HUB_AC_PRESENT 0x00d0 -#define HUB_BATTERY_PRESENT 0x00d1 -#define HUB_POWER_FAIL 0x00d2 -#define HUB_ALARM_INHIBITED 0x00d3 -#define HUB_THERMISTOR_UNDRANGE 0x00d4 -#define HUB_THERMISTOR_HOT 0x00d5 -#define HUB_THERMISTOR_COLD 0x00d6 -#define HUB_THERMISTOR_OVERANGE 0x00d7 -#define HUB_BS_VOLT_OUTOF_RANGE 0x00d8 -#define HUB_BS_CURR_OUTOF_RANGE 0x00d9 -#define HUB_BS_CURR_NOT_REGULTD 0x00da -#define HUB_BS_VOLT_NOT_REGULTD 0x00db -#define HUB_MASTER_MODE 0x00dc -#define HUB_CHARGER_SELECTR_SUP 0x00f0 -#define HUB_CHARGER_SPEC 0x00f1 -#define HUB_LEVEL2 0x00f2 -#define HUB_LEVEL3 0x00f3 - -/* Usages, generic desktop */ -#define HUG_POINTER 0x0001 -#define HUG_MOUSE 0x0002 -#define HUG_FN_KEY 0x0003 -#define HUG_JOYSTICK 0x0004 -#define HUG_GAME_PAD 0x0005 -#define HUG_KEYBOARD 0x0006 -#define HUG_KEYPAD 0x0007 -#define HUG_X 0x0030 -#define HUG_Y 0x0031 -#define HUG_Z 0x0032 -#define HUG_RX 0x0033 -#define HUG_RY 0x0034 -#define HUG_RZ 0x0035 -#define HUG_SLIDER 0x0036 -#define HUG_DIAL 0x0037 -#define HUG_WHEEL 0x0038 -#define HUG_HAT_SWITCH 0x0039 -#define HUG_COUNTED_BUFFER 0x003a -#define HUG_BYTE_COUNT 0x003b -#define HUG_MOTION_WAKEUP 0x003c -#define HUG_VX 0x0040 -#define HUG_VY 0x0041 -#define HUG_VZ 0x0042 -#define HUG_VBRX 0x0043 -#define HUG_VBRY 0x0044 -#define HUG_VBRZ 0x0045 -#define HUG_VNO 0x0046 -#define HUG_TWHEEL 0x0048 -#define HUG_SYSTEM_CONTROL 0x0080 -#define HUG_SYSTEM_POWER_DOWN 0x0081 -#define HUG_SYSTEM_SLEEP 0x0082 -#define HUG_SYSTEM_WAKEUP 0x0083 -#define HUG_SYSTEM_CONTEXT_MENU 0x0084 -#define HUG_SYSTEM_MAIN_MENU 0x0085 -#define HUG_SYSTEM_APP_MENU 0x0086 -#define HUG_SYSTEM_MENU_HELP 0x0087 -#define HUG_SYSTEM_MENU_EXIT 0x0088 -#define HUG_SYSTEM_MENU_SELECT 0x0089 -#define HUG_SYSTEM_MENU_RIGHT 0x008a -#define HUG_SYSTEM_MENU_LEFT 0x008b -#define HUG_SYSTEM_MENU_UP 0x008c -#define HUG_SYSTEM_MENU_DOWN 0x008d - -/* Usages, Digitizers */ -#define HUD_UNDEFINED 0x0000 -#define HUD_DIGITIZER 0x0001 -#define HUD_PEN 0x0002 -#define HUD_TOUCHSCREEN 0x0004 -#define HUD_TIP_PRESSURE 0x0030 -#define HUD_BARREL_PRESSURE 0x0031 -#define HUD_IN_RANGE 0x0032 -#define HUD_TOUCH 0x0033 -#define HUD_UNTOUCH 0x0034 -#define HUD_TAP 0x0035 -#define HUD_QUALITY 0x0036 -#define HUD_DATA_VALID 0x0037 -#define HUD_TRANSDUCER_INDEX 0x0038 -#define HUD_TABLET_FKEYS 0x0039 -#define HUD_PROGRAM_CHANGE_KEYS 0x003a -#define HUD_BATTERY_STRENGTH 0x003b -#define HUD_INVERT 0x003c -#define HUD_X_TILT 0x003d -#define HUD_Y_TILT 0x003e -#define HUD_AZIMUTH 0x003f -#define HUD_ALTITUDE 0x0040 -#define HUD_TWIST 0x0041 -#define HUD_TIP_SWITCH 0x0042 -#define HUD_SEC_TIP_SWITCH 0x0043 -#define HUD_BARREL_SWITCH 0x0044 -#define HUD_ERASER 0x0045 -#define HUD_TABLET_PICK 0x0046 - -/* Usages, LED */ -#define HUL_NUM_LOCK 0x0001 -#define HUL_CAPS_LOCK 0x0002 -#define HUL_SCROLL_LOCK 0x0003 -#define HUL_COMPOSE 0x0004 -#define HUL_KANA 0x0005 - -/* Usages, Consumer */ -#define HUC_AC_PAN 0x0238 - -#define HID_USAGE2(p, u) (((p) << 16) | u) -#define HID_GET_USAGE(u) ((u) & 0xffff) -#define HID_GET_USAGE_PAGE(u) (((u) >> 16) & 0xffff) - -#define UHID_INPUT_REPORT 0x01 -#define UHID_OUTPUT_REPORT 0x02 -#define UHID_FEATURE_REPORT 0x03 - -#define HCOLL_PHYSICAL 0 -#define HCOLL_APPLICATION 1 -#define HCOLL_LOGICAL 2 - -/* Bits in the input/output/feature items */ -#define HIO_CONST 0x001 -#define HIO_VARIABLE 0x002 -#define HIO_RELATIVE 0x004 -#define HIO_WRAP 0x008 -#define HIO_NONLINEAR 0x010 -#define HIO_NOPREF 0x020 -#define HIO_NULLSTATE 0x040 -#define HIO_VOLATILE 0x080 -#define HIO_BUFBYTES 0x100 - -/* Valid values for the country codes */ -#define HCC_UNDEFINED 0x00 -#define HCC_MAX 0x23 - #endif /* _USBHID_H_ */ diff --git a/sys/dev/usb/uslhcom.c b/sys/dev/usb/uslhcom.c index fc559510e8f..1d8df4f624a 100644 --- a/sys/dev/usb/uslhcom.c +++ b/sys/dev/usb/uslhcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uslhcom.c,v 1.2 2015/01/22 14:33:01 krw Exp $ */ +/* $OpenBSD: uslhcom.c,v 1.3 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2015 SASANO Takayoshi <uaa@openbsd.org> @@ -33,13 +33,14 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdevs.h> -#include <dev/usb/hid.h> #include <dev/usb/usbhid.h> #include <dev/usb/uhidev.h> #include <dev/usb/ucomvar.h> #include <dev/usb/uslhcomreg.h> +#include <dev/hid/hid.h> + #ifdef USLHCOM_DEBUG #define DPRINTF(x) if (uslhcomdebug) printf x #else diff --git a/sys/dev/usb/uthum.c b/sys/dev/usb/uthum.c index 1cedef76b35..f70294d7d74 100644 --- a/sys/dev/usb/uthum.c +++ b/sys/dev/usb/uthum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthum.c,v 1.28 2014/12/11 18:39:27 mpi Exp $ */ +/* $OpenBSD: uthum.c,v 1.29 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2009, 2010 Yojiro UO <yuo@nui.org> @@ -32,7 +32,8 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> #ifdef UTHUM_DEBUG #define DPRINTF(x) do { printf x; } while (0) diff --git a/sys/dev/usb/uticom.c b/sys/dev/usb/uticom.c index b0858bbaf30..280176392c8 100644 --- a/sys/dev/usb/uticom.c +++ b/sys/dev/usb/uticom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uticom.c,v 1.28 2015/12/11 16:07:02 mpi Exp $ */ +/* $OpenBSD: uticom.c,v 1.29 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2005 Dmitry Komissaroff <dxi@mail.ru>. * @@ -35,7 +35,6 @@ #include <machine/bus.h> #include <dev/usb/usb.h> - #include <dev/usb/usbdi.h> #include <dev/usb/usbdivar.h> #include <dev/usb/usbdi_util.h> diff --git a/sys/dev/usb/utrh.c b/sys/dev/usb/utrh.c index 9c1c79b5450..21b57c16052 100644 --- a/sys/dev/usb/utrh.c +++ b/sys/dev/usb/utrh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utrh.c,v 1.17 2014/12/11 18:39:28 mpi Exp $ */ +/* $OpenBSD: utrh.c,v 1.18 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2009 Yojiro UO <yuo@nui.org> @@ -32,7 +32,8 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> #ifdef UTRH_DEBUG #define DPRINTF(x) do { printf x; } while (0) diff --git a/sys/dev/usb/utwitch.c b/sys/dev/usb/utwitch.c index b3a60ca9633..9543925a8f0 100644 --- a/sys/dev/usb/utwitch.c +++ b/sys/dev/usb/utwitch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utwitch.c,v 1.14 2014/12/11 18:39:28 mpi Exp $ */ +/* $OpenBSD: utwitch.c,v 1.15 2016/01/08 15:54:14 jcs Exp $ */ /* * Copyright (c) 2010 Yojiro UO <yuo@nui.org> @@ -33,7 +33,8 @@ #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdevs.h> #include <dev/usb/uhidev.h> -#include <dev/usb/hid.h> + +#include <dev/hid/hid.h> #define CMD_NONE 0xf0 #define CMD_EOF 0x0d |