Skip to content

Instantly share code, notes, and snippets.

@mz0
Last active October 28, 2017 21:42
Show Gist options
  • Save mz0/1df72d2bb4952cd37da04969a5665850 to your computer and use it in GitHub Desktop.
Save mz0/1df72d2bb4952cd37da04969a5665850 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Class 03h - HID
# Subclass 00h - None, 01h - Boot Interface
# Protocol 00h - None, 01h - Keyboard, 02h - Mouse
HID11='3/1/1'
HID00='3/0/0'
/usr/bin/echo "removal $1 $2" >> /tmp/device-remove.env
/usr/bin/echo "$INTERFACE" >> /tmp/device-remove.env
if [ $INTERFACE = $HID11 ] ; then
/usr/bin/touch /tmp/keyboard-3.1.1-gone
elif [ $INTERFACE = $HID00 ] ; then
/usr/bin/touch /tmp/keyboard-3.0.0-gone
fi
@mz0
Copy link
Author

mz0 commented Jun 30, 2016

update I can use previously "incompatible" keyboards with current El Capitan 10.11.6 (15G1611) and High Sierra 10.13. I'm curios when Apple fixed this issue and let all keyboards work with Macs?

.

MacOS X compatible USB keyboard and the Eudyptula challenge

Some time ago I've got a need for Mac Mini and for a keyboard to manage it. My favorite keyboard at that moment (Mitsumi Classic KFK-EA4XY) could not pass "Keyboard Setup Assistant" (keyboard cannot be identified and will not be usable...) The cheapest so advertised "Mac-compatible" keyboard turned Microsoft Wired Keyboard 600 which was not a bad piece of Chinese plastic but with degraded F1-F12 keys, arbitrary extra keys and a tad pricey one. Anyway i was left puzzled by that Mac-compatibility magic.

Fast-forward a year or so -- i've decided to put that Mac Mini to work again and hooked a random keyboard (BTC 6411) to it. To my total surprise it worked Ok. But sheer luck i knew at that moment a small difference between those BTC and Mitsumi keyboards: Mitsumi has a phantom device (or maybe "endpoint") 3/0/0 (Class/Subclass/Protocol) besides a real device 3/1/1 (Class 3 - HID, Subclass 1 - Boot Interface, Protocol 1 - Keyboard). BTC 6411 has only real 3/1/1.

As part of Eudyptula challenge i've examined a number of USB keyboards and udev events generated at their insertion and removal. A udev rule
SUBSYSTEM=="usb", ACTION=="remove", RUN+="/usr/local/sbin/usbdevgone.sh $devpath $env{INTERFACE}"
and a dump script above allow me see USB "remove" events.

With that udev helper I've found another keyboard models without useless 3/0/0 "endpoint":

  • Logitech Deluxe 250
  • Microsoft Wired 200
  • Logitech K270 Wireless (unifying receiver, you may hook e.g. Logitech M175 mouse to that too).

Tested in Mac OS X 10.8.5 - 10.11.5

First published 2014-06-13 in zhmark.livejournal.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment