Commit graph

55 commits

Author SHA1 Message Date
Vladimir Kondratyev
4430a5d185 bcm5974: wsp(4) driver version with HID attachment.
(cherry picked from commit 5aa839c9e2)
2022-12-24 11:33:26 +03:00
Vladimir Kondratyev
f692b2cff8 ietp(4): Driver for Elantech I2C touchpad
(cherry picked from commit d5add41d4d)
2022-12-24 11:33:26 +03:00
Vladimir Kondratyev
ebe585ee54 hms(4): Change probe priority to BUS_PROBE_GENERIC
to give ietp(4) and bcm5974(4) drivers precedence over hms(4).

(cherry picked from commit 42e2a173c7)
2022-12-24 11:17:47 +03:00
Warner Losh
d4706e1fdf hpen_battery_strenght_cb: eliminate write only data variable
Sponsored by:		Netflix

(cherry picked from commit 92ec9782ac)
2022-10-01 22:25:52 -06:00
Hans Petter Selasky
2817d3ac2a hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop().
No functional change intended.

Discussed with:	wulf @
Sponsored by:	NVIDIA Networking

(cherry picked from commit c019a1690b)
2022-08-04 15:17:56 +02:00
Gordon Bergling
80fc35f72c usb(3): Fix a few typos in source code comments
- s/paniced/panicked/

(cherry picked from commit 9094c3a71b)
2022-04-09 08:08:15 +02:00
Mateusz Guzik
6004dc8bc3 hpen(4): removed leftover hpen_final_digi_cb declaration
(cherry picked from commit 007724cbca)
2021-10-07 10:00:13 -04:00
Vladimir Kondratyev
9faebc1e66 hkbd(4): Fix build on 32bit platforms
(cherry picked from commit 38d2e9314b)
2021-09-23 03:59:37 +03:00
Vladimir Kondratyev
510b003ff4 hkbd(4): Fix key repeats on multireport keyboards
Currently hkbd counts all key states to be "Up" at the start of
interrupt callback. That results in generation of "Key Up" event for
each key that has been downed before but is not listed in current
report while is still downed.

Fix that with clearing of temporary key data storage bits only for
keys contained in processed report.

Reported by:	Greg V
Obtained from:	sysutils/iichid

(cherry picked from commit 598f0580f6)
2021-09-23 03:58:58 +03:00
Vladimir Kondratyev
1dec30a65a hkbd(4): Use bitstring(3) KPI for key bitmaps processing.
No functional changes intended.

(cherry picked from commit 04918395f1)
2021-09-23 03:57:57 +03:00
Vladimir Kondratyev
7683f19cbf hkbd(4): Reduce diff with ukbd(4)
(cherry picked from commit 3ef9023f93)
2021-09-23 03:57:34 +03:00
Vladimir Kondratyev
470478ff01 hmt(4): Add support for touchpads with no "button type" or
"maximum number of contacts" usages.

Assume touchpad to be a clickpad if it has only internal button.
Set number of contacts to 5 for touchpads and to 10 for touchscreens.
Check for fetched report length to avoid reading of stalled data.
Fixes Dell Precision 7550 laptop.

Tested by:	Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
PR:		257992

(cherry picked from commit 9d04336b61)
2021-09-22 02:41:40 +03:00
Vladimir Kondratyev
d4a977ce18 hpen(4): Add support for legacy MS-compatible single touch protocol
It is used by many pre- and post- 2014 eGalax touchscreens.

Tested by:	Mark Kane <mark_AT_kane_DOT_mn>

(cherry picked from commit a36bdfc2b6)
2021-09-22 02:41:16 +03:00
Vladimir Kondratyev
29bcf5e7d7 hidbus(4): Add routine to check presence of collection of given usage
(cherry picked from commit d51e437669)
2021-09-22 02:40:53 +03:00
Vladimir Kondratyev
116adffd0f hidmap: Do not forget to initialize bitmap items to unset state
(cherry picked from commit bbed4b41c9)
2021-09-22 02:40:37 +03:00
Vladimir Kondratyev
1a918f430d hidmap: Implement forbidden flag for hidmap item.
If HID usage is mapped to evdev event by hidmap item marked with this
flag than entire driver attachment is blocked.

(cherry picked from commit cded1fdb37)
2021-09-22 02:40:18 +03:00
Vladimir Kondratyev
12061cf605 hmt(4): Add support for serial packet reporting mode
In Serial mode, each packet contains information that describes a
single physical contact point. Multiple contacts are streamed
serially. In this mode, devices report all contact information in a
series of packets. The device sends a separate packet for each
concurrent contact.

Serial packet reporting mode is used by post-2014 eGalax touchscreens.

Tested by:	Mark Kane <mark_AT_kane_DOT_mn>

(cherry picked from commit 0075742d18)
2021-09-22 02:39:58 +03:00
Vladimir Kondratyev
3956601292 hmt(4): Adapt to recent KPI changes
(cherry picked from commit 9d8ebe5ea1)
2021-09-22 02:35:58 +03:00
Vladimir Kondratyev
290677c3d6 hms(4): Allow attachment to pointer top level collection.
to be in line with Microsoft mouse driver [1]

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/top-level-collections-opened-by-windows-for-system-use

(cherry picked from commit 9b78891df1)
2021-08-24 01:22:43 +03:00
Vladimir Kondratyev
bb5eb85e5c ps4dshock(4): Fix touchpad width in HID report descriptor
(cherry picked from commit 9b2b5f42b4)
2021-08-24 01:22:13 +03:00
Greg V
2de8a0d209 hid: move proper hat switch handling from ps4dshock to hgame
Generic "DirectInput" HID gamepads need this handling too.

Reviewed by:	wulf

(cherry picked from commit 51b2216114)
2021-08-24 01:21:49 +03:00
Jack
6c8f2d24d4 hmt(4): Do not ignore constant usages in HID report descriptor parser
This fixes hmt to work with MELF0411 1FD2:7012 touchscreen

Obtained from:	sysutils/iichid

(cherry picked from commit cb910670ac)
2021-08-24 01:21:24 +03:00
Vladimir Kondratyev
a711310d2d hid: Add extra constant to units of measurement
Some devices like eGalax touchscreens use value of 0x33 instead of 0x13
for inches as unit of measure.

Reported by:	Mark Kane <mark_AT_kane_DOT_mn>

(cherry picked from commit be75951af1)
2021-08-24 01:20:30 +03:00
Vladimir Kondratyev
5517f7f9e7 hmt(4): Store Contact Count in separate variable.
No functional changes.

(cherry picked from commit 95add157e3)
2021-08-24 01:19:43 +03:00
Gordon Bergling
64085efb67 hms(4): Fix a typo in sysctl description
- s/threshhold/threshold/

(cherry picked from commit 4b4850aefe)
2021-08-15 07:56:02 +02:00
Vladimir Kondratyev
a303f4b1c1 usbhid(4): Add second set of USB transfers to work in polled mode.
The second set of USB transfer is requested by hkbd(4) and
should improve HID keyboard handling in kdb and panic contexts.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D30486

(cherry picked from commit 9aa0e5af75)
2021-06-14 00:57:37 +03:00
Vladimir Kondratyev
51b2d04369 hkbd: Fix typo which disables keyboard input in kdb
Reported by:	Greg V
2021-04-30 23:14:52 +03:00
Vladimir Kondratyev
99bc385243 hid: add opt_hid.h to modules that use HID_DEBUG
Submitted by:	Greg V <greg_AT_unrelenting_DOT_technology>
Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D28995

