{"id":19219897,"url":"https://github.com/python-utilities/xjoypad","last_synced_at":"2025-10-08T13:06:35.196Z","repository":{"id":84902112,"uuid":"206626440","full_name":"python-utilities/xjoypad","owner":"python-utilities","description":"Python 2/3 evdev wrapper class for parsing Joypad input events.","archived":false,"fork":false,"pushed_at":"2019-09-07T21:10:26.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T01:40:00.585Z","etag":null,"topics":["joypad","python2","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-utilities.png","metadata":{"files":{"readme":".github/README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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},"funding":{"liberapay":"python-utilities"}},"created_at":"2019-09-05T18:00:39.000Z","updated_at":"2020-11-01T23:08:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"eadcd07f-a192-4496-b2e5-0b6cde31d4c1","html_url":"https://github.com/python-utilities/xjoypad","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/python-utilities/xjoypad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-utilities%2Fxjoypad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-utilities%2Fxjoypad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-utilities%2Fxjoypad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-utilities%2Fxjoypad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-utilities","download_url":"https://codeload.github.com/python-utilities/xjoypad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-utilities%2Fxjoypad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278948028,"owners_count":26073750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["joypad","python2","python3"],"created_at":"2024-11-09T14:33:13.013Z","updated_at":"2025-10-08T13:06:35.180Z","avatar_url":"https://github.com/python-utilities.png","language":"Python","funding_links":["https://liberapay.com/python-utilities"],"categories":[],"sub_categories":[],"readme":"# XJoypad\n[heading__title]:\n  #xjoypad\n  \"\u0026#x2B06; Top of ReadMe File\"\n\n\nXJoypad is a Python2/3 iterator and wrapper API of `evdev`, for reading and parsing joypad and game-controller input events.\n\n\n## [![Byte size of __init__.py][badge__master__xjoypad__source_code]][xjoypad__master__source_code] [![Open Issues][badge__issues__xjoypad]][issues__xjoypad] [![Open Pull Requests][badge__pull_requests__xjoypad]][pull_requests__xjoypad] [![Latest commits][badge__commits__xjoypad__master]][commits__xjoypad__master]\n\n\n\n------\n\n\n#### Table of Contents\n\n\n- [:arrow_up: Top of ReadMe File][heading__title]\n\n- [:zap: Quick Start][heading__quick_start]\n\n  - [:memo: Edit Your ReadMe File][heading__your_readme_file]\n  - [:snake: Utilize XJoypad][heading__utilize]\n  - [:floppy_disk: Commit and Push][heading__commit_and_push]\n\n- [\u0026#x1F5D2; Notes][heading__notes]\n\n- [\u0026#x2696; License][heading__license]\n\n\n------\n\n\n\n## Quick Start\n[heading__quick_start]:\n  #quick-start\n  \"\u0026#9889; Perhaps as easy as one, 2.0,...\"\n\n\n**Bash Variables**\n\n\n```Bash\n_module_name='xjoypad'\n_module_https_url=\"https://github.com/python-utilities/${_module_name}.git\"\n_module_relative_path=\"lib/modules/${_module_name}\"\n```\n\n\n**Bash Submodule Commands**\n\n\n```Bash\ncd \"\u003cyour-git-project-path\u003e\"\n\ngit checkout master\nmkdir -vp \"lib/modules\"\n\ngit submodule add\\\n -b master --name \"${_module_name}\"\\\n \"${_module_https_url}\" \"${_module_relative_path}\"\n```\n\n\n### Your ReadMe File\n[heading__your_readme_file]:\n  #your-readme-file\n  \"\u0026#x1F4DD; Suggested additions for your ReadMe.md file so everyone has a good time with submodules\"\n\n\nSuggested additions for your _`ReadMe.md`_ file so everyone has a good time with submodules\n\n\n```MarkDown\nInstall Python dependencies\n\n\n    pip3 install --user evdev\n\n\nClone with the following to avoid incomplete downloads\n\n\n    git clone --recurse-submodules \u003curl-for-your-project\u003e\n\n\nUpdate/upgrade submodules via\n\n\n    git submodule update --init --merge --recursive\n```\n\n\n### Utilize XJoypad\n[heading__utilize]:\n  #utilize-xjoypad\n  \"\u0026#x1F40D; How to make use of this submodule within another project\"\n\n\n**As an `import`**\n\n\n```Python\n#!/usr/bin/env python3\n\n\nfrom lib.modules.xjoypad import XJoypad\n\n\nif __name__ == '__main__':\n    import time\n\n    xjoypad = XJoypad()\n    for event_data in xjoypad:\n        if event_data:\n            print(\"{name} --\u003e {value} --\u003e {normalized_value}\".format(**event_data))\n\n        time.sleep(0.001)\n```\n\n\n**As a base `class`**\n\n\n```Python\n#!/usr/bin/env python3\n\n\nimport time\n\nfrom lib.modules.xjoypad import XJoypad\n\n\nclass XJoypad_Buffer(XJoypad):\n    \"\"\"Extends `XJoypad` class with buffer and timeout features\"\"\"\n\n    def __init__(self, device_index = 0, amend_settings = None, **kwargs):\n        \"\"\"\n        Use `amend_settings` to modify select `self['sleeps']` settings\n        \"\"\"\n        self['sleeps'] = {\n            'min': 0.001,\n            'max': 0.01,\n            'acceleration': 0.001,\n            'timeout': 120,\n            'current': 0.001,\n        }\n\n        super(XJoypad_Buffer, self).__init__(device_index = device_index, amend_settings = amend_settings, **kwargs)\n\n    def next(self):\n        \"\"\"\n        Throws `GeneratorExit` if timeout is set and reached, otherwise returns `event_data` when available\n        \"\"\"\n        while 1:\n            _event_data = super(XJoypad_Buffer, self).next()\n            if _event_data:\n                self['sleeps']['slept_start'] = None\n                self['sleeps']['current'] = self['sleeps']['min']\n                return _event_data\n\n            if not self['sleeps'].get('slept_start'):\n                self['sleeps']['slept_start'] = time.time()\n\n            if self['sleeps']['current'] \u003c self['sleeps']['max']:\n                self['sleeps']['current'] += self['sleeps']['acceleration']\n\n            if self['sleeps'].get('timeout') and self['sleeps'].get('slept_last'):\n                if self['sleeps']['slept_last'] - self['sleeps']['slept_start'] \u003e self['sleeps']['timeout']:\n                    self.throw(GeneratorExit)\n\n            self['sleeps']['slept_last'] = time.time()\n            time.sleep(self['sleeps']['current'])\n\n\nif __name__ == '__main__':\n    xjoypad = XJoypad_Buffer()\n    for event_data in xjoypad:\n        print(\"Event name -\u003e {name} -- {value} -- {normalized_value}\".format(**event_data))\n        time.sleep(0.001)\n```\n\n\n### Commit and Push\n[heading__commit_and_push]:\n  #commit-and-push\n  \"\u0026#x1F4BE; It may be just this easy...\"\n\n\n```Bash\ngit add .gitmodules\ngit add lib/modules/xjoypad\n\n\n## Add any changed files too\n\n\ngit commit -F- \u003c\u003c'EOF'\n:heavy_plus_sign: Adds `python-utilities/xjoypad#1` submodule\n\n# ... anything else noteworthy\nEOF\n\n\ngit push origin master\n```\n\n\n**:tada: Excellent :tada:** your repository is now ready to begin unitizing code from this project!\n\n\n___\n\n\n## Notes\n[heading__notes]:\n  #notes\n  \"\u0026#x1F5D2; Additional resources and things to keep in mind when developing\"\n\n\nPull Requests are welcome for fixing bugs and/or adding features.\n\n\n___\n\n\n## License\n[heading__license]:\n  #license\n  \"\u0026#x2696; Legal bits of Open Source software\"\n\n\nLegal bits of Open Source software\n\n\n```\nXJoypad ReadMe documenting how things like this could be utilized\nCopyright (C) 2019  S0AndS0\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published\nby the Free Software Foundation; version 3 of the License.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n```\n\n\n\n[badge__commits__xjoypad__master]:\n  https://img.shields.io/github/last-commit/python-utilities/xjoypad/master.svg\n\n[commits__xjoypad__master]:\n  https://github.com/python-utilities/xjoypad/commits/master\n  \"\u0026#x1F4DD; History of changes on this branch\"\n\n\n[xjoypad__community]:\n  https://github.com/python-utilities/xjoypad/community\n  \"\u0026#x1F331; Dedicated to functioning code\"\n\n\n[xjoypad__gh_pages]:\n  https://github.com/python-utilities/xjoypad/tree/gh-pages\n  \"Source code examples hosted thanks to GitHub Pages!\"\n\n\n\n[badge__demo__xjoypad]:\n  https://img.shields.io/website/https/python-utilities.github.io/xjoypad/index.html.svg?down_color=darkorange\u0026down_message=Offline\u0026label=Demo\u0026logo=Demo%20Site\u0026up_color=success\u0026up_message=Online\n\n[demo__xjoypad]:\n  https://python-utilities.github.io/xjoypad/index.html\n  \"\u0026#x1F52C; Check the example collection tests\"\n\n\n[badge__issues__xjoypad]:\n  https://img.shields.io/github/issues/python-utilities/xjoypad.svg\n\n[issues__xjoypad]:\n  https://github.com/python-utilities/xjoypad/issues\n  \"\u0026#x2622; Search for and _bump_ existing issues or open new issues for project maintainer to address.\"\n\n\n[badge__pull_requests__xjoypad]:\n  https://img.shields.io/github/issues-pr/python-utilities/xjoypad.svg\n\n[pull_requests__xjoypad]:\n  https://github.com/python-utilities/xjoypad/pulls\n  \"\u0026#x1F3D7; Pull Request friendly, though please check the Community guidelines\"\n\n\n[badge__master__xjoypad__source_code]:\n  https://img.shields.io/github/size/python-utilities/xjoypad/__init__.py.svg?label=__init__.py\n\n[xjoypad__master__source_code]:\n  https://github.com/python-utilities/xjoypad/blob/master/__init__.py\n  \"\u0026#x2328; Project source, one Python file of importable code!\"\n\n\n[xjoypad__gh_pages]:\n  https://github.com/python-utilities/xjoypad/tree/gh-pages\n  \"Source code examples hosted thanks to GitHub Pages!\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-utilities%2Fxjoypad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-utilities%2Fxjoypad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-utilities%2Fxjoypad/lists"}