Page MenuHomeFreeBSD

hid: Create hardware abstraction and hidbus
ClosedPublic

Authored by wulf on Jan 2 2021, 11:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 8, 7:27 PM
Unknown Object (File)
Sun, Nov 24, 11:41 PM
Unknown Object (File)
Nov 10 2024, 7:59 PM
Unknown Object (File)
Oct 26 2024, 7:31 AM
Unknown Object (File)
Oct 26 2024, 7:30 AM
Unknown Object (File)
Oct 26 2024, 7:30 AM
Unknown Object (File)
Oct 26 2024, 7:30 AM
Unknown Object (File)
Oct 23 2024, 9:00 PM
Subscribers
None

Details

Summary

This is a core part of all proposed HID changes.

It introduces layered model and it`'s interfaces.
In the new HID world drivers are stcked in following order:

Front drivers (mouse, kbd, e.t.c.)
hidbus
Transport backend (usbhid, iichid, ...?)
Transport bus (usbus, iicbus, ...?)

hidbus(4) itself provides support for multiple front HID driver attachments
to single HID transport backend. This ability existed in Net/OpenBSD
(uhidev and ihidev drivers) but has never been ported to FreeBSD.
Unlike Net/OpenBSD we do not use report number alone to
distinct report source but we follow MS way and use a top level
collection (TLC) usage index that report belongs to as a location key.

The driver performs child device autodiscovery based on HID report
descriptor data, proxying of HID requests from child devices to parent
transport backends and broadcasting of interrupts in backward direction.

Also this changes create an abstract HID interface that provides hardware independent
access to HID capabilities and functions through the device tree.

hid_if.m resembles existing USBHID KPI and consist of next methods:

HID method              USBHID variant
------------------------------------------------------
hid_intr_setup          usbd_transfer_setup   (INTERRUPT IN xfer)
hid_intr_unsetup        usbd_transfer_unsetup (INTERRUPT IN xfer)
hid_intr_start          usbd_transfer_start   (INTERRUPT IN xfer)
hid_intr_stop           usbd_transfer_stop    (INTERRUPT IN xfer)
hid_intr_poll           usbd_transfer_poll    (INTERRUPT IN xfer)

hid_get_rdesc           usbd_req_get_report_descriptor
hid_read                No direct analog. Not intended for common use.
hid_write               uhid(4) write()
hid_get_report          usbd_req_get_report
hid_set_report          usbd_req_set_report
hid_set_idle            usbd_req_set_idle
hid_set_protocol        usbd_req_set_protocol

The revision is subset of https://reviews.freebsd.org/D27777

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Jan 2 2021, 11:50 AM
wulf created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.Jan 7 2021, 11:22 PM
Closed by commit rG2b4464b0b114: hid: Import hidbus(4) (authored by wulf). · Explain Why
This revision was automatically updated to reflect the committed changes.