# DevTerm Keyboard firmware mod: hot mode switching / gear switching

**URL:** <https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431>\
**Category:** DevTerm\
**Created:** [May 6, 2022, 3:51pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431 "2022-05-06T15:51:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [May 23, 2022, 4:12am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/22 "2022-05-23T04:12:24Z")

</div>

> though there’s no perceivable difference in power consumption

Tried to squeeze out a few milliamps while the core is too excited about the keyboard  
OOoooOOoohhh my keybooooard poll poll poll poll  
_there goes 100mA_  
😕

---

<div class="post-metadata">

**Author:** ![pkr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/pkr/32/6084_2.png) [@pkr](https://forum.clockworkpi.com/u/pkr)\
**Post date:** [May 23, 2022, 5:46am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/23 "2022-05-23T05:46:43Z")

</div>

N̶o̶ ̶w̶o̶r̶k̶y̶,̶ ̶h̶a̶d̶ ̶t̶o̶ ̶r̶e̶v̶e̶r̶t̶ ̶t̶o̶ ̶p̶r̶e̶v̶i̶o̶u̶s̶ ̶o̶n̶e̶ xD  
_EDIT:_ no wait i’m stupid. downloaded an html file and tried to flash that, LOL

Works great (:

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [May 23, 2022, 4:39pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/24 "2022-05-23T16:39:34Z")

</div>

> **[devterm\_keyboard.ino.bin](https://yadli.net/index.php/s/oqZ3GAZrFYSxnTy)**
>
> Nextcloud - a safe home for all your data

- Adds horizontal scroll to JS mouse

Fun side note: as USB HID standards only define a vertical mouse wheel, mouses today rely on a “consumer device - AC Pan” to describe horizontal scrolling.

AC Pan, like panning the wind out of AC? Nice to have.

---

<div class="post-metadata">

**Author:** ![Jory\_Griffis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/jory_griffis/32/5605_2.png) [@Jory\_Griffis](https://forum.clockworkpi.com/u/Jory_Griffis)\
**Post date:** [June 12, 2022, 4:26am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/25 "2022-06-12T04:26:04Z")

</div>

Thanks so much for this. This is the most essential community upgrade I have installed yet, I love being able to switch to the dpad-mouse.

However, I can’t get the service to start. Here’s the log from journalctl:

Jun 11 21:15:31 clockworkpi-a06 python3[1629]: Traceback (most recent call last):  
Jun 11 21:15:31 clockworkpi-a06 python3[1629]: File “/usr/local/bin/devterm\_keyboard.py”, line 1, in   
Jun 11 21:15:31 clockworkpi-a06 python3[1629]: import serial  
Jun 11 21:15:31 clockworkpi-a06 python3[1629]: ModuleNotFoundError: No module named ‘serial’  
Jun 11 21:15:31 clockworkpi-a06 systemd[1]: devterm-keyboard.service: Main process exited, code=exited, status=1/FAILURE  
Jun 11 21:15:31 clockworkpi-a06 systemd[1]: devterm-keyboard.service: Failed with result ‘exit-code’.

If you have a moment I’d appreciate your help! No worries if there isn’t a clear answer to this problem though.

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [June 12, 2022, 4:41am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/26 "2022-06-12T04:41:18Z")

</div>

glad you like it 😛  
try install the serial module: `sudo pip install serial`  
if it then complains about pip not found, then install pip (depends on what distro you’re on).

---

<div class="post-metadata">

**Author:** ![Jory\_Griffis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/jory_griffis/32/5605_2.png) [@Jory\_Griffis](https://forum.clockworkpi.com/u/Jory_Griffis)\
**Post date:** [June 12, 2022, 6:04am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/27 "2022-06-12T06:04:29Z")

</div>

OK, halfway there… now journalctl says

File “/usr/local/bin/devterm\_keyboard.py”, line 3, in   
ser = serial.Serial(’/dev/ttyACM0’)  
AttributeError: module ‘serial’ has no attribute ‘Serial’

EDIT: I’ll do some research, but I figured I would ask since you so kindly replied so quickly! Thanks for your help!

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [June 12, 2022, 7:08am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/28 "2022-06-12T07:08:40Z")

</div>

My bad. It should be: `pip install pyserial`  
It’s in the Makefile but I commented it out

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [June 12, 2022, 6:07pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/29 "2022-06-12T18:07:37Z")

</div>

Version 2 is released. See 1st post.  
@pkr new feature, true powa savage!

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [June 12, 2022, 8:17pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/30 "2022-06-12T20:17:45Z")

</div>

Version 3 “emergency grooming” released ((

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [June 30, 2022, 12:15pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/31 "2022-06-30T12:15:33Z")

</div>

Version 4 is released, featuring Mouse Overlay.

---

<div class="post-metadata">

**Author:** ![jan-peter](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/jan-peter/32/6450_2.png) [@jan-peter](https://forum.clockworkpi.com/u/jan-peter)\
**Post date:** [July 19, 2022, 9:57pm UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/32 "2022-07-19T21:57:59Z")

</div>

I love it so much, that you focus on tinkering with the little details and offer help and functionality to the community.

I just struggle to understand, what you did?  
Is there an easy way to understand you Upgrades and what the additional functionality brought by the version jumps actually means?

---

<div class="post-metadata">

**Author:** ![mowgli](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mowgli](https://forum.clockworkpi.com/u/mowgli)\
**Post date:** [August 4, 2022, 5:05am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/33 "2022-08-04T05:05:01Z")

</div>

Looks like the flashing went fine on the presumably v4 firmware. Seems like fantastic work! Thank you!

Some questions:

- Does your version include the changes from the post [I've rewritten DevTerm keyboard & trackball firmware](https://forum.clockworkpi.com/t/ive-rewritten-devterm-keyboard-trackball-firmware/7671)
- Is there any visual indication of the mode/cpu gear? How do you find out? There doesn’t appear to be any, unlike the screenshot.
- Your download doesn’t seem to have the sources, is the source available somewhere? No way to build manually.
- Your post mentions services, but those would be in the missing sources directory
- The git status shows that the bin file had been modified but not checked in. Could you include an sha256 sum of the current binary?
- Possibly rename the download to include the version number?

FYI I am now on Ubuntu LTS 22.0.4.1 after upgrading, perhaps something has changed/

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [August 4, 2022, 5:31am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/34 "2022-08-04T05:31:09Z")

</div>

@jan-peter

> I just struggle to understand, what you did?

😃 just random bits to improve the keyboard fw, including DPAD mouse, low power mode etc.

The changelog for version bumps are noted at the bottom of the post.

@mowgli

> - Does your version include the changes from the post [I’ve rewritten DevTerm keyboard & trackball firmware](https://forum.clockworkpi.com/t/ive-rewritten-devterm-keyboard-trackball-firmware/7671)

Yes! The trackball improvement was grafted into the official repo, and my work started afterwards.

> - Is there any visual indication of the mode/cpu gear? How do you find out?

This is done by installing the keyboard service, which will send notifications to the X11 desktop. Not ideal – I wish there were LEDs in the front panel for this.

> - Your download doesn’t seem to have the sources, is the source available somewhere? No way to build manually.

It’s in the repo at the top of the post. The keyboard service is also there: [https://github.com/yatli/DevTerm/tree/main/Code/devterm\_keyboard/service](https://github.com/yatli/DevTerm/tree/main/Code/devterm_keyboard/service)

> - The git status shows that the bin file had been modified but not checked in. Could you include an sha256 sum of the current binary?

Got to make sure we’re on the same page: you cloned the repo and built it, and then `git status`? Which files are changed? I don’t think there’s a build pipeline to obtain keyboard fw yet. The zipped fw files are built with the arduino IDE, then manually assembled.

> - Possibly rename the download to include the version number?

![image](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/d/d7b698bbc4115213c709e3778441f514f7c690b6.png)

Emmm… you mean versions attached to files after unzip?

---

<div class="post-metadata">

**Author:** ![mowgli](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mowgli](https://forum.clockworkpi.com/u/mowgli)\
**Post date:** [August 4, 2022, 7:12am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/35 "2022-08-04T07:12:21Z")

</div>

Yes, sorry for the confusion. I’ve been reading most of these from my phone so I think I might have missed some things.  
I downloaded the FW file from the original post, which included .git and the git history. That file wasn’t named that way. Let me check again.

---

<div class="post-metadata">

**Author:** ![mowgli](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mowgli](https://forum.clockworkpi.com/u/mowgli)\
**Post date:** [August 4, 2022, 7:49am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/36 "2022-08-04T07:49:54Z")

</div>

Ok, so good news is I verified I have the correct firmware on the keyboard. I tried changing modes, but for some reason it wasn’t going back to Joystick Mode, but the d-pad keys were working in the terminal as regular keystrokes. Everything seems to be working, until I install the services. Nothing seems to happen so I do a reboot, but now the built in keyboard fails. Nothing works, not typing or rollerball.  
Could this be a difference with udev rules in Ubuntu 22.04.1?

Unplugging the keyboard and re-plugging didn’t help.  
Dmesg sees the keyboard:

```auto
[285.744015] usb 5-1.1: USB disconnect, device number 3
[343.055123] usb 5-1.1: new full-speed USB device number 6 using ehci-platform
[343.164888] usb 5-1.1: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[343.164916] usb 5-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[343.164935] usb 5-1.1: Product: Maple 003
[343.164951] usb 5-1.1: Manufacturer: LeafLabs
[343.164967] usb 5-1.1: SerialNumber: LLM 003

```

EDIT: So apparently connecting via USB works correctly:

```auto
[2577.678093] usb 5-1.4: new full-speed USB device number 13 using ehci-platform
[2577.787888] usb 5-1.4: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[2577.787919] usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2577.787937] usb 5-1.4: Product: Maple 003
[2577.787954] usb 5-1.4: Manufacturer: LeafLabs
[2577.787970] usb 5-1.4: SerialNumber: LLM 003
[2578.735633] usb 5-1.4: USB disconnect, device number 13
[2578.958128] usb 5-1.4: new full-speed USB device number 14 using ehci-platform
[2579.069130] usb 5-1.4: New USB device found, idVendor=1eaf, idProduct=0024, bcdDevice= 2.00
[2579.069158] usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2579.069177] usb 5-1.4: Product: DevTerm
[2579.069193] usb 5-1.4: Manufacturer: ClockworkPI
[2579.069210] usb 5-1.4: SerialNumber: 20210531
[2579.075895] input: ClockworkPI DevTerm Consumer Control as /devices/platform/fe380000.usb/usb5/5-1/5-1.4/5-1.4:1.0/0003:1EAF:0024.000E/input/input24
[2579.134963] input: ClockworkPI DevTerm Keyboard as /devices/platform/fe380000.usb/usb5/5-1/5-1.4/5-1.4:1.0/0003:1EAF:0024.000E/input/input25
[2579.136954] input: ClockworkPI DevTerm as /devices/platform/fe380000.usb/usb5/5-1/5-1.4/5-1.4:1.0/0003:1EAF:0024.000E/input/input26
[2579.137915] input: ClockworkPI DevTerm Mouse as /devices/platform/fe380000.usb/usb5/5-1/5-1.4/5-1.4:1.0/0003:1EAF:0024.000E/input/input27
[2579.139075] hid-generic 0003:1EAF:0024.000E: input,hidraw2: USB HID v1.10 Keyboard [ClockworkPI DevTerm] on usb-fe380000.usb-1.4/input0
[2579.140090] cdc_acm 5-1.4:1.1: ttyACM0: USB ACM device

```

But reconnecting it normally doesn’t work.

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [August 4, 2022, 8:41am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/37 "2022-08-04T08:41:35Z")

</div>

Try to disable `devterm-mouse.service` first:

`systemctl --user stop devterm-mouse.service`  
`systemctl --user disable devterm-mouse.service`

That’s the part that interact with `uinput` and the udev rule.

You can also check the status of the service: `systemctl status devterm-keyboard.service`  
If it says service “dead” with some logs, please post it here.

You can also stop the keyboard service, using sudo this time:  
`sudo systemctl stop devterm-keyboard.service`  
`sudo systemctl disable devterm-keyboard.service`

After both services are disabled, unplug and plug it back, check if it works.  
When the keyboard is powered up, it will have the DPAD in mouse mode.

* * *

> I downloaded the FW file from the original post, which included .git and the git history. That file wasn’t named that way. Let me check again.

Ok now I remember. Let me explain this a little bit:

- Official firmware shell scripts: when you run that (e.g. `DevTerm_keyboard_firmware_v0.3_utils.sh`), it self-extracts the actual firmware, and flashing scripts then execute that (like the NVIDIA Linux driver `run.sh` 😃 ). The `.git` directory comes from that and I didn’t clear it up.
- I did not figure out how to build that self-extracting shell script, so I just replaced the actual firmware with mine and zipped it.

---

<div class="post-metadata">

**Author:** ![mowgli](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mowgli](https://forum.clockworkpi.com/u/mowgli)\
**Post date:** [August 4, 2022, 8:54am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/38 "2022-08-04T08:54:14Z")

</div>

I rebooted, had the same problem, then completely powered off the DevTerm, took out the batteries and rebooted. I think there must be some hardware caching of usb locations internally. Now everything seems to work again on the keyboard and rollerball. The display notification doesn’t appear to work though, and I have pyserial installed both locally and as root (Your script does the pip install as root). How do you debug or find errors from the service?

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [August 4, 2022, 8:55am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/39 "2022-08-04T08:55:43Z")

</div>

Just run the script behind the service, directly:  
`sudo devterm_keyboard.py` and see if it crashes or print out some logs

The installer Makefile says: ln -s `which gearbox-clockworkpi-a06` /usr/local/bin/devterm\_gearbox.py  
This is wrong for Armbian. So the keyboard service probably won’t start…

---

<div class="post-metadata">

**Author:** ![mowgli](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mowgli](https://forum.clockworkpi.com/u/mowgli)\
**Post date:** [August 4, 2022, 9:00am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/40 "2022-08-04T09:00:14Z")

</div>

> [@yatli](#):
>
> systemctl status devterm-keyboard.service

```auto
× devterm-keyboard.service - devterm keyboard service
     Loaded: loaded (/etc/systemd/system/devterm-keyboard.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-08-04 08:29:51 UTC; 25min ago
    Process: 2014 ExecStart=/usr/bin/python3 /usr/local/bin/devterm_keyboard.py (code=exited, status=1/FAILURE)
   Main PID: 2014 (code=exited, status=1/FAILURE)
        CPU: 149ms

Aug 04 08:29:51 clockworkpi-a06 systemd[1]: devterm-keyboard.service: Scheduled restart job, restart counter is at 5.
Aug 04 08:29:51 clockworkpi-a06 systemd[1]: Stopped devterm keyboard service.
Aug 04 08:29:51 clockworkpi-a06 systemd[1]: devterm-keyboard.service: Start request repeated too quickly.
Aug 04 08:29:51 clockworkpi-a06 systemd[1]: devterm-keyboard.service: Failed with result 'exit-code'.
Aug 04 08:29:51 clockworkpi-a06 systemd[1]: Failed to start devterm keyboard service.

```

---

<div class="post-metadata">

**Author:** ![yatli](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/yatli/32/6253_2.png) [@yatli](https://forum.clockworkpi.com/u/yatli)\
**Post date:** [August 4, 2022, 9:03am UTC](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431/41 "2022-08-04T09:03:52Z")

</div>

Thought so.

`sudoedit /usr/local/bin/devterm_keyboard.py`, and you can remove gear-related logic like this:

- Line 7, `# import devterm_gearbox`, comment out by placing a “#” in the front.
- Line 28, `# devterm_gearbox.devterm.set_gear(gear)`
- Line 30, `# devterm_gearbox.echo(gear, gear_file)`
- Line 80, `# devterm_gearbox.devterm.set_gear(gear)`

[Previous page](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431.md?page=1)

[Next page](https://forum.clockworkpi.com/t/devterm-keyboard-firmware-mod-hot-mode-switching-gear-switching/8431.md?page=3)
