I use Ubuntu 22.04 and a Model 100. Recently I decided to switch layouts from Qwerty to Colmak-dh and reprogrammed the Model 100 to do so. I’m happy with it, so I decided to dust off my Atreus (which I’ve not really every used) and see if switching that to Colmak-dh might make it more useful for my laptop.
I got the Atreus off its display stand, plugged it in, and nothing; no keyboard, no keys worked, and it wasn’t seen by Chrysalis. I thought maybe it was bricked. I unplugged it, checked the USB port, cleaned the connector, plugged it back in, and still nothing.
As I initially thought it was bricked in some way, I did the obvious; I searched for other people having problems. Nothing quite matched, and I did git clone of the keyboardio/kaleidoscope repository, installed it, and then did VERBOSE=1 make flash
; sure enough, it didn’t work either`:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/alex/Projects/software-sources/Kaleidoscope/.arduino/data/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/alex/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
Using Programmer : avr109
Overriding Baud Rate : 57600
avrdude: ser_open(): can't open device "/dev/ttyACM0": No such file or directory
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
make: *** [/home/alex/Projects/software-sources/Kaleidoscope/etc/makefiles/sketch.mk:212: flash] Error 1
So the keyboard definitely isn’t there, right? It’s a USB keyboard, so let’s see if it turns up:
$ lsusb
...
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 067: ID 1209:2303 Generic Atreus
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Ah, there it is! The Generic Atreus
. The keyboard, or at least controller, from a USB perspective is definitely connecting. Why no keyboard though? I remember that there are some udev rules that need setting up for the keyboard (from /etc/udev/rules.d/
):
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2302", SYMLINK+="Atreus2", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_CANDIDATE}="0", TAG+="uaccess", TAG+="seat"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2303", SYMLINK+="Atreus2", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_CANDIDATE}="0", TAG+="uaccess", TAG+="seat"
It has two usb ids: 1209:2302
and 1209:2303
. Further googling reveals one is the HID keyboard, and the other is used when flashing it. So why aren’t they showing up? Debugging and searching further led me to dmesg
which contained this little sequence when the keyboard is flashed or plugged in (this is after trying to flash it):
[150127.299632] usb 1-5.3: USB disconnect, device number 17
[150134.705404] usb 1-5.3: new full-speed USB device number 18 using xhci_hcd
[150134.836957] usb 1-5.3: New USB device found, idVendor=1209, idProduct=2302, bcdDevice= 0.01
[150134.836962] usb 1-5.3: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[150134.836965] usb 1-5.3: Product: Atreus Bootloader
[150134.836966] usb 1-5.3: Manufacturer: Keyboardio
[150134.836967] usb 1-5.3: SerialNumber: atreus
[150134.837106] usb 1-5.3: Device is not authorized for usage
[150141.443763] audit: type=1400 audit(1706198289.131:3580): apparmor="DENIED" operation="open" profile="snap.firefox.firefox" name="/etc/fstab" pid=18366 comm="firefox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[150163.139258] usb 1-5.3: USB disconnect, device number 18
[150163.381044] usb 1-5.3: new full-speed USB device number 19 using xhci_hcd
[150163.515778] usb 1-5.3: New USB device found, idVendor=1209, idProduct=2303, bcdDevice= 1.00
[150163.515784] usb 1-5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[150163.515786] usb 1-5.3: Product: Atreus
[150163.515787] usb 1-5.3: Manufacturer: Keyboardio
[150163.515789] usb 1-5.3: SerialNumber: CatreusE
[150163.515925] usb 1-5.3: Device is not authorized for usage
So the Device is not authorized for usage
piqued my interest. Further searching brought me to a project/service I’d never heard about: usbguard.
It turns out that Ubuntu 22.04 uses usbguard to prevent ‘evil’ usb devices from being connected, and sadly the Atreus isn’t on the good list (or something). Further searching led me to adding:
allow id 1209:2303
allow id 1209:2302
to the end of /etc/usbguard/rules.conf
and restarting the usbguard (systemctl restart usbguard
). Note these two rules allow any device that reports those ids to connect, so we’ll lock it down after it’s flashed.
I also needed to be a member of the dialout
user for the serial port:
sudo usermod -a -G dialout $USER
newgrp dialout # or logout/login
And then make flash
suceeded, and I could then use Chrysalis to program the hardware.
Anyway, I hope this is useful to someone!
Locking down usbguard after flashing. Using usbguard generate-policy
after flashing doesn’t show the 1209:2302
device to lock it down further:
$ usbguard generate-policy | grep 1209
allow id 1209:2303 serial "CDatreus" name "Atreus" hash "ntPeKEzZnVOrOewAZvEwTjfxKK2SVzaRtqZIgEZEC3I=" parent-hash "3KSPgQf20a6YpqSwBYIHuIV18vOU31hvCeP+nC3p/TA=" with-interface { 02:02:00 0a:00:00 03:01:01 03:00:00 03:00:00 } with-connect-type "hotplug"
The above rule can replace the allow id 1209:2303
with the above line, removing the with-interface
and parent-hash
, locks it to my keyboard, I’d have to capture the policy when the Atreus is being flashed to capture the 1209:2302
id to get the hash of that device - I don’t know if they are different. I’ll may do some more investigations and add the results here.