On 18/03/2019 15:44, Jiri Kosina wrote: > On Sat, 9 Mar 2019, Andrej Shadura wrote: > >> U2F Zero supports custom commands for blinking the LED and getting data >> from the internal hardware RNG. Expose the blinking function as a LED >> device, and the internal hardware RNG as an HWRNG so that it can be used >> to feed the enthropy pool. >> >> Signed-off-by: Andrej Shadura <andrew.shadura@xxxxxxxxxxxxxxx> >> --- >> >> This version of the patch sets the quality to 1. >> >> --- >> drivers/hid/Kconfig | 15 ++ >> drivers/hid/Makefile | 1 + >> drivers/hid/hid-ids.h | 1 + >> drivers/hid/hid-u2fzero.c | 371 ++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 388 insertions(+) >> create mode 100644 drivers/hid/hid-u2fzero.c >> >> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig >> index 41e9935fc584..4f1b8939561d 100644 >> --- a/drivers/hid/Kconfig >> +++ b/drivers/hid/Kconfig >> @@ -989,6 +989,21 @@ config HID_UDRAW_PS3 >> Say Y here if you want to use the THQ uDraw gaming tablet for >> the PS3. >> >> +config HID_U2FZERO >> + tristate "U2F Zero LED and RNG support" >> + depends on HID >> + depends on LEDS_CLASS >> + help >> + Support for the LED of the U2F Zero device. >> + >> + U2F Zero supports custom commands for blinking the LED >> + and getting data from the internal hardware RNG. >> + The internal hardware can be used to feed the enthropy pool. >> + >> + U2F Zero only supports blinking its LED, so this driver doesn't >> + allow setting the brightness to anything but 1, which will >> + trigger a single blink and immediately reset to back 0. >> + > > This driver isn't really a generic (transport-agnostic) one (which also > means it's missing USB dependency in Kconfig btw). Thanks, I forgot that one. > Is there a reason why it can't be abstracted that way so that it'd fit our > principal model in HID subsystem? I tried and I failed. The HID subsystem doesn’t provide the functionality necessary to implement the protocol, or maybe I’m missing something, but I haven’t found a way. > Also, I've looked at it really briefly, but can't it be easily implemented > in userspace? Well, it could, but I would like this to work out of the box without a need of extra userspace code (the RNG mainly, the LED support was just an additional "why not" thing). -- Cheers, Andrej