Page MenuHomeFreeBSD

appleir: Add Apple IR receiver driver
Needs ReviewPublic

Authored by guest-seuros on Mon, Feb 23, 10:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 26, 2:28 AM
Unknown Object (File)
Wed, Feb 25, 8:27 PM
Unknown Object (File)
Wed, Feb 25, 7:16 PM
Unknown Object (File)
Wed, Feb 25, 9:19 AM
Unknown Object (File)
Wed, Feb 25, 5:52 AM
Unknown Object (File)
Wed, Feb 25, 5:23 AM
Unknown Object (File)
Wed, Feb 25, 3:23 AM
Unknown Object (File)
Wed, Feb 25, 12:30 AM
Subscribers

Details

Reviewers
obiwac
Summary

HID driver for Apple IR receivers (USB HID, vendor 0x05ac).
Supports Apple Remote and generic IR remotes using NEC protocol.

Supported hardware:

  • Apple IR Receiver (0x8240, 0x8241, 0x8242, 0x8243, 0x1440)

Apple Remote protocol (proprietary 5-byte HID reports):

  • Key down/repeat/battery-low detection
  • 17-key mapping with two-packet command support
  • Synthesized key-up via 125ms callout timer

Generic IR remotes (NEC protocol):

Output via evdev with standard KEY_* codes.
Raw HID access available at /dev/hidraw0 for custom remapping.

Based on protocol reverse-engineering by James McKenzie et al.
Reference: drivers/hid/hid-appleir.c (Linux)

Tested on Mac Mini 2011 (0x05ac:0x8242).

Test Plan

This driver works with both NEC protocol and apple remotes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70938
Build 67821: arc lint + arc unit

Event Timeline

Remove debug DPRINTFN calls and verbose NEC code comments

This driver was supposed to be a port form Linux Apple IR driver.

However, during development I discovered that the remote available for testing was not a genuine Apple remote but a generic NEC-compatible device with a apple logo on it.

As a result, the implementation was extended to support both the Apple protocol and generic NEC protocol devices. FreeBSD now supports both. (i tested it the the genuine remote)

haven't done a hugely in-depth review yet. Overall looks pretty good!

general question though: is this driver not applicable to other IR receivers? in which case maybe a different name would be better. I mean if other generic NEC remotes exist with a different format to the Apple one, presumably that would imply there are other IR receivers which pass on the same reports.

sys/dev/hid/appleir.c
6–8

you are duplicating this comment later on, so no need to have it here in the license header

139

please add space between ; and /*

157–166

I don't know if I love this way of doing things. Perhaps this function should simply return (data >> 1) & KEY_MASK and then you track if a second report is expected separately?

212

are you sure about this? do you have an example battery low report which contains valid/sensible subsequent remote_id and key_code values?