Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line Tool #176

Open
MGlaab opened this issue Sep 5, 2024 · 5 comments
Open

Command-line Tool #176

MGlaab opened this issue Sep 5, 2024 · 5 comments

Comments

@MGlaab
Copy link

MGlaab commented Sep 5, 2024

Can I make a request for a YouTube video showing how you can use the command-line tool? I've used the web-based tool, and appreciate it, but I'd like to work up a python automation script that could flash multiple devices at once. (think of a classroom of individual student devices).

@jfedor2
Copy link
Owner

jfedor2 commented Sep 5, 2024

You need the Python hid module.

There are some OS-specific instructions here: https://pypi.org/project/hid/

I've tried it on Ubuntu and macOS, not sure about Windows.

Then to load a configuration you would do:

python3 set_config.py < hid-remapper-config.json

This works if there's exactly one HID Remapper connected. If you want to configure multiple devices at the same time you'd have to slightly modify the scripts.

@MGlaab
Copy link
Author

MGlaab commented Sep 5, 2024

Thanks, I'm going to try with one device on my mac, and see if I can modify it.

@jfedor2
Copy link
Owner

jfedor2 commented Sep 5, 2024

On Mac I've had success using MacPorts and installing the module with sudo port install py-hid. Just remember to use the Python instance from MacPorts afterwards. If you're using Homebrew it can probably be installed from there as well.

@lukeallister
Copy link

Just commenting on how I got it working on pop-os (ubuntu based).

I needed to create a virtual environment, install system packages, install the
python hid library, and then run the commands with sudo in order to get the right
permissions.

install packages

sudo apt install libhidapi-dev libhidapi-hidraw0

Use micromamba to create an environment (could do this with conda or venv)

micromamba create --name hid python=3.12
micromamba activate hid
pip3 install -r requirements.txt

Run the get_config.py script as root and output the config. Edit the config,
then write back to the device.

sudo /home/luke/Dev/micromamba-env/envs/hid/bin/python3 get_config.py > config.json
vim config.json
cat config.json | sudo /home/luke/Dev/micromamba-env/envs/hid/bin/python3 set_config.py

Is there a good documentation of what the 'target_usage' and 'source_usage' mean? I just had to remember how I'd set it on the web config from a windows device.

@jfedor2
Copy link
Owner

jfedor2 commented Dec 13, 2024

Some labels are in usages.js, in general they're defined here:

https://usb.org/sites/default/files/hut1_5.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants