Page MenuHomeFreeBSD

hid/hsctrl: Add support for Wireless Radio Button
AcceptedPublic

Authored by git_danielschaefer.me on Sun, Mar 22, 10:22 AM.

Details

Summary

Implemented for example on Framework Laptops as the Airplane Mode button.

Sponsored by: Framework Computer Inc

Test Plan

build tested and manual tested on top of stable/15

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

i confirm I saw this work on his machine

0mp accepted this revision.EditedSun, Mar 22, 10:23 AM

I saw it being built and manually tested.

This revision is now accepted and ready to land.Sun, Mar 22, 10:23 AM

Can confirm this works on my machine too! Although sometimes when I press the button fast enough, it doesn't register. It always does when I hold it down for more than a fraction of a second though. Assuming this will be fixed once we're able to pass GPIO interrupts to iichid.

for reference: https://www.usb.org/sites/default/files/hutrr40radiohidusagesfinal_0.pdf

btw, only tangentially related, but see D55265 for a bit of discussion on what a generic rfkill interface would look like on freebsd

sys/dev/hid/hid.h
108–109

not a big deal but I think it would be clearer if this was named RFKILL control/button instead of generic "radio control"

sys/dev/hid/hsctrl.c
78–84

nit but I feel like this comment would make more sense above the

		evdev_push_key(evdev, KEY_RFKILL, 1);
		evdev_push_key(evdev, KEY_RFKILL, 0);
100

assuming this is being done so that we don't send rfkill up/down twice if we somehow got 1 twice in a row?

sys/dev/hid/hid.h
108–109

But this is what they're called in the HUT spec you linked above

sys/dev/hid/hsctrl.c
100

Yep

This comment was removed by wulf.

Radio button can not be correctly handled with hidmap. MS does strange things here assuming every event in report as a keypress. E.g. ASUS TUF always reported radio key as depressed that brokes Linux but works on Windows

Radio button can not be correctly handled with hidmap. MS does strange things here assuming every event in report as a keypress. E.g. ASUS TUF always reported radio key as depressed that brokes Linux but works on Windows

this revision does exactly what i think you're describing. Would you have liked it to be done some way else?

sys/dev/hid/hid.h
108–109

well actually it calls it "wireless radio". but I'm fine with how it is now