Question - Is this an enhancement to the official clockworkpi keyboard source, referred to as “DevTerm_keyboard_firmware_v0.1_utils.sh” and not the user re-written code, referred to as “DevTerm_keyboard_firmware_v0.2_utils.sh” and “DevTerm_keyboard_firmware_v0.3_utils.sh”, correct?
Not sure, I never used the scripts to update the firmware.
Did not touch the scripts either, so my “compile and upload the keyboard firmware” means taking it out to a PC, use arduino to compile the code and upload the new fw.
I can probably also update the scripts though.
My starting point was the latest official code repo, and it already has the trackball enhancements.
DONE: joystick also needs some improvements. I noticed it only after I played some retro games: hold left, hold right, release left, joystick reports middle position instead of right.
TODO: deal with different cpi hardware versions and OS configurations. Arch/Manjaro package has a different name for the gearbox; Arch/Manjaro requires an additional script “root-notify-send” I wrote to correctly connect to the DBUS. And… the script currently doesn’t know about wayland sessions.
TODO: currently the serial communication is single-sided. Host receives notification changes from the keyboard. I’d like the host to also send commands to the keyboard, including:
I suggest power save modes. Power saving at the expense of response time. Maybe have the system place keyboard into “sleep” before suspend, and wake up after? Technically this should be done on the USB side, but that sounds complicated
I’m not sure – saw some other users posting suspend issues like “can’t use keyboard to wake up from suspend” – maybe the host controller is done for and the keyboard is awake actually?
Maybe we should let it enter sleep if there’s no usb connection.
@pkr I’ve implemented low-power mode.
Whenever there’s no user input, it uses the instruction “wfi” to wait for interrupts.
When I connect a charging meter between keyboard & DT, it stays at <10mA (so I cannot measure)
When I connect a charging meter between DT and charger, having keyboard installed/not installed resulted in ~100mA difference (570mA w/ keyboard vs. 470mA w/o keyboard)
I even tried to “half connect” the keyboard by only supplying power but not let the host see the keyboard – power remains at 470mA)
So I figure it’s not the keyboard is drawing that much power… but it’s the main cpu (A06) that’s kept busy by the keyboard. And A06 is very bad at energy saving at the moment.
Nice! This would be great for CM3 users because their devices don’t shut down all the way–USB stays on and the keyboard drains ~40mA. EDIT: weird. I also tried connecting my keyboard to a power meter via USB, and the current consumption was too low to measure… EDIT #2: daisy-chained a USB hub in between. Hub draws 0.06A, and after connecting kb it’s 0.13A. So I guess keyboard draws ~70mA? EDIT #3: trying all sorts of loads… (0.05A/0.09A, 0.06A/0.10A). Can’t seem to get 0.13A draw anymore, so I guess keyboard drains ~40mA.
Do you happen to have a binary I could test with? I’m too computer illiterate to do arduino stuff, especially under linux
Thanks! Works great, though there’s no perceivable difference in power consumption. I don’t think I’ll be installing the daemon, but the joystick modes are very useful as-is
Suggestion: for gear switching, it should send gear +/- (or up/down) instead of keeping track of the gear in the keyboard. That way the daemon can be easily changed to work with something else, or in case they add more gears in the future, etc…
Warning: the script does not always work! It may leave the keyboard in a state that requires flashing via an Arduino IDE, or at least, detached and connected externally via microusb (sometimes fails to put the keyboard into DFU mode)