Is it possiible to flash fimware from the command line (using Agent)?

Hi everyone,

I would like to be able to create a script that can download the latest firmware, e.g. uhk-firmware-18.0.1.tar.gz and use uhk-agent in a terminal/command line/script (non-interactive isatty) to be able to flash the given firmware file to it. It would be nice to be able to list the available connected devices from the command line as well.

Right now, if I run uhk-agent –help it just spawns an electron container and runs the GUI app.

The CLI args that would be nice to have are:

  • --help, shows the manual
  • --list-connected-keyboards, shows a list of keyboard-ids
  • --flash-to <keyboard-id> --firmware-file <path-to-firmware-file>, shows success (exit code 0) or failure and reason (exit codes 1..=255).

Any thoughts on how to take what’s under the hood of Agent and compose something like this?

I wanted to ask if anyone here knows what the underlying js or ts files or (other native functions/commands) that already exist (in uhk-agent) that I can re-use to compose something like this.

I could make a separate standalone (cross-platform) binary like uhk-agent-cli (in Rust using with ROC) to prototype this, so as not to pollute uhk-agent AppImage binary.

Thanks, Naz

1 Like

You may need to add multiple -- in front of your argument list depending on packaging in order to access various wrapping layers. E.g., for development, I need to npm run electron -- -- -- --no-sandbox $UHKPINK .

But no, there is no argument to flash the firmware atm.

See packages/usb in agent’s source code ( GitHub - UltimateHackingKeyboard/agent: Ultimate Hacking Keyboard configurator · GitHub ) - there are some standalone scripts in , including ones to flash the firmware.

2 Likes

Thanks @kareltucek for the quick reply & the info. I will keep you posted on any progress that I make on this journey.

2 Likes