(cherry picked from commit 6241b57131)
2021-04-12 00:48:51 +03:00
Vladimir Kondratyev
98b3658c4e hkbd: Fix handling of keyboard ErrorRollOver reports
Ignore fantom keyboard state reports entirelly rather than ignore
RollOver states for each key separatelly.  Latter results in spurious
release/push pairs of events on each fantom keyboard state report.

Reported by:	Jan Martin Mikkelsen <janm_AT_transactionware_DOT_com>
Submitted by:	Jan Martin Mikkelsen (initial version)
PR:		253249
MFC after:	1 week

(cherry picked from commit 812c59ed61)
2021-02-24 02:41:49 +03:00
Vladimir Kondratyev
9262a9ce06 hidraw: Make HIDIOCGRDESCSIZE ioctl return report descriptor size
defined by hardware rather than cached one to match HIDIOCGRDESC ioctl.
This fixes errors reported by hid-tools being run against /dev/hidraw#
device node belonging to driver which overloads report descriptor.

MFC after:	1 week

(cherry picked from commit f988d7fa05)
2021-02-24 02:41:49 +03:00
Warner Losh
0dc5c9467b hid: bump HID_ITEM_MAXUSAGES to 8
My YOGA requires a minimum of 7 to parse w/o an error. Since the memory savings
are trivial and the yoga a popular system, bump the default up to 8. There's no
API/ABI issues in doing this. This hid_item struct isn't exported to userland
and the one libusbhid has is different and only shares a name...

MFC After: 3 days
Reviewed by: wulf@
Differential Revision: https://reviews.freebsd.org/D28543

(cherry picked from commit db2f512381)
2021-02-10 22:13:25 -07:00
Vladimir Kondratyev
5cc21ab994 hmt: Allow I2C sampling mode support to be compiled out. 2021-01-20 23:10:07 +03:00
Vladimir Kondratyev
3e954a8bc6 hms: Workaround idle mouse drift in I2C sampling mode.
Many I2C "compatibility" mouse devices found on touchpads continue to
return last report data in sampling mode after touch has been ended.
That results in cursor drift.  Filter out such a reports with comparing
content of current report with content of previous one.

Reported by:	many
Tested by:	omatsuda, gllb (github.com)
Obtained from:	sysutils/iichid
2021-01-20 23:10:07 +03:00
Vladimir Kondratyev
fa656aefe4 hconf(4): Do not fetch report before writing new usage values back.
There is a report that reading of surface/button switch feature report
causes SYN1B7D touchpad malfunction.  As specs does not require it to
be readable assume that report usages have default value on attach and
last written value during operation. Do not apply default usage values
on attachment and resume.
While here fix manpage typos and add avg@ to copyright header.

Reported by:	Jakob Alvermark <jakob_AT_alvermark_DOT_net>
Reviewed by:	avg
Differential revision:	https://reviews.freebsd.org/D28196
2021-01-20 23:10:06 +03:00
Vladimir Kondratyev
b360682ac9 hid: Add missing input enter/exit epoch pairs.
This was affecting unloading keyboard driver and kdb-related code.
2021-01-14 23:04:47 +03:00
Ryan Libby
16079c7233 hid: quiet -Wswitch
Gcc builds complained that not all switch cases are handled.  Add
default cases to appease gcc.

Reviewed by:	hselasky (previous version), wulf
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D28082
2021-01-10 21:53:15 -08:00
Vladimir Kondratyev
8ffcde2554 hid: fix extraneous SYSCTL_ADD_INT() options revealed by LINT build
Reviewed by:	hselasky (as part of D28060)
2021-01-10 22:17:20 +03:00
Vladimir Kondratyev
d97d5c0ce8 hid: Import hidmap-based drivers written by Greg V
This change includes:

hpen    - Generic / MS Windows compatible HID pen tablet driver.
hgame   - Generic game controller and joystick driver.
xb360gp - Xbox360-compatible game controller driver.

