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.

MFC after:	2 month
This commit is contained in:
Vladimir Kondratyev 2022-03-03 02:35:23 +03:00
parent 166f2cb40d
commit 5f47c5a3a3
4 changed files with 18 additions and 0 deletions

View File

@ -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);

View File

@ -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_ */

View File

@ -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;
};

View File

@ -911,6 +911,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
};