{"id":35214490,"url":"https://github.com/veeso/gpio2key","last_synced_at":"2026-01-20T16:32:45.230Z","repository":{"id":328855343,"uuid":"1116964894","full_name":"veeso/gpio2key","owner":"veeso","description":"a Linux utility written in Rust that maps GPIO pins to keyboard key events using the evdev interface","archived":false,"fork":false,"pushed_at":"2025-12-26T13:00:06.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-28T01:00:10.164Z","etag":null,"topics":["gpio","raspberry-pi","raspberrypi","retrogaming","retropie","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veeso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"veeso","ko_fi":"veeso"}},"created_at":"2025-12-15T16:24:29.000Z","updated_at":"2025-12-26T13:00:09.000Z","dependencies_parsed_at":"2025-12-19T10:09:06.496Z","dependency_job_id":null,"html_url":"https://github.com/veeso/gpio2key","commit_stats":null,"previous_names":["veeso/gpio2key"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/veeso/gpio2key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fgpio2key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fgpio2key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fgpio2key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fgpio2key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veeso","download_url":"https://codeload.github.com/veeso/gpio2key/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veeso%2Fgpio2key/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpio","raspberry-pi","raspberrypi","retrogaming","retropie","rust","rust-lang"],"created_at":"2025-12-29T21:20:10.609Z","updated_at":"2026-01-20T16:32:45.225Z","avatar_url":"https://github.com/veeso.png","language":"Rust","funding_links":["https://github.com/sponsors/veeso","https://ko-fi.com/veeso"],"categories":[],"sub_categories":[],"readme":"# gpio2key\n\n[![license-mit](https://img.shields.io/crates/l/gpio2key.svg)](https://opensource.org/licenses/MIT)\n[![repo-stars](https://img.shields.io/github/stars/veeso/gpio2key?style=flat)](https://github.com/veeso/gpio2key/stargazers)\n[![downloads](https://img.shields.io/crates/d/gpio2key.svg)](https://crates.io/crates/gpio2key)\n[![latest-version](https://img.shields.io/crates/v/gpio2key.svg)](https://crates.io/crates/gpio2key)\n[![ko-fi](https://img.shields.io/badge/donate-ko--fi-red)](https://ko-fi.com/veeso)\n[![conventional-commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits\u0026logoColor=white)](https://conventionalcommits.org)\n\n[![build-test](https://github.com/veeso/gpio2key/actions/workflows/cargo.yml/badge.svg)](https://github.com/veeso/gpio2key/actions/workflows/cargo.yml)\n\n## Introduction\n\ngpio2key is a Raspberry Pi and Linux utility written in Rust that maps GPIO pins to keyboard key events using the evdev interface.\nIt is particularly useful for embedded systems like Raspberry Pi, where physical buttons connected to GPIO pins can\nbe used to simulate keyboard input.\n\nIn my case I've done this to mod the LEGO Gameboy to add physical buttons using a Raspberry Pi Zero 2W on RetroPie OS.\n\n## Usage\n\n```bash\ngpio2key --config config.toml\n```\n\nOther options:\n\n- `--config \u003cFILE\u003e`: Path to the configuration file (default: `config.toml`)\n- `--device \u003cFILE\u003e`: Path to the GPIO character device representing the GPIO chip (default: `/dev/gpiochip0`)\n- `--keyboard-name \u003cNAME\u003e`: Set the name of the virtual keyboard device (default: `gpio2key`)\n- `--log-level \u003cLEVEL\u003e`: Set the logging level (options: `error`, `warn`, `info`, `debug`, `trace`; default: `info`)\n- `--raspberry`: Enable Raspberry Pi specific GPIO setup. This will also setup gpio as pull-up inputs.\n- `--help`: Show help information\n\n\u003e [!NOTE]\n\u003e\n\u003e On Linux, there is no way from `gpio-cdev` to set pull-up or pull-down resistors on GPIO pins.\n\u003e So you need to set them up manually before running the program, or use a hardware solution (e.g. external resistors).\n\u003e If you are using a Raspberry Pi, you can use the `--raspberry` flag to automatically set GPIO pins as pull-up inputs using the `rppal` crate.\n\n## Configuration\n\nDefault configuration file path is `config.toml`, but can be overridden with the `--config` command line argument.\n\n```toml\ndefault_debounce_ms = 20 # default debounce time in milliseconds\ndefault_active_low = true # default active_low setting for keys; if true, key is active when GPIO is low\npoll_interval_ms = 5 # polling interval in milliseconds\n\n[[key]]\ngpio = 17\nkeycode = \"A\"\nactive_low = true # `default_active_low` by default\ndebounce_ms = 20 # `default_debounce_ms` by default\nrepeat = false # disabled by default\n\n[[key]]\ngpio = 22\nkeycode = \"UP\"\nrepeat = true\nrepeat_delay_ms = 300\nrepeat_rate_ms = 80\n\n[[powerswitch]]\ngpio = 27\nactive_low = false\n```\n\n### Parameters\n\n#### Global Settings\n\n- `default_debounce_ms`: Default debounce time in milliseconds for keys (default: `20`)\n- `default_active_low`: Default active_low setting for keys; if true, keys are active when GPIO is low (default: `true`)\n- `poll_interval_ms`: Polling interval in milliseconds for checking GPIO states (default: `5`)\n\n#### Keys\n\nKeys are defined in the `[[key]]` array.\nA key is mapped to a GPIO pin and generates key events when the pin state changes.\n\nEach key can have the following parameters:\n\n- `gpio`: GPIO pin number (required)\n- `keycode`: Key code as defined in `input-event-codes.h` (required)\n- `active_low`: If true, the key is active when the GPIO pin is low (default: `default_active_low`)\n- `debounce_ms`: Debounce time in milliseconds (default: `default_debounce_ms`)\n- `repeat`: If true, the key will auto-repeat when held down (default: `false`)\n- `repeat_delay_ms`: Delay before auto-repeat starts in milliseconds (default: `500`)\n- `repeat_rate_ms`: Interval between auto-repeats in milliseconds (default: `30`)\n\n#### Power Switches\n\nPower switches are defined in the `[[powerswitch]]` array.\nA power switch is mapped to a GPIO pin and triggers a system shutdown when activated.\nIn order to use this feature, the program must be run with sufficient privileges to execute shutdown commands.\n\nEach power switch can have the following parameter:\n\n- `gpio`: GPIO pin number (required)\n- `active_low`: If true, the power switch is active when the GPIO pin is low (default: `true`)\n\n## Build for RetroPie\n\nFor building on RetroPie and ARM32 systems, you need to follow these steps:\n\n```bash\nrustup target add armv7-unknown-linux-musleabihf\nsudo apt install -y musl-tools gcc-arm-linux-gnueabihf\n\ncargo build --release --target armv7-unknown-linux-musleabihf\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveeso%2Fgpio2key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveeso%2Fgpio2key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveeso%2Fgpio2key/lists"}