Submitted by:	Greg V <greg_unrelenting.technology>
Reviewed by:	hselasky (as part of D27993)
2021-01-08 02:18:44 +03:00
Vladimir Kondratyev
afd590d9e5 hid: Import hidmap and bunch of drivers based on it
hidmap is a kernel module that maps HID input usages to evdev events.

Following dependent drivers is included in the commit:

hms       - HID mouse driver.
hcons     - Consumer page AKA Multimedia keys driver.
hsctrl    - System Controls page (Power/Sleep keys) driver.
ps4dshock - Sony DualShock 4 gamepad driver.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27993
2021-01-08 02:18:44 +03:00
Vladimir Kondratyev
9be6b22da9 hidraw(4): Add HIDRAW_MAKE_UHID_ALIAS kernel option
which installs /dev/uhid# alias to hidraw character device for
compatibility with some existing uhid(4) users like Firefox.
As side effect it renames traditional uhid(4) driver to hidraw
to make possible using of common unit number allocator.

Requested by:	Greg V <greg_unrelenting.technology>
Reviewed by:	hselasky (as part of D27992)
2021-01-08 02:18:44 +03:00
Vladimir Kondratyev
9477390796 hid: Import hidraw(4) - driver for access to raw HID device data
This driver provides raw access to HID devices through uhid(4)-compatible
interface and is based on pre-8.x uhid(4) code. Unlike uhid(4) it does
not take devices in to monopoly ownership and allows parallel access
from other drivers.

hidraw supports Linux's hidraw-compatible interface as well.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27992
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
2775d1d5d1 hkbd(4): Split driver lock on interrupt and syscons locks
This allows to mark HID-device interrupt handlers as MP-SAFE.
Atomics-based lockless key event queue with swi_giant taskqueue is used
to pass key-press events into Giant-protected system console.

Reviewed by:	hselasky (as part of D27991)
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
b93f6bfca3 hid: Port ukbd to HID and attach to build
Reviewed by:	hselasky
Differential revision:  https://reviews.freebsd.org/D27991
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
08d8840175 hid: Copy ukbd(4) to HID subsystem. 2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
cb022db825 hid: Port multitouch hmt(4) driver to hidbus and attach to build
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27990
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
b9b347e9bf hid: Copy wmt(4) to HID subsystem as a base to upcoming hmt(4) driver. 2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
10fbbdfbbd hid: Import hconf(4) - digitizer configuration top-level collection support.
Reviewed by:	hselasky (as part of D27990)
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
01f2e864f7 hid: Import usbhid - USB transport backend for HID subsystem.
This change implements hid_if.m methods for HID-over-USB protocol [1].

Also, this change adds USBHID_ENABLED kernel option which changes
device_probe() priority and adds/removes PnP records to prefer usbhid
over ums, ukbd, wmt and other USB HID device drivers and vice-versa.

The module is based on uhid(4) driver.  It is disabled by default for
now due to conflicts with existing USB HID drivers.

[1] https://www.usb.org/sites/default/files/hid1_11.pdf

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27893
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
b1f1b07f6d hid: Import iichid - I2C transport backend for HID subsystem
This implements hid_if.m methods for HID-over-I2C protocol [1].

Following kernel options are added:

IICHID_SAMPLING - Enable support for a sampling mode as interrupt
                  resource acquisition is not always possible in a case
                  of GPIO interrupts.
IICHID_DEBUG    - Enable debug output.

The module is based on prior Marc Priggemeyer work (D16698).

[1] http://download.microsoft.com/download/7/d/d/7dd44bb7-2a7a-4505-ac1c-7227d3d96d5b/hid-over-i2c-protocol-spec-v1-0.docx

Differential revision:	https://reviews.freebsd.org/D27892
2021-01-08 02:18:43 +03:00
Vladimir Kondratyev
e49fa9f6f3 hid: Import quirk subsystem.
hidquirk(4) is derived from usb_quirk(4) and inherits all its HID-related
functionality. It does not support ioctl(2) interface yet.

Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D27890
2021-01-08 02:18:43 +03:00