git: 32854484accc - stable/13 - hid: Add hid_ioctl method to HID interface
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Dec 2022 08:37:02 UTC
The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=32854484accc6d93439b1ca4c7eee68d9375c318 commit 32854484accc6d93439b1ca4c7eee68d9375c318 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2022-12-24 08:33:26 +0000 hid: Add hid_ioctl method to HID interface hid_ioctl method executes arbitrary transport backend command. Format of the command is defined by hardware transport driver. It is intended to assist HID device drivers to execute non-HID commands on hybrid devices like Elan and Apple touchpads which can be switched between HID and proprietary modes. (cherry picked from commit 5f47c5a3a35de67546ce74cb01d45e62d414a179) --- sys/dev/hid/hid.c | 6 ++++++ sys/dev/hid/hid.h | 1 + sys/dev/hid/hid_if.m | 10 ++++++++++ sys/dev/hid/hidbus.c | 1 + 4 files changed, 18 insertions(+) diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index f201182ac20f..bd5fc79ff0d9 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -1077,4 +1077,10 @@ hid_set_protocol(device_t dev, uint16_t protocol) return (HID_SET_PROTOCOL(device_get_parent(dev), protocol)); } +int +hid_ioctl(device_t dev, unsigned long cmd, uintptr_t data) +{ + return (HID_IOCTL(device_get_parent(dev), cmd, data)); +} + MODULE_VERSION(hid, 1); diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index f0311bae689c..df822fcddffb 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -344,5 +344,6 @@ int hid_get_report(device_t, void *, hid_size_t, hid_size_t *, uint8_t, int hid_set_report(device_t, const void *, hid_size_t, uint8_t, uint8_t); int hid_set_idle(device_t, uint16_t, uint8_t); int hid_set_protocol(device_t, uint16_t); +int hid_ioctl(device_t, unsigned long, uintptr_t); #endif /* _KERNEL || _STANDALONE */ #endif /* _HID_HID_H_ */ diff --git a/sys/dev/hid/hid_if.m b/sys/dev/hid/hid_if.m index 1b9610404c01..38a053b8744e 100644 --- a/sys/dev/hid/hid_if.m +++ b/sys/dev/hid/hid_if.m @@ -164,3 +164,13 @@ METHOD int set_protocol { device_t dev; uint16_t protocol; }; + +# +# Executes arbitrary transport backend command. +# Format of command is defined by hardware transport driver. +# +METHOD int ioctl { + device_t dev; + unsigned long cmd; + uintptr_t data; +}; diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 8ae7ff4fec9c..9ff00fece820 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -912,6 +912,7 @@ static device_method_t hidbus_methods[] = { DEVMETHOD(hid_set_report, hid_set_report), DEVMETHOD(hid_set_idle, hid_set_idle), DEVMETHOD(hid_set_protocol, hid_set_protocol), + DEVMETHOD(hid_ioctl, hid_ioctl), DEVMETHOD_END };