appleir: Add Apple IR receiver driver

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):
- Format: [0x26][0x7f][0x80][code][~code]
- Checksum: code + ~code = 0xFF
- Default keymap with 8 common codes
- See: https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+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).

Differential Revision:	https://reviews.freebsd.org/D55472
This commit is contained in:
Abdelkader Boudih
2026-04-13 19:29:43 -07:00
committed by Enji Cooper
parent 2d13620c6e
commit a85c4ab626
6 changed files with 544 additions and 0 deletions
+1
View File
@@ -44,6 +44,7 @@ MAN= aac.4 \
alc.4 \
ale.4 \
alpm.4 \
appleir.4 \
altq.4 \
amdpm.4 \
${_amdsbwd.4} \
+93
View File
@@ -0,0 +1,93 @@
.\" Copyright (c) 2026 Abdelkader Boudih <freebsd@seuros.com>
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd February 13, 2026
.Dt APPLEIR 4
.Os
.Sh NAME
.Nm appleir
.Nd Apple IR receiver driver
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following lines in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device appleir"
.Cd "device hidbus"
.Cd "device hid"
.Cd "device evdev"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 Ns :
.Bd -literal -offset indent
appleir_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for Apple IR receivers found in Mac computers
(2006-2011 era).
It supports both Apple Remote controls and generic IR remotes using the
NEC infrared protocol.
.Pp
Supported devices include:
.Bl -bullet -compact
.It
Apple IR Receiver (USB product IDs 0x8240, 0x8241, 0x8242, 0x8243, 0x1440)
.El
.Pp
The driver decodes proprietary Apple Remote button presses and provides
a default keymap for common NEC protocol codes used by generic IR remotes.
Unmapped button codes can be accessed via the raw HID device at
.Pa /dev/hidrawX
for custom userland remapping.
.Pp
The
.Pa /dev/input/eventX
device presents the remote control as an
evdev
input device with standard KEY_* codes suitable for media applications.
.Sh HARDWARE
The
.Nm
driver supports Apple IR receivers with USB vendor ID 0x05ac and the
following product IDs:
.Pp
.Bl -tag -width "0x8242" -compact
.It 0x8240
Apple IR Receiver (first generation)
.It 0x8241
Apple IR Receiver
.It 0x8242
Apple IR Receiver (Mac Mini 2011, MacBook Pro 3,1)
.It 0x8243
Apple IR Receiver
.It 0x1440
Apple IR Receiver (slim)
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/input/eventX" -compact
.It Pa /dev/input/eventX
evdev input device
.It Pa /dev/hidrawX
raw HID device for custom button mapping
.El
.Sh SEE ALSO
evdev ,
.Xr hidbus 4 ,
.Xr usbhid 4
.Pp
NEC Infrared Transmission Protocol:
.Lk https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol
.Sh HISTORY
The
.Nm
driver first appeared in
.Fx 16.0 .
.Sh AUTHORS
.An Abdelkader Boudih Aq Mt freebsd@seuros.com
.Pp
Based on protocol reverse-engineering by James McKenzie and others.