OK, giving this another try. I want to experiment with the Workman Keyboard Layout and I want to use the Atreus keyboard. I noticed that the Atreus page links to the online QMK Configurator. So I decided to clone the QMK Toolbox project.
git clone https://github.com/qmk/qmk_toolbox.git apt install libgtk-3-dev make ./qmk-toolbox
As it turns out, all the drop-down menus are empty so I guess I’m not using this after all. Back to the online configurator. Did my configuring and downloaded my simple JSON file. Following the Getting Started instructions:
git clone https://github.com/qmk/qmk_firmware.git cd qmk_firmware util/qmk_install.sh
Whoops, this doesn’t work on my system so I looked it, and at `util/linux_install.sh`, and the correct invocation seems to be:
sudo apt install gcc unzip wget zip gcc-avr binutils-avr \ avr-libc dfu-programmer dfu-util gcc-arm-none-eabi \ binutils-arm-none-eabi libnewlib-arm-none-eabi make atreus:default
Then I discover that you just need to copy the `keyboards/atreus/keymaps/default/` directory and edit the `keymap.c` file directly. I guess I don’t need the JSON file after all. More time wasted.
So I copied the `default` directory to `workman` and ran `make atreus:workman:avrdude`. Soon enough it was asking me to “reset your controller now”. In my old notes I saw that it’s probably `FN+ESC RET` or `FN+ESC b`. OK, let’s try!
It turns out to be `FN+ESC b`. All right! And I get an error: `avrdude: not found`. Right. I guess that was missing in the list above? Let’s do `sudo apt install avrdude`.
Still not quite there:
Detected controller on USB port at /dev/ttyACM0 avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied avrdude done. Thank you.
OK, try again with `sudo make atreus:workman:avrdude` eventhough I don’t like it.
Detected controller on USB port at /dev/ttyACM0 Connecting to programmer: . Found programmer: Id = "CATERIN"; type = S Software Version = 1.0; No Hardware Version given. Programmer supports auto addr increment. Programmer supports buffered memory access with buffersize=128 bytes. Programmer supports the following devices: Device code: 0x44 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9587 (probably m32u4)
And then I needed to wait for quite a while... For how long should I wait? 🤔
I think I’ve been waiting for about ten minutes, now? This won’t do!
OK, @ckeen told me to try the command directly. So...
sudo su VERBOSE=1 make atreus:workman:avrdude exit
The output soon showed the command I needed:
sudo avrdude -p atmega32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:.build/atreus_workman.hex
The problem here is that the device only shows up after a slight delay when I press `FN+ESC b`. So I had to try a few times. And that work and I get to see what the problem is.
I get thousands of lines saying `failed` and then it hangs:
***failed; ***failed; ***failed; ***failed; avrdude: Error: butterfly programmer uses avr_write_page() but does not provide a cmd() method. *** page 87 (addresses 0x5358 - 0x53d7) failed to write Writing | ################################################## | 100% 0.57s avrdude: 21464 bytes of flash written avrdude: verifying flash memory against .build/atreus_workman.hex: avrdude: load data flash data from input file .build/atreus_workman.hex: avrdude: input file .build/atreus_workman.hex auto detected as Intel Hex avrdude: input file .build/atreus_workman.hex contains 21464 bytes avrdude: reading on-chip flash data: Reading | # | 2% 0.00s^C
So basically, nothing gets written and so it can’t be verified?
I cancelled this, and now the keyboard is no longer reacting. Unplug, plug back in, wait for a bit, type some keys: nothing. 😱
The output of `lsusb`:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 04ca:300d Lite-On Technology Corp. Atheros AR3012 Bluetooth Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Time to learn how to reset this little baby!
Well, I can connect the two pins on the right (number 6 with the lone number 7) and there’s a slow pulsing yellow LED that lights up. I quickly run the command:
sudo avrdude -p atmega32u4 -c avr109 -P /dev/ttyACM0 \ -U flash:w:atreus-pcbdown-qwerty.hex 2>&1 \ | tee atreus-pcbdown-qwerty.log
This uses the firmware from that old download page.
Timing is key. Sometimes sometimes I get the same error as above. Sometimes it looks a bit different. While it’s writing, there’s a green LED that lights up.
Comparing the current log output with the log output two years ago (see Atreus Firmware Upgrade), I see no significant differences at the beginning of the run. I am disappointed! 🙁
Time passes.
OK, surprising turn of events! @ckeen wondered whether I had a USB problem and I decided to try the old Apple laptop. You know, the one I used back in 2016. And it worked!
So something about this Purism Librem 13v2’s USB makes it useless. Perhaps it doesn’t have enough power on it or whatever; ckeen wondered about udev rules, but I have no idea. The keyboard is back in working order! And the new firmware will have to wait for another day. Enough is enough!
The only thing I know is that on the Mac the device was `/dev/cu.usbmodem641` and on the Librem it was `/dev/ttyACM0`. Whether that is reasonable or not I cannot say. It did appear and disappear with the keyboard in bootloader mode, though, so I’m fairly confident the device itself was correct.
☯
A new day! Time to look at this Gist. This is going to be a good starting point for the Workman layout. Sadly, all the comments are unchanged! 🙁
All right, unpacked `config.h` and `keymap.c` into my `workman` directory (overwriting the copy of the `keymap.c` from the `default` directory). And compile time!
make atreus:workman
So far, so good:
... Creating load file for flashing: .build/atreus_workman.hex [OK] Copying atreus_workman.hex to qmk_firmware folder [OK] Checking file size of atreus_workman.hex [OK] * File size is fine - 21748/28672 (6924 free)
Going to copy `atreus_workman.hex` over to the Mac and use `avrdude` over there!
That worked as well! So now, what is the layout exactly?
/* Basic layer * ; p f u j || y r d w q * * i o e n m || g t h s a * * / . , l k || b v c x z * * lower insert super shift bksp ctrl || alt space fn . 0 = */
Oops! That’s wrong, that’s inverted! I am reminded of what happened two years ago. I needed to get a PCBDOWN variant of the keyboard. Looking at the source files, I found an interesting thing in the `atreus/config.h` file:
#if defined(ATREUS_ASTAR) # define MATRIX_ROW_PINS { D0, D1, D3, D2 } #if defined(PCBDOWN) # define MATRIX_COL_PINS { B7, D6, F7, F6, B6, D4, E6, B4, B5, C6, D7 } #else # define MATRIX_COL_PINS { D7, C6, B5, B4, E6, D4, B6, F6, F7, D6, B7 } #endif # define UNUSED_PINS #elif defined(ATREUS_TEENSY2) # define MATRIX_ROW_PINS { D0, D1, D2, D3 } # define MATRIX_COL_PINS { F6, F5, F4, B7, B6, B5, B4, B3, B2, B1, B0 } # define UNUSED_PINS #endif
So if I have an A-STAR (which I have according to the picture above), I can define whether I have a PCBDOWN or not. Let’s do that! But how to pass this through? A change was needed:
diff --git a/keyboards/atreus/rules.mk b/keyboards/atreus/rules.mk index 2c8418beb..2488fd5e8 100644 --- a/keyboards/atreus/rules.mk +++ b/keyboards/atreus/rules.mk @@ -5,6 +5,9 @@ ifdef TEENSY2 ATREUS_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex else OPT_DEFS += -DATREUS_ASTAR +ifdef PCBDOWN + OPT_DEFS += -DPCBDOWN +endif ATREUS_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) endif
So now I can compile it again:
make atreus:workman PCBDOWN=yes
And upload it... By the cursed god of sparrows and worms, of course now the `FN+ESC b` combo doesn’t work. I tried all sorts of combos but no luck. I had to unscrew the back and do the hardware reset.
But now the layout looks good:
/* Basic layer (L0) * q w d r y || j u f p ; * a s h t g || m n e o i * z x c v b || k l , . / * esc tab super shift bksp ctrl || alt space RS LW ' ret */ /* Raised layer (RS) * ! @ { } | || - 7 8 9 * * # $ ( ) ` || _ 4 5 6 + * % ^ [ ] ~ || & 1 2 3 \ * del || ins 0 = */ /* Lower layer (LW) * insert home up end pgup || up F7 F8 F9 F10 * del left down right down || down F4 F5 F6 F11 * || F1 F2 F3 F12 * || reset */
(Later I noticed that the basic layout in the gist didn’t actually match the layout on the Workman page, so that also needed fixing.)
Notice that “down” beneath the “pgup”? That’s surely a bug and needs to be changed.
What’s weird is that the source code has Ctrl and Alt the other way around. And yet it still works. An effect of the PCBDOWN setting? I have no idea.
Also, no volume up and down? I guess I don’t use these often enough. But I think I want to.
I’ve set Caps Lock to be my compose key. Add it? Sure! Also note that Shift is sticky. I guess that’s because the key code is `OSM_SFT`. Sounds like “One Shot Modifier Shift”. And indeed, that’s what is: `OSM(MOD_LSFT)`.
What about the menu key? Sure, add it as `KC_MENU`. Strangely it now reports as `SunProps`. That’s pretty useless.
I’d like the `< >` keys on that raised layer, too...
And also: what’s the reset combo? There it is! “reset” on the lower layer! OK, that’s cool.
As I was experimenting, I noticed that I was often stuck in the raised or lower layer. What was happening? I think the problem was that I had overwritten LW on the raised layer with a dot, so there was no way to come back unless I double tapped RS to switch to the raised layer, and there LW was still available to go back. How annoying. I still think there should be a dot on the number layer for all the floating points and all the dates I need to type.
I guess I need to put the dot where the underscore is. That seems to be the most useless key since I can get it via Shift Minus on the raised layer? Then again... Perhaps Delete and Insert are the most useless bindings on this layer. Sure, they complement Backspace and Space, but I never use them. And then I can shift these around and put the underscore in the uncomfortable position...
So here’s the new layout:
Image 2 for 2018-08-22 Workman on the Atreus
Surprisingly, Caps Lock works as advertised: it turns int a Multi Key and so when I then continue with `c ,` I actually get `ç`. This is cool.
So, unresolved: `menu`, `bright+` and `bright-`. Any ideas? On this laptop I use Gnome which has it’s own layer of remapping somewhere. This is not easy.
Anyway, you should be able to find in my repo.
#Atreus #Workman #Keyboard #Apple #Purism
(Please contact me if you want to remove your comment.)
⁂
I’ve had the exact same problems when flashing my Iris keyboard in the past. Like you, I simply switched to a different computer, which seemed to work perfectly.
My suspicions, at least in my particular case, lie in the fact that the old Mac Pro I am using has internal USB hubs that might end up influencing the timing of the programming.
– hrh 2018-08-22 20:49 UTC
---
Interesting!
– Alex Schroeder 2018-08-22 20:51 UTC
---
@drm suggested looking at AdNW-Koy in case I still type a lot of German. I guess I sort of do but the last two years I’ve been moving from a Swiss German layout to a US American International layout. Oh well.
It has nice layers for special characters as well. I got it accepted into X a few years ago, so it should be available on most Linux distributions with `setxkbmap de koy`.
– Alex Schroeder 2018-08-27 18:47 UTC