├── .codeclimate.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── stale.yml ├── .gitignore ├── .indent.pro ├── .shellcheckrc ├── LICENSE ├── Makefile ├── NEWS.md ├── azure-pipelines.yml ├── configure.sh ├── docs ├── 3P-BUGS.md ├── BT_DONGLES.md ├── CONFIGURATION.md ├── DEBUGGING.md ├── Gemfile ├── PACKAGING.md ├── README.md ├── SDL.md ├── TESTING.md ├── TROUBLESHOOTING.md ├── _config.yml ├── config_help ├── descriptors │ ├── 8bitso_sn30_windows.md │ ├── gulikit_kingkong2_android.md │ ├── xb1s_linux.md │ ├── xb1s_windows.md │ ├── xbe2_linux.md │ ├── xbe2_unknown.md │ └── xbxs.md ├── heuristics │ └── gamesir-nova.md ├── img │ ├── battery_support.png │ ├── xpadneo-sq.png │ └── xpadneo.png ├── index.md └── reports │ └── xb1s_battery_event.md ├── hid-xpadneo ├── Makefile ├── dkms.conf.in ├── dkms.post_install ├── dkms.post_remove ├── etc-modprobe.d │ └── xpadneo.conf ├── etc-udev-rules.d │ ├── 60-xpadneo.rules │ └── 70-xpadneo-disable-hidraw.rules └── src │ ├── .editorconfig │ ├── Makefile │ ├── hid-ids.h │ ├── hid-xpadneo.c │ ├── xpadneo.h │ └── xpadneo │ ├── consumer.c │ ├── core.c │ └── keyboard.c ├── install.sh ├── lib ├── installer.sh └── options.sh ├── misc ├── examples │ ├── c_hidraw │ │ ├── Makefile │ │ └── hidraw.c │ ├── python_asyncio_evdev │ │ └── gamepad.py │ ├── python_evdev_rumble │ │ └── rumble.py │ └── udev-rules │ │ └── 99-xpadneo-joydev.rules ├── kernel_patches │ ├── 0002-hid_generic_claims_devices.patch │ └── raspi3 │ │ └── 0002-hid_generic_claims_devices.patch └── old │ └── Makefile ├── uninstall.sh └── update.sh /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | cppcheck: 3 | enabled: true 4 | checks: 5 | ConfigurationNotChecked: 6 | enabled: false 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | 8 | [Makefile*] 9 | indent_style = tab 10 | indent_size = 8 11 | 12 | [*.{c,h}] 13 | indent_style = tab 14 | indent_size = 4 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug 4 | 5 | --- 6 | 7 | ## Version of xpadneo 8 | 10 | 11 | ## Controller Model 12 | 13 | 14 | - [ ] Xbox One S controller 15 | - [ ] Xbox Elite 2 controller 16 | - [ ] Xbox Series X|S controller 17 | - [ ] Other: 18 | 19 | ### Connection mode 20 | 21 | - [ ] Bluetooth connection 22 | - [ ] USB cable (not yet supported) 23 | - [ ] Xbox Dongle connection (not yet supported) 24 | 25 | ## Installed Software 26 | 29 | 30 | - [ ] Anti-Micro (may affect button mappings) 31 | - [ ] OpenRGB (may mess up mappings and rumble stability) 32 | - [ ] Steam Input (enabled by default via Steam Desktop client) 33 | - [ ] Steam Link (usually via Raspberry Pi or other micro computers) 34 | - [ ] devices with QMK firmware (may affect udev rules, similar to OpenRGB) 35 | - [ ] netstick (shares input devices via network similar to Steam Link) 36 | - [ ] xboxdrv (user-space gamepad driver) 37 | - [ ] xone (kernel-space gamepad driver using the Xbox dongle or USB) 38 | - [ ] xow (alternative driver using the Xbox dongle) 39 | 40 | ## Protocol Information 41 | 44 | 45 | Please help us identify at which layer the problem can be found if you want 46 | to report mapping errors or if the controller fails to be detected: 47 | 48 | - [ ] Steam Proton games are having issues 49 | - [ ] Steam Linux-native games are having issues 50 | - [ ] I don't use Steam or did not try 51 | - [ ] games running through Lutris, wine and/or Bottles are having issues 52 | - [ ] I don't use Lutris, Bottles, wine or did not try 53 | - [ ] Linux-native games are having issues 54 | - [ ] I don't use native games or did not try 55 | - [ ] Other software is having issues (describe software and issues below) 56 | - [ ] Running `evtest` is showing issues (describe the issues below) 57 | - Keep in mind that `BTN_NORTH` and `BTN_WEST` are intentionally swapped 58 | - [ ] Running `jstest` is showing issues (describe the issues below) 59 | - [ ] I don't have this tool or don't know how to use it 60 | - [ ] Running `gamepad-tool` is showing issues (post console output below) 61 | - [ ] I don't have this tool 62 | 63 | Please describe how it is failing below in the next sections. 64 | 65 | ## Severity / Impact 66 | 68 | 69 | - [ ] I've read the docs and the bug reporting instructions 70 | - [ ] I've applied the latest firmware update to the controller 71 | - [ ] I've tried disabling or running without above mentioned software 72 | - [ ] It does not work at all 73 | - [ ] It used to work in a previous version 74 | - [ ] It mostly works but sometimes it doesn't 75 | - [ ] I found a work-around 76 | - [ ] I probably didn't figure it all out but it's too early to give up 77 | - [ ] I don't know how to ... 78 | - [ ] It's too complicated 79 | - [ ] Fantastic work but ... 80 | - [ ] I can code and I want to help 81 | 82 | ## Describe the Bug 83 | 84 | 85 | 86 | ## Steps to Reproduce 87 | 88 | 89 | 90 | ## Expected Behavior 91 | 92 | 93 | 94 | ## Screenshots / GIFs / Videos 95 | 97 | 98 | 99 | ## System Information 100 | 101 | 102 | 103 | ```console 104 | # uname -a 105 | 106 | ``` 107 | 108 | 109 | ```console 110 | # xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum) 111 | 112 | ``` 113 | 114 | ## Controller and Bluetooth Information 115 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 132 | 133 | 134 | ## Additional Context 135 | 136 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | ## Version of xpadneo 8 | 10 | 11 | ## Controller Model 12 | 13 | 14 | - [ ] Xbox One S controller 15 | - [ ] Xbox Elite 2 controller 16 | - [ ] Xbox Series X|S controller 17 | - [ ] Other: 18 | 19 | ### Connection mode 20 | 21 | - [ ] Bluetooth connection 22 | - [ ] USB cable (not yet supported) 23 | - [ ] Xbox Dongle connection (not yet supported) 24 | 25 | ## Describe your feature request 26 | 27 | - [ ] I'd like to see support for a specific model 28 | - [ ] I'd like to see support for a specific hardware feature 29 | - [ ] I'd like to see support for a specific software feature 30 | 31 | **Is your feature request related to a problem? Please describe.** 32 | 34 | 35 | **Describe the solution you'd like** 36 | 37 | 38 | **Describe alternatives you've considered** 39 | 41 | 42 | **Additional context** 43 | 44 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | name: Mark stale issues and pull requests 7 | 8 | on: 9 | schedule: 10 | - cron: '20 4 * * *' 11 | 12 | jobs: 13 | stale: 14 | 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write 18 | pull-requests: write 19 | 20 | steps: 21 | - uses: actions/stale@v5 22 | with: 23 | repo-token: ${{ secrets.GITHUB_TOKEN }} 24 | days-before-stale: -1 25 | stale-issue-message: 'This issue appears to be stale. We will automatically close it within 30 days of no more activity recorded.' 26 | stale-pr-message: 'This pull request appear to be stale. We will automatically close it within 60 days of no more activity recorded.' 27 | stale-issue-label: '1 | state: waiting for reporter feedback' 28 | stale-pr-label: '1 | state: waiting for reporter feedback' 29 | days-before-close: 60 30 | days-before-issue-close: 30 31 | close-issue-message: > 32 | This issue has been automatically closed because there has been no response 33 | to our request for more information from the original author. With only the 34 | information that is currently in the issue, we don't have enough information 35 | to take action. Please reach out if you have or find the answers we need so 36 | that we can investigate further. 37 | close-pr-message: > 38 | This pull request has been automatically closed because there has been no 39 | activity from the original author. Please reach out if you have or find the 40 | answers we need so that we can investigate further. 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .vscode 3 | /misc/examples/**/*.o 4 | /misc/examples/c_directional_rumble_test/direction_rumble_test 5 | /misc/examples/c_hidraw/hidraw 6 | docs/_site/** 7 | docs/Gemfile.lock 8 | hid-xpadneo/**/*.mod* 9 | hid-xpadneo/**/*.o* 10 | hid-xpadneo/dkms.conf 11 | hid-xpadneo/src/*.ko* 12 | hid-xpadneo/src/*.symvers* 13 | 14 | #FIXME(kakra) remove after source file split 15 | hid-xpadneo/src/xpadneo.c 16 | -------------------------------------------------------------------------------- /.indent.pro: -------------------------------------------------------------------------------- 1 | -npro -kr -i8 -ts8 -sob -l100 -ss -ncs -cp1 2 | -il0 3 | -npsl 4 | -T__s32 5 | -Ts32 6 | -Tu16 7 | -Tu32 8 | -Tu8 9 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | external-sources=true 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ETC_PREFIX ?= /etc 2 | DOC_PREFIX ?= /usr/share/doc/xpadneo 3 | 4 | MODPROBE_CONFS := xpadneo.conf 5 | UDEV_RULES := 60-xpadneo.rules 70-xpadneo-disable-hidraw.rules 6 | DOC_SRCS := NEWS.md $(wildcard docs/[0-9A-Z]*.md) 7 | DOCS := $(notdir $(DOC_SRCS)) 8 | 9 | ifeq ($(PREFIX),) 10 | DKMS ?= dkms 11 | else 12 | $(warning Installing to prefix, dkms commands will not be run!) 13 | DKMS ?= : SKIPPING dkms 14 | endif 15 | 16 | all: build 17 | 18 | help: 19 | @echo "Targets:" 20 | @echo "help This help" 21 | @echo "build Prepare the package for DKMS deployment" 22 | @echo "install Install the package, documentation and DKMS source code" 23 | @echo "uninstall Uninstall the package, documentation and DKMS source code" 24 | @echo 25 | @echo "Variables:" 26 | @echo "PREFIX Install files into this prefix" 27 | @echo "DOC_PREFIX Install doc files relative to the prefix (defaults to /usr/share/doc/xpadneo)" 28 | @echo "ETC_PREFIX Install etc files relative to the prefix (defaults to /etc)" 29 | @echo 30 | @echo "Using PREFIX requires handling dkms commands in your package script." 31 | 32 | .PHONY: build install 33 | 34 | .INTERMEDIATE: VERSION 35 | 36 | VERSION: 37 | { [ -n "$(VERSION)" ] && echo $(VERSION) || git describe --tags --dirty; } >$@ 38 | 39 | build: VERSION 40 | $(MAKE) VERSION="$(shell cat VERSION)" -C hid-xpadneo dkms.conf 41 | 42 | install: build 43 | mkdir -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(PREFIX)$(DOC_PREFIX) 44 | install -D -m 0644 -t $(PREFIX)$(ETC_PREFIX)/modprobe.d $(MODPROBE_CONFS:%=hid-xpadneo/etc-modprobe.d/%) 45 | install -D -m 0644 -t $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(UDEV_RULES:%=hid-xpadneo/etc-udev-rules.d/%) 46 | install -D -m 0644 -t $(PREFIX)$(DOC_PREFIX) $(DOC_SRCS) 47 | $(DKMS) add hid-xpadneo 48 | 49 | uninstall: VERSION 50 | $(DKMS) remove "hid-xpadneo/$(shell cat VERSION)" --all 51 | rm -Rf "$(PREFIX)/usr/src/hid-xpadneo-$(shell cat VERSION)" 52 | rm -f $(DOCS:%=$(PREFIX)$(DOC_PREFIX)/%) 53 | rm -f $(UDEV_RULES:%=$(PREFIX)$(ETC_PREFIX)/udev/rules.d/%) 54 | rm -f $(MODPROBE_CONFS:%=$(PREFIX)$(ETC_PREFIX)/modprobe.d/%) 55 | rmdir --ignore-fail-on-non-empty -p $(PREFIX)$(ETC_PREFIX)/modprobe.d $(PREFIX)$(ETC_PREFIX)/udev/rules.d $(PREFIX)$(DOC_PREFIX) 56 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # Changes since v0.8 up to v0.9 2 | 3 | *Quote of the day:* 4 | > Good News, Everyone! 5 | 6 | Much hard work of several weeks has gone into this release, so there's a big 7 | reason to say thanks to all contributors, be it testing, suggestions, bug 8 | reporting, or - of course - programming. 9 | 10 | First of all, Michael Schmitt donated an Xbox Elite 2 controller, so we now 11 | have full support for basic functionality of this controller, with support for 12 | the advanced features coming in the v0.10 version of the driver. This builds 13 | upon contributions done in the previous version of the driver. 14 | 15 | Additionally, Ben Schattinger contributed support for the new Xbox Series X|S 16 | controllers that were released by Microsoft with their new console generation. 17 | Support for the new share button is still not finalized but it will generate a 18 | key code. This new controller uses BLE (Bluetooth low energy) to connect to PC, 19 | so you need a Bluetooth dongle that supports that features (most should do). 20 | 21 | Both of you, Michael and Ben, qualified for the quote of the day. You guys 22 | rock. 23 | 24 | Also, some donations were provided by several people via Ko-fi. Thanks for 25 | that, it's really appreciated. You guys are awesome! 26 | 27 | Let's not forget all the people who contributed to the project patiently 28 | providing feedback, bug reports, and testing, or even just a "thank you": This 29 | release is our "thank you" back to the community. 30 | 31 | Finally, we've got a logo now. 32 | 33 | Here the gist of what the new version delivers: 34 | 35 | - Discord community (shared with xow, ask to join your project) 36 | - Code generation assertions 37 | - Start of code-redesign for splitting the driver core 38 | - Start of profile support (not implemented yet) 39 | - Dropped old debug mode 40 | - Better compliance with the Linux Gamepad specification 41 | - Improved driver documentation 42 | - Improved hardware documentation 43 | - Improved hardware support 44 | - Improved quirks handler to more easily handle hardware quirks 45 | - Improved HID handler performance 46 | - Improved dmesg logging 47 | - Improved DKMS installer 48 | - Improved rumble timing and precision 49 | - Improved rumble damping setting 50 | - Improved continuous integration testing 51 | - Added support for new hardware-level device functions 52 | - Added high-precision mode for the thumb sticks 53 | - Added option for disabling dead-zones for better Proton support 54 | 55 | Many of the bug fixes have been backported to the v0.8 branch which has now 56 | received its end of life. If you're having problems with the new features, 57 | please report that and use the v0.8 branch until that specific bug is fixed. 58 | 59 | 60 | ## Known Problems 61 | 62 | The Bluetooth stability of the Xbox controllers is still a known issue which we 63 | probably can't fix in the driver. Some work-arounds are in place but that's not 64 | a 100% guarantee. Some of these problems can even be observed when using the 65 | controller with Windows. All the problems seem to mostly focus around using 66 | rumble, so you may need to disable rumble. 67 | 68 | The other class of problems is connecting/pairing the controller properly. This 69 | seems to be a Linux kernel issue or a Bluez daemon issue, or a combination of 70 | both. Usually, Windows doesn't show any problems here. Apparently, we cannot 71 | fix this in the driver. You may want to report this to the kernel or Bluez 72 | developers. 73 | 74 | Always use the controller updated to its latest firmware before trying other 75 | steps: Microsoft fixed some connection problems, and also HID implementation 76 | details in the past with firmware updates. 77 | 78 | 79 | ## Breaking Changes 80 | 81 | This release fixes button mappings for 8BitDo controllers to actually match 82 | their names on the controller instead of matching positions with original Xbox 83 | controllers. The X,Y and A,B buttons will be swapped compared to previous 84 | versions. 85 | 86 | This change is controversial but let me tell you that we are going to work on 87 | changes that let you easily choose and switch behavior in v0.10. 88 | 89 | The module parameter `debug_level` has been dropped. Some other parameters 90 | have been dropped in favor of better replacements. Please reconfigure your 91 | parameters and settings. 92 | 93 | 94 | ## The Future 95 | 96 | The new controllers provide some new functionality at the hardware level which 97 | we are going to try to emulate at the driver level for older generation 98 | controllers. The prominent example for this is mapping profiles support: Until 99 | we figured out how this is implemented in hardware for the Xbox Elite 2 100 | controller, we won't implement any emulation support in the driver. This is 101 | because we want to end up with an emulation that is 100% compatible with the 102 | hardware implementation, and not end up with some customization functions that 103 | needs emulation for the Xbox Elite 2 controller. 104 | 105 | We are also going to split the driver into components to easily add support for 106 | USB or GIP dongle connections, with USB probably coming first because the GIP 107 | dongle still has licensing issues for using its firmware. 108 | 109 | 110 | ## Headlines: 111 | 112 | - hid-xpadneo, quirks: We need to carry a quirk for Linux button mappings 113 | - hid-xpadneo, rumble: Migrate damping to generic attenuation parameter 114 | - installer: Change to base directory first 115 | - xpadneo, deadzones: Implement a high-precision mode without dead zones 116 | - xpadneo, udev: Work around libinput using the controller as touchpad 117 | 118 | ``` 119 | Kai Krakow (78): 120 | hid-xpadneo: Drop `debug_level` 121 | hid-xpadneo, quirks: Pass quirks from driver data 122 | udev: Expose all xpadneo input devices as user-readable 123 | hid-xpadneo, profiles: Prepares profile switching for customization 124 | Update bug_report.md 125 | docs, news: Document breaking changes. 126 | hid-xpadneo, rumble: Migrate damping to generic attenuation parameter 127 | xpadneo, udev: Work around libinput using the controller as touchpad 128 | hid-xpadneo: Tell the user which controller connected 129 | hid-xpadneo, quirks: Fix a typo 130 | hid-xpadneo, quirks: Expand flags to 32 bit 131 | hid-xpadneo, quirks: We need to carry a quirk for Linux button mappings 132 | xpadneo, quirks: Add Nintendo mappings quirk for 8BitDo controllers 133 | docs: Fix a syntax problem in SDL link 134 | xpadneo, deadzones: Use smaller dead zone and fuzz for precision 135 | xpadneo, deadzones: Implement a high-precision mode without dead zones 136 | docs: Document another storage location for SDL gamepad mappings 137 | docs: Document SDL HIDAPI breakage 138 | hid-xpadneo, init: Ignore HID_CONNECT_FF 139 | hid-xpadneo, quirks: Convert to proper bit values 140 | hid-xpadneo: Update copyright 141 | configure, cleanup: Remove the tedious whitespace 142 | xpadneo, cleanup: Fix missing newline at end of file 143 | hid-xpadneo, cleanup: Remove some more comments 144 | hid-xpadneo: Replace `combined_z_axis` with additional axis 145 | hid-xpadneo: Stop spamming the HID layer with repeated reports 146 | Revert "hid-xpadneo, quirks: Convert to proper bit values" 147 | hid-xpadneo, timing: Use clamp() instead min()/max() 148 | hid-xpadneo, rumble: Tighten the rumble timing 149 | hid-xpadneo: Fix potentially loosing input packets for XBE2 controllers 150 | docs: Add Repology badge 151 | docs: Mention MissionControl sibling project 152 | docs: Cleanup some whitespace 153 | docs: Add xpadneo logo 154 | docs: Add Discord badge 155 | installer: Drop VERSION tag file from master branch 156 | installer: Fix white space 157 | installer, dkms: Prevent showing readlink errors 158 | installer: Add verbose mode 159 | installer: Exit on unexpected errors 160 | installer, dkms: Skip ERTM if setting is not writable 161 | tests: Add verbose mode to Azure Pipeline 162 | tests: Also test uninstallation in Azure Pipeline 163 | tests: Dump make.log to stdout on verbose DKMS error 164 | tests: Run Azure Pipeline on multiple Ubuntu LTS versions 165 | hid-xpadneo: Ignore trigger scale switches 166 | hid-xpadneo, profiles: Log to kernel starting with lower-case 167 | hid-xpadneo, rumble: Remove useless use of max() 168 | hid-xpadneo: Optimize delay_work clamping 169 | hid-xpadneo, rumble: Use proper integer rounding in calculations 170 | hid-xpadneo, rumble: Limit command duration 171 | hid-xpadneo: Fix kernel coding standards 172 | docs: Remove bogus blank line 173 | docs: Do not misuse back-ticks 174 | docs: Document broken packet format of XBE2 v1 175 | hid-xpadneo: Handle XBE2 v2 packet format 176 | hid-xpadneo: Add XBE2 trigger scale setting 177 | docs: Fix collaboration referral 178 | docs: Fix a typo 179 | hid-xpadneo: Reserve another bit for the new XBXS share button 180 | hid-xpadneo: Document XBXS modes and PIDs 181 | docs: Document XBXS controller support in the README 182 | docs: Restructure text about profile support 183 | docs: Add BLE note for the XBXS controller 184 | docs: Move profile switching section 185 | hid-xpadneo: Make assertions of hardware buffer sizes 186 | hid-xpadneo: Make rumble motor bits a full enum type 187 | installer: Move version information to separate include file 188 | installer: Remove excessive blank lines 189 | installer: "INSTALLED" is an array 190 | configure: Use braces around variables 191 | installer: Change to base directory first 192 | hid-xpadneo: Alias the Share button 193 | hid-xpadneo: Fix a comment about rumble timing 194 | hid-xpadneo: Improve PID documentation 195 | docs: Document Bluetooth low energy requirements 196 | installer: Also fix the updater 197 | hid-xpadneo: Move headers to separate file 198 | 199 | Ben Schattinger (2): 200 | docs: Document Xbox Series X/S controller 201 | hid-xpadneo: Add Xbox Series X / S controller support 202 | ``` 203 | 204 | 205 | # Changes since v0.7 up to v0.8 206 | 207 | *Quote of the day:* 208 | > HID me baby, one more time! 209 | 210 | Much hard work of several weeks has gone into this release, so there's a big 211 | reason to say thanks to all contributors, be it testing, suggestions, bug 212 | reporting, or - of course - programming. 213 | 214 | Many thanks @medusalix for finally figuring out the underlying problems of 215 | the disconnect behavior of the controller during rumble events: After some 216 | internal discussion, we managed to find a race condition in the controller 217 | firmware and worked around it by throttling the rumble reprogramming to 218 | intervals of at least 10ms as this is what the controllers seems to accept 219 | as the minimal interval without freaking out. As a "thank you", I contributed 220 | a logically identical patch to the [xow](https://github.com/medusalix/xow) 221 | project which has not been merged yet, tho. Check it out - it supports the 222 | native dongle that comes with the controller! 223 | 224 | Also, let's all say "thank you" to @ehats for contributing the Xbox Elite 2 225 | series controller support. He started from zero to mastering the HID 226 | internals in just a few days with just a little help from me. I'm sure, a 227 | vast amount of effort, a steep learning curve, and a lot of endurance and 228 | probably also one beer or another went into this work. Leave him some kudos 229 | for this awesome contribution, and expect more to follow. His work builds 230 | the base for adding profile support and customization into the next xpadneo 231 | version. He qualified for the quote of the day above. 232 | 233 | A handful patches have been contributed which fix some smaller bugs: 234 | 235 | - Thanks to Adam Becker for adding some bug and style fixes. 236 | - Lars-Sören Steck fixed a scripting bug, thank you. 237 | - Manjaro users now see instructions for their favorite distribution, 238 | thanks to @snpefk. 239 | 240 | Let's not forget our testers, who have patiently been with us during the 241 | development of this milestone: We appreciate your work, patience, and 242 | contributions. 243 | 244 | Many of the bug fixes have been backported to the v0.7 branch which has now 245 | received its end of life. If you're having problems with the new features, 246 | please report that and use the v0.7 branch until that specific bug is fixed. 247 | 248 | 249 | ## Breaking Changes 250 | 251 | This version removed some module parameters with only partial replacement. 252 | One of those if `disable_ff` which can no longer be used. Instead, there's 253 | a new parameter `trigger_rumble_mode` which can disable trigger rumble 254 | only. The next update will include a new parameter to set rumble attenuation 255 | to 100% which translates to no rumble at all. 256 | 257 | 258 | ## Headlines: 259 | 260 | - dmks, installer: Move etc sources one level up 261 | - docs, mapping: Document and explain `joydev` mapping 262 | - hid-xpadneo: Adhere to Linux Gamepad Specification 263 | - hid-xpadneo, battery: Rework detection, parsing and reporting 264 | - hid-xpadneo, compat: Fix compilation on kernel 4.19 265 | - hid_xpadneo, quirks: Add "8BitDo SN30 Pro+" 266 | - hid-xpadneo, rumble: Throttle reprogramming of rumble motors 267 | - installer: Parse DKMS version info correctly 268 | - installer: Use awk in non-GNU mode 269 | 270 | ``` 271 | Kai Krakow (70): 272 | configure: `fake_dev_version` no longer exists 273 | configure: `trigger_rumble_damping` should no longer default to 4 274 | configure: Choose a single or default config file only 275 | configure: Create missing directories and files on demand 276 | configure: Silence superfluous error messages 277 | dkms, install: Do not apply inline version patching 278 | dkms, installer: Fix early exit if `git-rev-parse` does not work 279 | dkms, installer: Fix version parsing 280 | dkms, udev: Eliminate bash scripting from udev rules 281 | dkms, uninstall: Fix early exit if `modprobe -r` does not work 282 | dkms, update: Suggest a download URL actually matching the version 283 | dkms: Use cmdline format which requires less escaping 284 | dmks, installer: Move etc sources one level up 285 | docs, chipsets: Update chipset compatibility reports 286 | docs, cleanup: Fix typos 287 | docs, cleanup: Fix white-space and new-lines 288 | docs, cleanup: Fix whitespace 289 | docs, cleanup: Remove outdated debug documentation 290 | docs, cleanup: Visual tweaks 291 | docs, formatting: Migrate to proper headlines 292 | docs, mapping: Document and explain `joydev` mapping 293 | docs: Document 8BitDo SN30 Pro+ controller 294 | docs: Improve the debugging instructions 295 | docs: Mention other projects 296 | docs: Update documentation with rumble modes 297 | docs: xpadneo is no longer the only driver 298 | hid-xpadneo, battery: Protect concurrent access with spin locks 299 | hid-xpadneo, battery: Rework detection, parsing and reporting 300 | hid-xpadneo, cleanup: Reorder includes 301 | hid-xpadneo, cleanup: Simplify mapping code 302 | hid-xpadneo, comments: Fix wording 303 | hid-xpadneo, compat: Fix compilation on kernel 4.19 304 | hid-xpadneo, events: Do not send Xbox logo event for turn-off 305 | hid-xpadneo, formatting: Kernel allows 100 chars line length now 306 | hid-xpadneo, Makefile: Accept `rmmod` failing 307 | hid-xpadneo, patching: Only show version patching if changed 308 | hid-xpadneo, rumble: Protect concurrent access with spin locks 309 | hid-xpadneo, rumble: Throttle reprogramming of rumble motors 310 | hid-xpadneo: Adhere to Linux Gamepad Specification 311 | hid-xpadneo: parameter `combined_z_axis` cannot be changed at runtime 312 | hid-xpadneo: Separate private and foreign includes 313 | hid_xpadneo, cleanup: Use symbols instead of numbers in mapping phase 314 | hid_xpadneo, probe: Fix newline in error path 315 | hid_xpadneo, quirks: Add "8BitDo SN30 Pro+" 316 | hid_xpadneo, quirks: Migrate 8BitDo quirks to OUI match 317 | hid_xpadneo, rumble: Optimize motor reprogramming 318 | hid_xpadneo, style: Fix indentation 319 | hid_xpadneo: Add quirk modes for misbehaving controllers 320 | hid_xpadneo: New trigger rumble modes 321 | hidxpad-neo, cleanup: Fix a comment style 322 | installer, cleanup: Remove superfluous whitespace 323 | installer: Add support for disabling ERTM override 324 | installer: Compare latest version correctly 325 | installer: Fix non-git version lookup 326 | installer: Get latest version from the releases page 327 | installer: Parse DKMS version info correctly 328 | installer: Print some version information in update instructions 329 | installer: Trim whitespace from online version numbers 330 | installer: Try to fetch the current version from git tags 331 | installer: Use awk in non-GNU mode 332 | meta: Ignore vscode metadata completely 333 | meta: Sort gitignore 334 | misc: Add hidraw test program 335 | Update bug_report.md 336 | Update bug_report.md 337 | Update bug_report.md 338 | Update bug_report.md 339 | Update bug_report.md 340 | Update README.md 341 | xpadneo, event: Remove symbols 342 | 343 | Adam Becker (6): 344 | Fix bug where 2 would map to unknown PS type instead of battery. 345 | Fixing formatting issues 346 | Don't use common return point if no resources are freed 347 | Formatting parameter sections 348 | Add parameter section for toggling the FF connect notification 349 | Rename 'xpadneo_mapping' to match other names 350 | 351 | Erik Hajnal (1): 352 | Add support for XBE2 (Unknown mode) 353 | 354 | Lars-Sören Steck (1): 355 | Fix error "[: unexpected operator" 356 | 357 | snpefk (1): 358 | Add install instruction for Manjaro 359 | ``` 360 | 361 | # Changes since v0.6 up to v0.7 362 | 363 | Major code overhaul and redesign. It optimizes the controller 364 | communication path, adds support for more hardware and uses 365 | HID table fixups now instead of trying to code for every 366 | broken mapping variant. 367 | 368 | ## Headlines: 369 | 370 | - fix direction_rumble_test path error (#168) 371 | - hid-xpadneo: Convert mapping to using tables instead of code 372 | - Pretend we are in Windows wireless mode 373 | 374 | ``` 375 | Kai Krakow (21): 376 | Add support von non-DKMS build 377 | Follow the kernel code style better 378 | hid-xpadneo: Prevent accidental fall-through 379 | hid-xpadneo: Scale rumble magnitudes correctly 380 | hid-xpadneo, cleanup: Remove setting default axis values 381 | hid-xpadneo, cleanup: Outsource welcome rumble 382 | hid-xpadneo, cleanup: Cleanup `xpadneo_initBatt()` a little 383 | hid-xpadneo: Fix usage of report ID in `xpadneo_raw_event()` hook 384 | hid-xpadneo: Use work queue for rumble effects 385 | hid-xpadneo: Use work queue for battery events 386 | docs: Add some controller documentation 387 | Pretend we are in Windows wireless mode 388 | Revert "shift axis values to the left" 389 | hid-xpadneo: Convert mapping to using tables instead of code 390 | hid-xpadneo: Clean up 391 | hid-xpadneo: Do not repeat rumble packets 392 | hid-xpadneo: Rework the directional rumble model 393 | hid-xpadneo, cleanup: Clean up combined z-axis feature 394 | hid-xpadneo: Pretend different firmware for PID 0x02E0 395 | hid-xpadneo: Autodetect battery presence after connect 396 | hid-xpadneo, cleanup: Remove most of the remaining debug cruft 397 | 398 | Dugan Chen (1): 399 | Add Support For Xbox Elite Series 2 Wireless 400 | 401 | Florian Dollinger (1): 402 | Create no-response.yml 403 | 404 | Srauni (1): 405 | fix direction_rumble_test path error (#168) 406 | ``` 407 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # C/C++ with GCC 2 | # Build your C/C++ project with GCC using make. 3 | # Add steps that publish test results, save build artifacts, deploy, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc 5 | 6 | trigger: 7 | - master 8 | 9 | strategy: 10 | matrix: 11 | Ubuntu 20.04 LTS: 12 | imageName: 'ubuntu-20.04' 13 | Ubuntu 22.04 LTS: 14 | imageName: 'ubuntu-22.04' 15 | Ubuntu 24.04 LTS: 16 | imageName: 'ubuntu-24.04' 17 | 18 | pool: 19 | vmImage: $(imageName) 20 | 21 | steps: 22 | - script: | 23 | sudo apt-get update 24 | sudo apt-get install -y build-essential pkg-config linux-headers-`uname -r` 25 | displayName: 'setup' 26 | - script: | 27 | sudo apt-get install -y dkms 28 | sudo ./install.sh --verbose 29 | displayName: 'install' 30 | - script: | 31 | sudo apt-get install -y dkms 32 | sudo ./uninstall.sh --verbose 33 | displayName: 'uninstall' 34 | - script: | 35 | sudo make install 36 | sudo dkms autoinstall 37 | displayName: 'autoinstall' 38 | - script: | 39 | sudo apt-get install -y libncurses-dev 40 | make -C misc/examples/c_hidraw 41 | displayName: 'misc' 42 | -------------------------------------------------------------------------------- /configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Written by CodeCanna, refined by atar-axis 3 | 4 | cd "$(dirname "$0")" || exit 1 5 | 6 | set -o posix 7 | 8 | NAME="$0" 9 | 10 | # Define Variables 11 | MODULE="/sys/module/hid_xpadneo/" 12 | PARAMS="/sys/module/hid_xpadneo/parameters" 13 | CONF_FILE=$(grep -sl '^options hid_xpadneo' /etc/modprobe.d/*.conf | tail -1) 14 | : "${CONF_FILE:="/etc/modprobe.d/99-xpadneo-options.conf"}" 15 | 16 | # Use getopt NOT getopts to parse arguments. 17 | OPTS=$(getopt -n "$NAME" -o h:m:r:n: -l help,version,trigger-rumble-mode:,rumble-attenuation:,ff_connect_notify: -- "$@") 18 | 19 | ## Print Help ## 20 | function display_help { 21 | cat ./docs/config_help 22 | } 23 | 24 | ## Parameter Validation ## 25 | function check_param { 26 | key=$1 27 | value=$2 28 | 29 | case $key in 30 | "trigger_rumble_mode") 31 | if [[ "$value" -gt 2 ]] || [[ "$value" -lt 0 ]]; 32 | then 33 | echo "$NAME: $key: Invalid value! Value must be between 0 and 2." 34 | exit 1 35 | fi 36 | ;; 37 | "rumble_attenuation") 38 | if [[ "$value" -gt 100 ]] || [[ "$value" -lt 0 ]]; 39 | then 40 | echo "$NAME: $key: Invalid value! Value must be between 0 and 100." 41 | exit 1 42 | fi 43 | ;; 44 | "ff_connect_notify") 45 | if [[ "$value" -gt 2 ]] || [[ "$value" -lt 0 ]]; 46 | then 47 | echo "$NAME: $key: Invalid value! Value must be 0 or 1." 48 | exit 1 49 | fi 50 | ;; 51 | 52 | *) 53 | # key not known, should not be possible 54 | exit 2 55 | ;; 56 | esac 57 | } 58 | 59 | ## Parameter Setting Helpers ## 60 | function set_modprobe_param { 61 | sed -i "/^[[:space:]]*options[[:space:]]\+hid_xpadneo/s/$1=[^[:space:]]*/$1=$2/g" "$CONF_FILE" 62 | } 63 | 64 | function set_sysfs_param { 65 | echo "$2" > "$PARAMS/$1" 66 | } 67 | 68 | 69 | ## Parameter Setting ## 70 | function set_param { 71 | 72 | key=$1 73 | value=$2 74 | 75 | # check for valid parameters first 76 | check_param "$key" "$value" 77 | 78 | # edit sysfs parameter if module is inserted 79 | if [[ -d "$MODULE" ]]; 80 | then 81 | echo "$NAME: Module inserted - writing to $PARAMS" 82 | if ! set_sysfs_param "$key" "$value"; 83 | then 84 | echo "$NAME: ERROR! Could not write to $PARAMS!" 85 | exit 1 86 | fi 87 | fi 88 | 89 | # edit modprobe config file 90 | if ! set_modprobe_param "$key" "$value"; 91 | then 92 | echo "$NAME: ERROR! Could not write to $CONF_FILE!" 93 | exit 1 94 | fi 95 | echo "$NAME: $key: parameter written to $CONF_FILE" 96 | 97 | } 98 | 99 | ## Argument Parsing ## 100 | function parse_args { 101 | if [[ $1 == "" ]]; 102 | then 103 | display_help 104 | exit 1 105 | fi 106 | 107 | if ! grep -sq 'options hid_xpadneo' "${CONF_FILE}"; 108 | then 109 | # If line doesn't exist echo all of the defaults. 110 | mkdir -p "$(dirname "${CONF_FILE}")" 111 | touch "${CONF_FILE}" 112 | echo "options hid_xpadneo disable_deadzones=0 rumble_attenuation=0 trigger_rumble_mode=0 ff_connect_notify=1" >> "$CONF_FILE" 113 | fi 114 | 115 | eval set -- "$OPTS" 116 | 117 | while true; 118 | do 119 | case "$1" in 120 | -h | --help) 121 | display_help 122 | shift 123 | ;; 124 | 125 | -m | --trigger-rumble-mode) 126 | key='trigger_rumble_mode' 127 | value="${2#*=}" 128 | set_param "$key" "$value" 129 | shift 2 130 | ;; 131 | 132 | -r | --rumble-attenuation) 133 | key='rumble_attenuation' 134 | value="${2#*=}" 135 | set_param "$key" "$value" 136 | shift 2 137 | ;; 138 | 139 | -n | --ff_connect_notify) 140 | key='ff_connect_notify' 141 | value="${2#*=}" 142 | set_param "$key" "$value" 143 | shift 2 144 | ;; 145 | 146 | --) 147 | shift 148 | break 149 | ;; 150 | 151 | *) 152 | echo "$NAME: Invalid option" 153 | display_help 154 | exit 1 155 | ;; 156 | esac 157 | done 158 | } 159 | 160 | 161 | ### Main Entry Point ### 162 | 163 | PARAMETERS=( "$@" ) 164 | 165 | parse_args "${PARAMETERS[@]}" 166 | 167 | # Check if xpadneo is installed 168 | if lsmod | grep -vq 'hid-xpadneo'; 169 | then 170 | >&2 echo -e "$0: WARNING: hid-xpadneo not loaded, configured anyways" 171 | fi 172 | -------------------------------------------------------------------------------- /docs/3P-BUGS.md: -------------------------------------------------------------------------------- 1 | ## Third Party Bugs 2 | 3 | While developing this driver we recognized some bugs in KDE and linux itself, 4 | some of which are fixed now - others are not: 5 | 6 | * Broken Battery Indicator in KDE 7 | fixed! 8 | * Cambridge Silicon Radio (CSR) chip sets do have problems while reconnecting (OUI 00:1A:7D) 9 | * Most of these problems may be fixed in kernel 5.10 10 | * Qualcomm chip sets may have performance and lag problems (OUI 9C:B6:D0) 11 | * Some Bluetooth dongles may need additional firmware for proper operation 12 | * Possible solution: try installing `linux-firmware` from your distribution 13 | -------------------------------------------------------------------------------- /docs/BT_DONGLES.md: -------------------------------------------------------------------------------- 1 | ## BT Dongles 2 | 3 | Please report your Dongles and how they work [here](https://github.com/atar-axis/xpadneo/issues/93) 4 | 5 | 6 | ## Bluetooth Low Energy 7 | 8 | Some newer controller may work in Bluetooth low energy mode (BLE). One of 9 | those controllers is the XBOX Series X|S controller. 10 | 11 | If your distribution supports the command, run `btmgmt info` and look for 12 | `le` in supported and current settings, example: 13 | ``` 14 | # btmgmt info 15 | Index list with 1 item 16 | hci0: Primary controller 17 | addr 00:1A:7D:XX:XX:XX version 6 manufacturer 10 class 0x100104 18 | supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr hs le advertising secure-conn debug-keys privacy static-addr phy-configuration 19 | current settings: powered ssp br/edr le secure-conn 20 | name jupiter 21 | short name 22 | ``` 23 | If `btmgmt` command is not available, try `bluetoothctl mgmt.info` instead. 24 | 25 | 26 | ### Cambridge Silicon Radio 27 | 28 | * [Panda Bluetooth 4.0 USB Nano Adapter](https://www.amazon.com/gp/product/B00BCU4TZE/) 29 | * Chip set: CSR ??? 30 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 31 | * Performance: 32 | * Re-Connection Problems 33 | * Reliable once connected 34 | * Reported by @ugly95 [here](https://github.com/atar-axis/xpadneo/issues/76#issuecomment-462532230) 35 | * [MIATONE Bluetooth Adapter Bluetooth CSR 4.0](https://www.amazon.com/gp/product/B00M1ATR4C/) 36 | * Chip set: CSR 8510 37 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 38 | * Performance: 39 | * Re-Connection Problems 40 | * Reliable once connected 41 | * Reported by @ugly95 [here](https://github.com/atar-axis/xpadneo/issues/76#issuecomment-462532230) 42 | * [CSL - Bluetooth 4.0 USB Adapter](https://www.amazon.de/dp/B01N0368AY) 43 | * Chip set: CSR 8510 A10 44 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 45 | * Performance: 46 | * Re-Connection Problems 47 | * Initial Connection Problems 48 | * Reported by @germangoergs [here](https://github.com/atar-axis/xpadneo/issues/91) and [here](https://github.com/atar-axis/xpadneo/issues/93#issuecomment-480997846) 49 | * [Sabrent USB Bluetooth 4.0 Micro Adapter for PC](https://www.amazon.com/gp/product/B06XHY5VXF/) 50 | * Chip set CSR ??? 51 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 52 | * Performance: 53 | * Re-Connection Problems 54 | * Reliable once connected 55 | * Reported by @ugly95 [here](https://github.com/atar-axis/xpadneo/issues/93#issuecomment-481065171) 56 | * [Yizhet USB nano Bluetooth 4.0 Adapter](https://www.amazon.de/gp/product/B01LR8CNXU/) 57 | * Chip set CSR 8510 A10 58 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 59 | * Performance: 60 | * Re-Connection Problems 61 | * Reliable once connected 62 | * Reported by @NoXPhasma [here](https://github.com/atar-axis/xpadneo/issues/91#issuecomment-484815264) 63 | * [TP-Link USB Bluetooth Adapter Bluetooth 4.0 (UB400)](https://www.amazon.com/gp/product/B07V1SZCY6) 64 | * Chip set: CSR ??? 65 | * `ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)` 66 | * Performance: 67 | * Connection is flawless 68 | * Reported by @Arian8j2 [here](https://github.com/atar-axis/xpadneo/issues/389#issuecomment-1677012088) 69 | 70 | 71 | ### Broadcom 72 | 73 | * [Pluggable USB Bluetooth 4.0 Low Energy Micro Adapter](https://www.amazon.com/Plugable-Bluetooth-Adapter-Raspberry-Compatible/dp/B009ZIILLI/) 74 | * Chip set: BCM20702A0 75 | * `ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0` 76 | * Performance: 77 | * Connection flawless 78 | * Sometimes laggy in games 79 | * Reported by @ugly95 [here](https://github.com/atar-axis/xpadneo/issues/93#issuecomment-481065171) and [here](https://github.com/atar-axis/xpadneo/issues/76#issuecomment-464397584) 80 | * [Targus BT 4.0 USB adapter](https://www.targus.com/au/acb75au) 81 | * Chip set: BCM20702A0 82 | * `ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0` 83 | * Performance: 84 | * Connection flawless 85 | * Sometimes laggy in games 86 | * Reported by @Zowayix [here](https://github.com/atar-axis/xpadneo/issues/93#issuecomment-487280791) 87 | 88 | 89 | ### Qualcomm 90 | 91 | * Unspecified model (): 92 | * `btmon` logs showed very low input report rate and high input lag (300ms+) 93 | 94 | 95 | ### Intel 96 | 97 | * Status: incompatible () 98 | * OUI: DC:1B:A1 (Intel) 99 | * Used as on-board chip set: Gigabyte B450 AORUS Pro WiFi 1.0 with integrated Bluetooth 100 | * Status: bluetoothd logs "Request attribute has encountered an unlikely error" 101 | * Chip set: AX200 102 | * Used as on-board chip set: ASUS B550-i 103 | 104 | 105 | ### Realtek 106 | 107 | Known bad firmware for RTL8761BU chip set is 0xdfc6d922. It causes frequent 108 | reconnects. Firmware version can be found in the kernel log: 109 | ``` 110 | $ sudo dmesg | grep 'RTL: fw version' 111 | [ 21.193448] Bluetooth: hci0: RTL: fw version 0xdfc6d922 112 | ``` 113 | 114 | * [TP-Link USB Bluetooth Adapter Bluetooth 5.0 (UB500)](https://www.amazon.com/gp/product/B09DMP6T22) 115 | * Chip set: RTL8761BU 116 | * `ID 2357:0604 TP-Link TP-Link UB500 Adapter` 117 | * Performance: 118 | * Disconnects after some random interval and reconnects 119 | * When it's connected, it's good 120 | * Reported by @Arian8j2 [here](https://github.com/atar-axis/xpadneo/issues/389#issuecomment-1677012088) 121 | * [Simplecom NB409 Bluetooth 5.0 USB Wireless Dongle with A2DP EDR](https://www.mwave.com.au/product/simplecom-nb409-bluetooth-50-usb-wireless-dongle-with-a2dp-edr-ac38550) 122 | * Chip set: RTL8761BU 123 | * `ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio` 124 | * Status: it works straight out of the box for a user on Manjaro KDE with kernel 5.15 and 6.1 125 | * Reported by @mscharley [here](https://github.com/atar-axis/xpadneo/issues/406) 126 | * [UGREEN Bluetooth 5.0 USB Adapter (CM390)](https://www.amazon.com/gp/product/B08R8992YC/) 127 | * Chip set: RTL8761BU 128 | * `ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio` 129 | * Performance: 130 | * Connection flawless if good firmware is being used 131 | -------------------------------------------------------------------------------- /docs/CONFIGURATION.md: -------------------------------------------------------------------------------- 1 | ## Configuration 2 | 3 | **Alternatively** to using the config-script, you can also do it by hand: 4 | 5 | The driver can be reconfigured at runtime by accessing the following sysfs 6 | files in `/sys/module/hid_xpadneo/parameters`: 7 | 8 | - `disable_deadzones` (default `0`) 9 | - `0` enables standard behavior to be compatible with `joydev` expectations 10 | - `1` enables raw passthrough of axis values without dead zones for high-precision use with modern Wine/Proton games 11 | - `trigger_rumble_mode` (default `0`) 12 | - `0` rumbles triggers by pressure and current rumble effect 13 | - `1` rumbles triggers by force direction (non-conformant) 14 | - `2` disables trigger rumble 15 | - `rumble_attenuation` (default `0,0`) 16 | - Attenuation the strength of the force feedback 17 | - `0` (none, full rumble) to `100` (max, no rumble) 18 | - If one or two values are given, the first value is the overall attenuation 19 | - If two values are given, the second value applies an extra attenuation to the triggers 20 | - Example 1: `0,100` turns trigger rumble off, `100,0` or `100` turn all rumble off 21 | - Example 2: `50,50` makes 50% rumble overall, and 25% for the triggers (50% of 50% = 25%) 22 | - Example 3: `50` makes 50% rumble overall (main and triggers) 23 | - Trigger-only rumble is not possible 24 | - `quirks` (default empty) 25 | - Let's you adjust the quirk mode of your controller 26 | - Comma separated list of `address:flags` pairs (use `+flags` or `-flags` to change flags instead) 27 | - Specify your controller MAC address in the format `11:22:33:44:55:66` 28 | - Specify the flags as sum of the following: 29 | - `1` if your controller does not support pulse parameters (i.e., 8BitDo controllers) 30 | - `2` if your controller does not support trigger rumble (most clones in compatibility mode) 31 | - `4` if your controller does not support individual motor programming (i.e., 8BitDo controllers) 32 | - `8` if your controller supports hardware profiles (auto-detected, do not set manually) 33 | - `16` if your controller boots in Linux mode (auto-detected, do not change manually) 34 | - `32` if you prefer to use Nintendo button mappings (i.e., 8BitDo controllers, defaults to off) 35 | - `64` if your controller has a awkwardly mapped Share button (auto-detected, do not set manually) 36 | - `128` if your controller uses motor-enable bits in reverse 37 | - `256` if your controller uses motor-enable bits with trigger and main motors swapped 38 | - `512` to avoid having your controller misdetected by heuristics (please report a bug) 39 | - 'disable_shift_mode' (default 0) 40 | - Let's you disable Xbox logo button shift behavior 41 | - '0' Xbox logo button will be used as shift 42 | - '1' will pass through the Xbox logo button as is 43 | 44 | Some settings may need to be changed at loading time of the module, take a look at the following example to see how 45 | that works: 46 | 47 | 48 | ### Example 49 | 50 | To disable trigger rumbling temporarily, run 51 | `echo 2 | sudo tee /sys/module/hid_xpadneo/parameters/trigger_rumble_mode` 52 | 53 | To make the setting permanent and applied at loading time, try 54 | `echo "options hid_xpadneo trigger_rumble_mode=2" | sudo tee /etc/modprobe.d/99-xpadneo-bluetooth.conf` 55 | -------------------------------------------------------------------------------- /docs/DEBUGGING.md: -------------------------------------------------------------------------------- 1 | ## Debugging 2 | 3 | If you are asked to send debug info or want to fix bugs, follow the guide 4 | displayed when [opening a new bug report](https://github.com/atar-axis/xpadneo/issues/new?template=bug_report.md). 5 | This has all the hints to get you started with debugging. You may also want 6 | to increase the kernel debug level if your distribution sets it very low. 7 | Otherwise, the driver reports most incidents, quirks, and fixes to `dmesg`. 8 | 9 | 10 | ### Environment 11 | 12 | Useful information can now be acquired with the commands: 13 | 14 | * `dmesg`: I advise you to run `dmesg -wdH` in a terminal while you connect your controller from a second terminal 15 | to get hardware information in realtime. 16 | * `modinfo hid_xpadneo`: get information on xpadneo as a kernel module. 17 | * When your gamepad is connected, get the HID report descriptor: 18 | 19 | ```bash 20 | xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum) 21 | ``` 22 | 23 | 24 | ### Generated Events 25 | 26 | If you are asked to supply the events generated by xpadneo, please run the following command: 27 | ``` 28 | perl -0777 -l -ne 'print "/dev/input/$1\n" if /Name="Xbox Wireless Controller".*Handlers.*(event[0-9]+)/s' /proc/bus/input/devices | xargs evtest 29 | ``` 30 | 31 | Do whatever you think does not behave correctly (e.g. move the sticks from left to right if you think the range 32 | is wrong) and upload the output. 33 | 34 | 35 | ### HID Device Descriptor (including checksum) 36 | 37 | If we ask you to supply the device descriptor, please post the output of the following command: 38 | ```bash 39 | xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum) 40 | ``` 41 | 42 | 43 | ### Bluetooth Connection 44 | 45 | Some debugging needs a deeper low level look. You can do this by running `btmon`: 46 | ```bash 47 | sudo btmon | tee xpadneo-btmon.txt 48 | ``` 49 | 50 | Then reproduce the problem you are observing. 51 | 52 | We probably also need some information about the dongle: 53 | 54 | * Run `lsusb` and pick the device number of your dongle. 55 | * Run `lsusb -v -s## | tee xpadneo-lsusb.txt` where `##` is the device number picked in the previous step. 56 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages', group: :jekyll_plugins 3 | -------------------------------------------------------------------------------- /docs/PACKAGING.md: -------------------------------------------------------------------------------- 1 | ## Packaging 2 | 3 | From v0.10 on, xpadneo provides a `Makefile` to help package maintainers 4 | avoiding a lot of the duplicate work which was historically done by the 5 | installer script. This also allows for prefixed installation to prepare an 6 | install image before merging the package to the live system. 7 | 8 | Run `make help` for an overview of the options. 9 | 10 | 11 | ### Configuration 12 | 13 | The top-level `Makefile` supports some configuration variables: 14 | 15 | - `PREFIX`: Allows to install the package to a pre-install image which 16 | can be put in an archive for package deployment and file tracking. If 17 | this variable is provided, it will also skip deployment of the DKMS 18 | source tree. This is mainly due to limitations of DKMS handling 19 | prefixed installations properly. Package maintainers have to do this 20 | manually in a post-installation step. 21 | 22 | - `ETC_PREFIX`: Allows to install files to `/usr/lib` which would 23 | normally go to `/etc`. This is applied relative to `PREFIX`. 24 | 25 | **Example:** 26 | ```bash 27 | make PREFIX=/tmp/xpadneo-image ETC_PREFIX=/usr/lib install 28 | ``` 29 | 30 | 31 | ### Installation 32 | 33 | When using the `Makefile`, xpadneo will no longer automatically try to build 34 | the DKMS module. How to handle this in detail is left up to the package 35 | maintainer. If you run `make install` without a `PREFIX` or use an empty 36 | prefix, `make install` will run `dkms add` to add the source code to the 37 | DKMS source tree. No other DKMS action will be taken. 38 | 39 | **Examples:** 40 | ```bash 41 | # Install package files to `/` and deploy the DKMS sources 42 | make install 43 | 44 | # Install package files but deploy the DKMS sources as a separate step 45 | make PREFIX=/ install 46 | dkms add hid-xpadneo 47 | ``` 48 | 49 | Instead of directly building the DKMS module, this allows a package installer 50 | to just provide the source code and install the support files. Building of 51 | the actual module via DKMS is left to the package maintainer. 52 | 53 | Many distributions recommend to install base configuration to `/usr/lib` 54 | instead of `/etc`. The make-based installer supports this by supplying a 55 | `ETC_PREFIX` variable. 56 | 57 | **Example:** 58 | ```bash 59 | # Install package files to `/usr/lib` instead of `/etc` 60 | make ETC_PREFIX=/usr/lib install 61 | 62 | # This can be combined with prefixed installation 63 | make PREFIX=/tmp/xpadneo-image ETC_PREFIX=/usr/lib install 64 | dkms add hid-xpadneo 65 | ``` 66 | 67 | In all these usages, xpadneo will never try to build and install the kernel 68 | module on its own. This step is left up to the package maintainer. 69 | 70 | **Background:** DKMS does not support prefixed installations. If you try to 71 | do so, symlinks will point to the wrong location. DKMS also doesn't support 72 | proper uninstallation: It will remove the kernel module from its build system 73 | but it won't touch the files it copied to `/usr/src` during `dkms add`. 74 | Package maintainers are required to properly handle this according to their 75 | specific distribution. xpadneo won't try to mess with this to prevent errors 76 | in the boot system of the distribution. It cannot know the implementation 77 | details. 78 | 79 | `make PREFIX=...` will warn about this but still show the command which would 80 | be run: 81 | ``` 82 | # make PREFIX=... 83 | Makefile:7: Installing to prefix, dkms commands will not be run! 84 | ... 85 | : SKIPPING dkms add hid-xpadneo 86 | ``` 87 | 88 | Documentation will be installed to `DOC_PREFIX` and follows the same rules as 89 | above. Default location is `/usr/share/doc/xpadneo`. Some distributions may 90 | want to override this with a versioned path. 91 | 92 | 93 | ### Uninstallation 94 | 95 | Package maintainers usually don't need to care about uninstallation because 96 | the packaging system tracks installed files and also properly removes them. 97 | Still, xpadneo provides `make uninstall` which runs the following steps for 98 | that **exact** xpadneo version only: 99 | 100 | 1. Removes xpadneo from *all* kernel instances of DKMS 101 | 2. Removes xpadneo kernel sources from `/usr/src` 102 | 3. Removes installed udev rules and module configurations **unconditionally** 103 | 104 | Step 3 means that it will remove files which may be shared with an already 105 | installed xpadneo package. **Be careful!** 106 | 107 | If using `PREFIX` or `ETC_PREFIX`, the same rules as above apply: If a 108 | `PREFIX` is provided, `dkms remove` won't be run. 109 | 110 | This is not meant to be used by package maintainers as part of handling the 111 | package installation. It is a development tool. 112 | 113 | 114 | ### Summary 115 | 116 | Package maintainers are advised to migrate to the new installation method. 117 | Please provide feedback if you see problems or missing features. 118 | 119 | Package maintainers **SHOULD NOT** use `install.sh` or its sibling scripts 120 | to maintain the installation. But you may use the contents of it as a guide 121 | for your package installation script. 122 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O4O43SURE) 2 | 3 | If you want to support me or accelerate the development of a special feature, consider a small donation :heart: 4 | Just leave a message if your donation is for a specific use (like a new hardware or a specific function). 5 | 6 | [![Build Status](https://dev.azure.com/dollingerflorian/dollingerflorian/_apis/build/status/atar-axis.xpadneo?branchName=master)](https://dev.azure.com/dollingerflorian/dollingerflorian/_build/latest?definitionId=1?branchName=master) 7 | [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/atar-axis/xpadneo.svg)](http://isitmaintained.com/project/atar-axis/xpadneo "Average time to resolve an issue") 8 | [![Packaging status](https://repology.org/badge/tiny-repos/xpadneo.svg)](https://repology.org/project/xpadneo/versions) 9 | [![Discord](https://img.shields.io/discord/733964971842732042)](https://discord.gg/nCqfKa84KA) 10 | 11 | 12 | # Advanced Linux Driver for Xbox One Wireless Gamepad 13 | 14 | ![xpadneo Logo](img/xpadneo.png) 15 | 16 | Quote from [@atar-axis (Florian Dollinger)](https://github.com/atar-axis), creator of the initial driver: 17 | 18 | > This is the first driver for the Xbox One Wireless Gamepad (which is shipped with the Xbox One S). I wrote it for a 19 | > student project at fortiss GmbH and it is fully functional but does only support the connection via Bluetooth as 20 | > yet - more will follow. 21 | > 22 | > Many thanks to *Kai Krakow* who **sponsored** me a Xbox One Wireless Controller :video_game: (including Wireless 23 | > Adapter) and a pack of mouthwatering guarana cacao :coffee: 24 | 25 | 26 | ## Other Projects 27 | 28 | * [xow](https://github.com/medusalix/xow) is a driver for the Xbox One S controllers, too, and supports the native 29 | dongles packaged with the controller. Kudos to [@medusalix](https://github.com/medusalix) for working together on 30 | finding some work-arounds for controller firmware bugs. 31 | * [xpad](https://github.com/paroj/xpad) supports this and many other controllers in USB mode. 32 | * [xone](https://github.com/medusalix/xone) is a driver aiming for fully supporting all Microsoft GIP devices thus 33 | replacing the xpad driver in the kernel while adding support for additional types of hardware. 34 | * [MissionControl](https://github.com/ndeadly/MissionControl) aims to support the controller on Nintendo Switch via 35 | Bluetooth. 36 | 37 | These other projects may not support some of the advanced features of xpadneo. 38 | 39 | 40 | ## Heads Up 41 | 42 | **Package maintainers:** Please see [Packaging](https://atar-axis.github.io/xpadneo/#packaging). 43 | 44 | 45 | ## Breaking Changes 46 | 47 | ### Kernel 4.18 or newer required 48 | 49 | As of xpadneo v0.10, we require kernel 4.18 or later to utilize `HID_QUIRK_INPUT_PER_APP` which splits the gamepad into 50 | multiple sub-devices to fix problems and incompatibilities at several layers. 51 | 52 | 53 | ### SDL2 2.28 Compatibility 54 | 55 | Thanks to [@slouken](https://github.com/slouken) from SDL2, xpadneo mappings are now auto-detected in the upcoming 56 | SDL2 2.28 release. This will fix long-standing problems with Steam Input and SDL2 games. With this release, we will 57 | also have full paddle support. 58 | 59 | If you still see problems, ensure that you didn't create custom controllerdb entries. See also: 60 | - https://github.com/atar-axis/xpadneo/issues/428 61 | - https://github.com/libsdl-org/SDL/commit/9567989eb3ce9c858f0fe76806c5ccad69da89ba 62 | - https://github.com/libsdl-org/SDL/commit/0f4b15e16b7f07a46db6dc8e651f8c1849d658c5 63 | 64 | Known issues: 65 | - The Share button will currently not be recognized by SDL2, scheduled to be fixed in xpadneo v0.11 66 | - If SDL2 uses hidraw, mappings will be wrong, export `SDL_JOYSTICK_HIDAPI=0` in your profile or find which software 67 | enabled hidraw device access to all drivers 68 | 69 | 70 | ### Quirks by Design 71 | 72 | With BLE firmware, all models switched to a unified HID report descriptor, only the XBE2 controller identifies with 73 | PID 0x0B22 while the other models identify with PID 0x0B13. This has some known consequences: 74 | 75 | - All non-XBE2 controllers will claim to have a Share button no matter if it physically exists. As HID doesn't report 76 | the internal model number, xpadneo cannot fix it currently. The button is currently mapped to F12, so this has no 77 | consequences. 78 | - All XBE2 controllers will claim to have a full keyboard and the Share button is actually the Profile button. Since 79 | Share is currently mapped to F12, this will have no consequences. 80 | 81 | 82 | ## Advantages of this Driver 83 | 84 | * Supports Bluetooth 85 | * Supports most force feedback and all rumble effects through Linux `ff-memless` effect emulation 86 | * Supports [Trigger Force Feedback](https://www.youtube.com/watch?v=G4PHupKm2OQ) in every game by applying a 87 | pressure-dependent effect intensity to the current rumble effect (not even supported in Windows) 88 | * Supports adjusting rumble intensity including disabling rumble 89 | * Offers a consistent mapping, even if the Gamepad was paired to Windows/Xbox before, and independent of software 90 | layers (SDL2, Stadia via Chrome Gamepad API, etc) 91 | * Working paddles (buttons on the backside of the controller) 92 | * Correct axis range (signed, important for e.g. RPCS3) 93 | * Supports battery level indication (including the Play 'n Charge Kit) 94 | ![Battery Level Indication](./img/battery_support.png) 95 | * Easy installation 96 | * Supports customization through profiles (work in progress) 97 | * Optional high-precision mode for Wine/Proton users (disables dead zones so games don't apply an additional one) 98 | * Share button support on supported controllers 99 | 100 | 101 | ## Unavailable Features 102 | 103 | Across all models, xpadneo won't support audio features of the controllers because the firmware doesn't support audio 104 | in Bluetooth mode. In the future, xpadneo may support audio when USB and dongle support will be added. 105 | 106 | 107 | ### Xbox One S Wireless Controller 108 | 109 | This is the initial controller supported from the first version of xpadneo. All features are fully supported. This 110 | controller uses emulated profile switching support (see below). 111 | 112 | 113 | ### Xbox Elite Series 2 Wireless Controller 114 | 115 | Basic support for the Xbox Elite Series 2 Wireless controller is present, covering all the features of the driver. 116 | The following features are missing: 117 | 118 | - Upload of profile mappings and sensitivity curves is currently not supported. 119 | 120 | This controller uses native profile switching support (see below). 121 | 122 | 123 | ### Xbox Series X|S Wireless Controller 124 | 125 | Full support for the Xbox Series X|S controller is present including the share button. This is currently statically 126 | mapped to keyboard event `KEY_F12` to take screenshots with Steam. It will be configurable in the future. This 127 | controller uses emulated profile switching support (see below). 128 | 129 | This controller uses BLE (Bluetooth low energy) and can only be supported if your Bluetooth dongle also supports BLE. 130 | 131 | **Known problems:** The controller may not properly set its connection parameters, resulting in laggy and choppy 132 | input experience. See also: [Troubleshooting](https://atar-axis.github.io/xpadneo/#troubleshooting). 133 | 134 | 135 | ### 8BitDo Controllers 136 | 137 | This driver supports the Nintendo layout of those controllers to exposes them correctly as button A, B, X, and Y 138 | as labelled on the device. This is swapped compared to the original Xbox controller layout. However, this feature is 139 | not enabled by default. If you want to use this feature, you have to add a quirk flag to the module options: 140 | 141 | ``` 142 | # /etc/modprobe.conf 143 | options hid_xpadneo quirks=E4:17:D8:xx:xx:xx+32 144 | ``` 145 | 146 | where you replace `xx:xx:xx` with the values from your controller MAC (as shown in `dmesg`). The value `32` enables 147 | Nintendo layout. If you'll want to add other quirk flags, simply add the values, 148 | e.g. `32` + `7` (default quirks for 8BitDo) = `39`. After changing this, reload the driver or reboot. 149 | 150 | This controller uses emulated profile switching support (see below). 151 | 152 | **Breaking change:** Users of previous versions of the driver may want to remove their custom SDL mappings. Full 153 | support has been added for these controllers and broken mapping of previously versions no longer needs to be 154 | applied. See also: [SDL](https://atar-axis.github.io/xpadneo/#troubleshooting#sdl). 155 | 156 | 157 | ### GuliKit KingKong Controller Family 158 | 159 | This driver supports the GuliKit King Kong controller family, the driver was tested with model NS09 (using firmware 160 | v2.0) and NS39 (aka KK3 MAX, firmware v3.6) but should work just fine for the older models, too. If in doubt, follow 161 | the firmware upgrade guides on the GuliKit home page to receive the latest firmware. Both the Android mode and the 162 | X-Input mode are supported but it may depend on your Bluetooth stack which mode works better for you (Android mode 163 | didn't pair for me). 164 | 165 | This driver supports the Nintendo layout of those controllers to exposes them correctly as button A, B, X, and Y 166 | as labelled on the device. This is swapped compared to the original Xbox controller layout. However, this feature is 167 | not enabled by default. If you want to use this feature, you have to add a quirk flag to the module options: 168 | 169 | ``` 170 | # /etc/modprobe.conf 171 | options hid_xpadneo quirks=98:B6:EA:xx:xx:xx+32 172 | ``` 173 | 174 | where you replace `xx:xx:xx` with the values from your controller MAC (as shown in `dmesg`). The value `32` enables 175 | Nintendo layout. If you'll want to add other quirk flags, simply add the values, 176 | e.g. `32` + `131` (default quirks for GuliKit) = `163`. After changing this, reload the driver or reboot. 177 | 178 | However, alternatively the controller supports swapping the buttons on the fly, too: Just press and hold the settings 179 | button, the click the plus button. Thus, the quirks flag is just a matter of setting the defaults. 180 | 181 | This controller uses emulated profile switching support (see below). 182 | 183 | 184 | ### GameSir T4 Cyclone Family 185 | 186 | This driver supports the GameSir T4 Cyclone controller family, tested by the community. The Pro-models also support 187 | trigger rumble but since we cannot distinguish both models by the Bluetooth MAC OUI, we simply enable the trigger 188 | rumble protocol for both variants. This should not introduce any problems but if it does, and your model does not have 189 | trigger rumble support, you can explicitly tell the driver to not use the trigger rumble motors by adding a quirk flag: 190 | 191 | ``` 192 | # /etc/modprobe.conf 193 | options hid_xpadneo quirks=A0:5A:5D:xx:xx:xx+2 194 | ``` 195 | 196 | This controller uses emulated profile switching support (see below). 197 | 198 | 199 | ### GameSir T4 Nova Lite Family 200 | 201 | This driver supports the GameSir T4 Nova Lite controller family, tested by the community. These models have a quirk of 202 | only allowing rumble when all motor-enable bits are set and does not have trigger rumble motors. It looks like these 203 | models are available with different MAC OUIs, so your particular controller may not be automatically detected. In this 204 | case, manually add the quirk flags for your controller: 205 | 206 | ``` 207 | # /etc/modprobe.conf 208 | options hid_xpadneo quirks=3E:42:6C:xx:xx:xx+6 209 | ``` 210 | 211 | This controller uses emulated profile switching support (see below). 212 | 213 | This manufacturer uses random MAC addresses, so we cannot rely on known OUIs. Heuristics try to detect this controller. 214 | 215 | 216 | ## Profile Switching 217 | 218 | The driver supports switching between different profiles, either through emulation or by using the hardware 219 | switch that comes with some models. This switching can be done at any time even while in a game. The API for 220 | customizing each profile does not exist yet. 221 | 222 | 223 | ### Native Profile Switching Support 224 | 225 | The driver support native profile switching for the Xbox Elite Series 2 controller. However, the feature is not 226 | finalized yet: 227 | 228 | - The default profile (no LED) exposes the paddles as extra buttons. 229 | - The other three profiles behave the same way by default. While there is no support for modifying them currently, 230 | configurations set in the [Xbox Accessories app (Windows only)](https://apps.microsoft.com/store/detail/xbox-accessories/9NBLGGH30XJ3) 231 | will carry over and operate as intended. 232 | 233 | 234 | ### Emulated Profile Switching Support 235 | 236 | The driver emulates profile switching for controllers without a hardware profile switch by pressing buttons A, B, X, 237 | or Y while holding down the Xbox logo button. However, the following caveats apply: 238 | 239 | - Profiles currently behave all the same, and there is no support for configuring them. 240 | - Full support will be available once the Xbox Elite Series 2 controller is fully supported. 241 | - If you hold the button for too long, the controller will turn off - we cannot prevent that. 242 | 243 | **Important:** Emulated profile switching won't work if you disabled the shift-mode of the Xbox logo button (module 244 | parameter `disable_shift_mode`). 245 | 246 | 247 | ## Getting Started 248 | 249 | ### Distribution Packages 250 | 251 | If your distribution has a maintained package, you can just use that and do not need to follow the manual install 252 | instructions below: 253 | 254 | [![Packaging status](https://repology.org/badge/vertical-allrepos/xpadneo.svg)](https://repology.org/project/xpadneo/versions) 255 | 256 | 257 | ### Notes for Package Maintainers 258 | 259 | To properly support module signing and UEFI secure boot, `openssl` and `mokutil` are required additionally to the 260 | prerequisites below. The [DKMS readme](https://github.com/dell/dkms/blob/master/README.md) has more instructions. 261 | 262 | 263 | ### Prerequisites 264 | 265 | Make sure you have installed *dkms*, *linux headers* and a bluetooth implementation (e.g. *bluez*) and their 266 | dependencies. 267 | 268 | Kernel maintainers should also include the `uhid` module (`CONFIG_UHID`) because otherwise Bluetooth LE devices (all 269 | models with firmware 5.x or higher) cannot create the HID input device which is handled in user-space by the bluez 270 | daemon. 271 | 272 | * On **Arch** and Arch-based distributions (like **EndeavourOS**), try 273 | `sudo pacman -S dkms linux-headers bluez bluez-utils` 274 | * On **Debian** based systems (like Ubuntu) you can install those packages by running 275 | ``sudo apt-get install dkms linux-headers-`uname -r` `` 276 | * On **Fedora**, it is 277 | ``sudo dnf install dkms make bluez bluez-tools kernel-devel-`uname -r` kernel-headers `` 278 | * On **Manjaro** try 279 | `sudo pacman -S dkms linux-latest-headers bluez bluez-utils` 280 | * On **openSUSE** (tested on Tumbleweed, should work for Leap), it is 281 | `sudo zypper install dkms make bluez kernel-devel kernel-source` 282 | * On **OSMC** you will have to run the following commands 283 | ``sudo apt-get install dkms rbp2-headers-`uname -r`\`` 284 | ``sudo ln -s "/usr/src/rbp2-headers-`uname -r`" "/lib/modules/`uname -r`/build"`` (as a [workaround](https://github.com/osmc/osmc/issues/471)) 285 | * On **Raspbian**, it is 286 | `sudo apt-get install dkms raspberrypi-kernel-headers` 287 | If you recently updated your firmware using `rpi-update` the above package may not yet include the header files for 288 | your kernel. Please follow the steps described [here](https://github.com/notro/rpi-source/wiki) in this case. 289 | * On **generic distributions**, it doesn't need DKMS but requires a configured kernel source tree, then: 290 | `cd hid-xpadneo && make modules && sudo make modules_install` 291 | * **Module singing and UEFI secure boot:** If installing yourself, you may need to follow the instructions above for 292 | package maintainers. 293 | 294 | Please feel free to add other distributions as well! 295 | 296 | 297 | ### Installation 298 | 299 | * Download the Repository to your local machine 300 | `git clone https://github.com/atar-axis/xpadneo.git` 301 | * `cd xpadneo` 302 | * If using DKMS, run `sudo ./install.sh` 303 | * If not using DKMS, follow steps above (generic distribution) 304 | * Done! 305 | 306 | 307 | ### Connection 308 | 309 | * `sudo bluetoothctl` 310 | * `[bluetooth]# scan on` 311 | * wait until all available devices are listed (otherwise it may be hard to identify which one is the gamepad) 312 | * push the connect button on upper side of the gamepad, and hold it down until the light starts flashing fast 313 | * wait for the gamepad to show up in bluetoothctl, remember the address (e.g. `C8:3F:26:XX:XX:XX`) 314 | * `[bluetooth]# scan off` to stop scanning as it may interfere with properly pairing the controller 315 | * `[bluetooth]# pair ` 316 | * `[bluetooth]# trust ` 317 | * `[bluetooth]# connect ` (should usually not be needed but there are [open bugs](https://github.com/atar-axis/xpadneo/issues/198)) 318 | * The `` parameter is optional if the command line already shows the controller name 319 | 320 | You know that everything works fine when you feel the gamepad rumble ;) 321 | 322 | 323 | ### Configuration 324 | 325 | * If using DKMS: Use `sudo ./configure.sh` to configure the driver as you wish. The script will guide you through the 326 | available options. 327 | 328 | 329 | ### Update 330 | 331 | In order to update xpadneo, do the following 332 | 333 | * Update your cloned repo: `git pull` 334 | * If using DKMS: Run `sudo ./update.sh` 335 | * otherwise follow the steps above (generic distribution) 336 | 337 | 338 | ### Uninstallation 339 | 340 | * If using DKMS: Run `sudo ./uninstall.sh` to remove all installed versions of hid-xpadneo 341 | * otherwise follow the steps above (generic distribution) 342 | 343 | 344 | ## Further Information 345 | 346 | For further information please visit the GitHub Page which is generated 347 | automatically from the content of the `/docs` folder. 348 | 349 | You will find there e.g. the following sections 350 | 351 | * [Troubleshooting](https://atar-axis.github.io/xpadneo/#troubleshooting) 352 | * [Debugging](https://atar-axis.github.io/xpadneo/#debugging) 353 | * [Compatible BT Dongles](https://atar-axis.github.io/xpadneo/#bt-dongles) 354 | -------------------------------------------------------------------------------- /docs/SDL.md: -------------------------------------------------------------------------------- 1 | ## SDL Mapping 2 | 3 | We fixed the following problem by pretending we are in Windows wireless mode 4 | by faking the *input device PID* to `0x02E0`. The original PID `0x02FD` 5 | triggers several unwanted fixups at multiple layers, i.e. SDL or the HTML5 6 | game controller API. The following paragraphs document the originally 7 | wrong behavior observed and we clearly don't want our fixed mappings to be 8 | "fixed" again by layers detected a seemingly wrong button mapping: 9 | 10 | Since after libSDL2 2.0.8, SDL contains a fix for the wrong mapping introduced 11 | by the generic hid driver. Thus, you may experience wrong button mappings 12 | again. 13 | 14 | Also, Wine since version 3.3 supports using SDL for `xinput*.dll`, and with 15 | version 3.4 it includes a patch to detect the Xbox One S controller. Games 16 | running in Wine and using xinput may thus also see wrong mappings. 17 | 18 | The Steam client includes a correction for SDL based games since some 19 | version, not depending on the SDL version. It provides a custom SDL 20 | mapping the same way we are describing here. 21 | 22 | To fix this and have both SDL-based software and software using the legacy 23 | joystick interface using correct button mapping, you need to export an 24 | environment variable which then overrides default behavior: 25 | 26 | ``` 27 | export SDL_GAMECONTROLLERCONFIG="\ 28 | 050000005e040000fd02000003090000,Xbox One Wireless Controller,\ 29 | a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,\ 30 | guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,\ 31 | rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,\ 32 | start:b7,x:b2,y:b3," 33 | ``` 34 | 35 | You need to set this before starting the software. To apply it globally, 36 | put this line into your logon scripts. 37 | 38 | The id `050000005e040000fd02000003090000` is crafted from your device 39 | id as four 32-bit words. It is, in LSB order, the bus number 5, the 40 | vendor id `045e`, the device id `02fd`, and the interface version 41 | or serial `0903` which is not a running number but firmware dependent. 42 | This version number is not the same as shown in dmesg as the fourth 43 | component. 44 | 45 | You can find the values by looking at dmesg when `xpadneo` detects 46 | your device. In dmesg, find the device path, then change to the 47 | device path below `/sys` and look for the files in the `id` directory. 48 | 49 | The name value after the id is purely cosmetically, you can name it 50 | whatever you like. It may show up in games as a visual identifier. 51 | 52 | If running Wine games, to properly support xpadneo, ensure you have 53 | removed any previous xinput hacks (which includes redirecting 54 | `xinput*.dll` to native and placing a hacked xinput dll in the 55 | game directory. Also ensure your Wine built comes with SDL support 56 | compiled in. 57 | 58 | If you do not want to apply this setting globally, you can instead 59 | put the SDL mapping inside Steam `config.vdf`. You can find this 60 | file in `$STEAM_BASE/config/config.vdf`. Find the line containing 61 | `"SDL_GamepadBind"` and adjust or add your own controller (see 62 | above). Ensure correct quoting, and Steam is not running 63 | while editing the file. This may not work for Steam in Wine 64 | because the Wine SDL layer comes first, you still need to export 65 | the variable before running Wine. An example with multiple 66 | controllers looks like this: 67 | 68 | ``` 69 | "SDL_GamepadBind" "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3, 70 | 03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3, 71 | 03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3, 72 | 030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3, 73 | 050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3," 74 | ``` 75 | 76 | An alternative store location of user-defined mappings can be found here: 77 | ``` 78 | $HOME/.local/share/gamecontrollerdb.local.txt 79 | ``` 80 | -------------------------------------------------------------------------------- /docs/TESTING.md: -------------------------------------------------------------------------------- 1 | ## Testing and Development 2 | 3 | ### Working with Pull Requests 4 | 5 | If working with pull requests, do not clone a fork of the other repository. 6 | The installer needs the original version tags to properly work and to have 7 | correct version tags that have not been tampered with. 8 | 9 | It is always recommended to add additional remotes for the forks to your 10 | already existing local clone. 11 | 12 | To do this, follow these steps. This example uses kakra/xpadneo as a fork: 13 | ```bash 14 | # checkout a clone from the original repository 15 | git clone https://github.com/atar-axis/xpadneo.git 16 | cd xpadneo 17 | 18 | # add the fork for the pull request as a clone 19 | git remote add kakra https://github.com/kakra/xpadneo.git 20 | git remote update 21 | 22 | # option 1: switch to another branch within this directory 23 | git switch -C local/branch/name kakra/remote/branch/name 24 | 25 | # option 2: setup a git workdir to use an isolated directory 26 | git worktree add ../xpadneo-kakra -B local/branch/name kakra/remote/branch/name 27 | 28 | # to update to the latest version of a pull request 29 | git remote update --prune 30 | 31 | # then reset your outdated copy of the branch 32 | git reset --merge kakra/remote/branch/name # tries keeping your local modifications 33 | git reset --hard kakra/remote/branch/name # discards your local modifications 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /docs/TROUBLESHOOTING.md: -------------------------------------------------------------------------------- 1 | ## Troubleshooting 2 | 3 | ### Gamepad Does Not Connect Properly 4 | 5 | #### High Latency or Lost Button Events with Bluetooth LE 6 | 7 | **Affected models:** Xbox controllers using Bluetooth LE (Xbox Series X\|S or later) 8 | 9 | While using new Xbox Series X\|S controller, you may experience laggy or choppy input, also button presses may be 10 | lost or delayed. This problem only affects Bluetooth LE controllers, the older models are not affected by these 11 | settings even if you think you may see such a problem. 12 | 13 | A proper solution is still missing but we isolated it to the Bluetooth LE connection parameters for latency and 14 | intervals. The bluez developers say that the connected device should suggest the best settings, the bluez daemon only 15 | ships sensible default settings. It looks like the new Xbox controllers do not properly suggest their preferred 16 | connection parameters, some BLE mice show the same problem. You can work around it by changing the bluez defaults 17 | instead. This change is not recommended by the bluez developers but as long as you only use a very specific set of BLE 18 | devices, this change should be fine. 19 | 20 | The controller uses 100 Hz internally for its protocol, so we decided to use intervals of 8.75..11.25ms. Each tick is 21 | 1.25ms, so we end up with `MinConnectionInterval=7` and `MaxConnectionInterval=9`. If you already use a similar 22 | work-around for other devices, you may need to adjust your settings to the proper bounds, i.e. do not increase the 23 | min value, do not lower the max value. 24 | 25 | Edit the following file and restart the Bluetooth service or reboot: 26 | ``` 27 | # /etc/bluetooth/main.conf 28 | [LE] 29 | MinConnectionInterval=7 30 | MaxConnectionInterval=9 31 | ConnectionLatency=0 32 | ``` 33 | 34 | References: 35 | 36 | * https://www.novelbits.io/ble-connection-intervals/ 37 | * https://github.com/bluez/bluez/issues/156 38 | * https://wiki.archlinux.org/title/Bluetooth_mouse#Mouse_lag 39 | 40 | 41 | #### Incompatible Bluetooth Chip Set 42 | 43 | Some chip sets, e.g. the CSR 85xx or Intel AX200 (and variants like 3xxx), do have problems when you try to reconnect 44 | the gamepad. 45 | 46 | Some chip sets may need additional driver firmware to work correctly. Try installing 47 | `linux-firmware` from your distribution. 48 | 49 | See below, if this happens since a firmware upgrade of the controller. 50 | 51 | 52 | #### Gamepad Connects and Immediately Disconnects since Firmware Upgrade 53 | 54 | After upgrading the controller firmware, it is essential to fully remove/forget the device from your Bluetooth device 55 | list, then reboot to ensure a clean state, then re-pair the controller. 56 | 57 | Reference: 58 | 59 | * https://github.com/atar-axis/xpadneo/issues/439 60 | 61 | 62 | #### Gamepad Asks for a PIN During Pairing 63 | 64 | A user found that with genuine Xbox controllers, the fix is often to use an external USB dongle instead of the internal 65 | chip set for pairing the controller (recommended to try first). 66 | 67 | If it still asks for a PIN, try `0000` to connect the controller. It should happen just once. 68 | 69 | Some third-party controllers and clones will still show the issue on later connects. The issue should be reported to 70 | the Bluez project to fix it, we only provide a work-around here. 71 | 72 | To work around the issue, this solution was found. It may affect other devices and reduces security, use at your own 73 | risk: 74 | 75 | ```ini 76 | # /etc/bluetooth/input.conf 77 | 78 | [General] 79 | UserspaceHID=true 80 | ClassicBondedOnly=false 81 | LEAutoSecurity=false 82 | ``` 83 | 84 | Reference: 85 | 86 | * https://github.com/atar-axis/xpadneo/issues/262#issuecomment-1913918332 87 | 88 | 89 | ### Gamepad Is Connected but Did not Rumble 90 | 91 | If the gamepad does connect but it doesn't rumble, then most probably the wrong driver is loaded, 92 | or the gamepad is quirky and doesn't fully support the protocol. Your kernel may also be missing the `uhid` module 93 | which is needed by all Bluetooth LE devices for input capabilities because the bluez daemon will handle HID data in 94 | user-space. Most distributions include `uhid` but if in doubt, ask your distribution kernel maintainers. 95 | 96 | Check the output of `zgrep UHID /proc/config.gz` to check whether your kernel has uhid support. This is only required 97 | for Xbox controllers with firmware 5.x or higher. 98 | 99 | Check the output of the `dmesg` command to see whether xpadneo was loaded and logged your 100 | gamepad. 101 | 102 | 103 | ### Gamepad Has Quirks (i.e., wrong rumble behavior) 104 | 105 | You may want to try several combinations of quirk flags added to the module parameters. 106 | See [Configuration](https://atar-axis.github.io/xpadneo/#configuration) and `modinfo hid-xpadneo` 107 | for more information. You may also want to use the hidraw testing utility which bypasses the 108 | driver and let's you try different combination of parameters. The utility is located at 109 | `misc/examples/c_hidraw`. 110 | 111 | 112 | ### Gamepad Does not Connect at All, Runs A Reconnect Loop, or Immediately Disconnects 113 | 114 | Check whether ERTM was disabled (see above). Also, some newer models use a different Bluetooth protocol "Bluetooth 115 | low energy" (BLE) which you may accidentally have disabled. Check the following settings in `/etc/bluetooth/main.conf`: 116 | ``` 117 | [General] 118 | ControllerMode = dual 119 | JustWorksRepairing = confirm 120 | ``` 121 | 122 | 123 | #### Xbox Wireless Controller 124 | 125 | The newest wireless controllers from Microsoft (Xbox One and Xbox Series X\|S) are known to cause a reconnect loop and 126 | not pairing with Bluez. There are some specific workarounds: 127 | 128 | - Plug your controller to a Windows 10 computer via a USB cord. Download 129 | the [Xbox Accessories application](https://xbox.com/accessories-app). When launching the app, it should ask you to 130 | update the firmware of the controller. When it's done, your controller should work just fine with any Linux system. 131 | - If you paired your controller to your linux computer before updating the firmware, and the controller is still not 132 | connecting properly after the firmware update, try removing the bluetooth device and re-pairing through the usual 133 | process. 134 | - If it didn't work, you can try these two workarounds: 135 | - Use a Windows 10 computer *on the same Bluetooth adapter* to pair with the controller. It must absolutely be on the 136 | same Bluetooth adapter, i.e. the same computer (can be inside a virtual machine with Bluetooth passthrough) if it's 137 | an internal Bluetooth adapter, or the same Bluetooth dongle. Then, you can get the pairing keys and install them 138 | within your Linux Bluetooth system. 139 | - After pairing the controller on Windows, refer to 140 | [the steps on the ArchLinux wiki](https://wiki.archlinux.org/title/Bluetooth#Extracting_on_Windows) for 141 | extracting the pairing keys from Windows. 142 | - Reboot the computer and try connecting. 143 | - If this fails, try removing the Xbox controller and re-pairing through the usual process. 144 | - Update to a newer kernel. Kernel 5.13 and higher might have patched a fix. 145 | - Use a different Bluetooth stack. Xbox controllers work fine with Fluoride (the bluetooth stack from Android). 146 | Sadly, it's hard to install on another Linux, and Bluez is the only stack easily provided on most Linux 147 | distributions. 148 | - If none of these options worked, or you can't try them, then the only solution is to plug the controller using a USB 149 | cord. As for now, it won't load the xpadneo driver, but the default controller driver. USB support may be added soon 150 | to xpadneo. 151 | 152 | 153 | ### Gamepad Axes Are Swapped, Seemingly Unresponsive or Strange Behavior 154 | 155 | If you observe this problem with `jstest`, `systemsettings joystick` (KDE) or `jstest-gtk`, there's usually nothing 156 | to do as these test programs use the old `joydev` API while most (modern) games use the `evdev` API. Some emulators, 157 | tho, use the `joydev` API and do not respect the axes naming from `evdev`. In this case, please run the following 158 | command to correct the axes mapping for the js interface: 159 | 160 | ```bash 161 | jscal -u 8,0,1,3,4,2,5,16,17,10,304,305,307,308,310,311,314,315,317,318 /dev/input/js0 162 | ``` 163 | 164 | Explanation: `-u` set the mapping for `8` axes to axes code `0,1,3,4,...` and for `10` buttons to button codes 165 | `304,305,307,308,...`. This only remaps the `joydev` API, **not** the `evdev` API. Making this change may have 166 | unexpected consequences for applications using both APIs. 167 | 168 | **IMPORTANT:** Now test all your axes to collect calibration data. You can then use the following command to store the 169 | settings permanently: 170 | 171 | ```bash 172 | sudo jscal-store /dev/input/js0 173 | ``` 174 | 175 | If the gamepad does not restore the mapping after disconnecting and reconnecting it, i.e., your distribution doesn't 176 | ship a proper udev rule for that, you may want to add the this udev rule, then reboot (see also 177 | `/misc/examples/udev-rules/99-xpadneo-joydev.rules`): 178 | 179 | ```bash 180 | # /etc/udev/rules.d/99-xpadneo-joydev.rules 181 | KERNEL=="js*", ACTION=="add", DRIVERS=="xpadneo", RUN+="/usr/bin/jscal-restore %E{DEVNAME}" 182 | ``` 183 | 184 | From now on, connecting the gamepad should restore the values from /var/lib/joystick/joystick.state. If you messed up, 185 | simply remove your gamepad from the file and start over. 186 | 187 | Please check, if `jscal-restore` is really in `/usr/bin`, otherwise use the correct path, found by running: 188 | 189 | ```bash 190 | type -p jscal-restore 191 | ``` 192 | 193 | **IMPORTANT NOTE:** The Chrome gamepad API (used for Stadia and other browser games) is a hybrid user of both the 194 | `joydev` and the `evdev` API bit it uses a hard-coded axes mapping for each controller model. Thus, when you run the 195 | above commands, the API will be confused and now shows the problem you initially tried to fix. To use the Chrome 196 | gamepad API, you'd need to revert that settings. There is currently no known work-around. 197 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /docs/config_help: -------------------------------------------------------------------------------- 1 | configure.sh Usage: 2 | NOTE: Short options don't require an equals sign, only long options. EX. -r 3 vs. --rumble-attenuation=50 3 | 4 | -h, --help 5 | Display this help screen. 6 | 7 | --version 8 | Display version number of xpadneo 9 | 10 | -m, --trigger-rumble-mode 11 | Select the parameters for trigger rumble. [0 (pressure controlled), 1 (directional, deprecated), 2 (disable trigger rumble)] 12 | 13 | -r, --rumble-attenuation 14 | Attenuate the strength of the trigger force feedback. [0 (none, full rumble) to 100 (max, no rumble)] 15 | 16 | -n, --ff_connect_notify 17 | Enable or disable connect notification. [0 (disabled), 1 (enabled)] 18 | 19 | NOTE: For more information on configuring xpadneo visit https://atar-axis.github.io/xpadneo/ 20 | Or the GitHub page: https://github.com/atar-axis/xpadneo 21 | -------------------------------------------------------------------------------- /docs/descriptors/8bitso_sn30_windows.md: -------------------------------------------------------------------------------- 1 | # HID Descriptor for 8BitDo SN30 Pro+ (Windows mode) 2 | 3 | Hex dump of the controller descriptor: 4 | ``` 5 | # xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:02E0.000B/report_descriptor 6 | 7 | 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff 8 | ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00 9 | 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff 10 | 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09 11 | 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 12 | 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04 13 | 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03 14 | 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 15 00 25 00 15 | 75 06 95 01 81 03 05 01 09 80 85 02 a1 00 09 85 15 00 25 01 16 | 95 01 75 01 81 02 15 00 25 00 75 07 95 01 81 03 c0 05 0f 09 17 | 21 85 03 a1 02 09 97 15 00 25 01 75 04 95 01 91 02 15 00 25 18 | 00 75 04 95 01 91 03 09 70 15 00 25 64 75 08 95 04 91 02 09 19 | 50 66 01 10 55 0e 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 20 | 00 26 ff 00 75 08 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 21 | 00 75 08 95 01 91 02 c0 85 04 05 06 09 20 15 00 26 ff 00 75 22 | 08 95 01 81 02 c0 00 23 | ``` 24 | 25 | Parsed descriptor: 26 | (via https://eleccelerator.com/usbdescreqparser/) 27 | ``` 28 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 29 | 0x09, 0x05, // Usage (Game Pad) 30 | 0xA1, 0x01, // Collection (Application) 31 | 0x85, 0x01, // Report ID (1) 32 | 0x09, 0x01, // Usage (Pointer) 33 | 0xA1, 0x00, // Collection (Physical) 34 | 0x09, 0x30, // Usage (X) 35 | 0x09, 0x31, // Usage (Y) 36 | 0x15, 0x00, // Logical Minimum (0) 37 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 38 | 0x95, 0x02, // Report Count (2) 39 | 0x75, 0x10, // Report Size (16) 40 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 | 0xC0, // End Collection 42 | 0x09, 0x01, // Usage (Pointer) 43 | 0xA1, 0x00, // Collection (Physical) 44 | 0x09, 0x33, // Usage (Rx) 45 | 0x09, 0x34, // Usage (Ry) 46 | 0x15, 0x00, // Logical Minimum (0) 47 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 48 | 0x95, 0x02, // Report Count (2) 49 | 0x75, 0x10, // Report Size (16) 50 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 51 | 0xC0, // End Collection 52 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 53 | 0x09, 0x32, // Usage (Z) 54 | 0x15, 0x00, // Logical Minimum (0) 55 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 56 | 0x95, 0x01, // Report Count (1) 57 | 0x75, 0x0A, // Report Size (10) 58 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 59 | 0x15, 0x00, // Logical Minimum (0) 60 | 0x25, 0x00, // Logical Maximum (0) 61 | 0x75, 0x06, // Report Size (6) 62 | 0x95, 0x01, // Report Count (1) 63 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 64 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 65 | 0x09, 0x35, // Usage (Rz) 66 | 0x15, 0x00, // Logical Minimum (0) 67 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 68 | 0x95, 0x01, // Report Count (1) 69 | 0x75, 0x0A, // Report Size (10) 70 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 71 | 0x15, 0x00, // Logical Minimum (0) 72 | 0x25, 0x00, // Logical Maximum (0) 73 | 0x75, 0x06, // Report Size (6) 74 | 0x95, 0x01, // Report Count (1) 75 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 76 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 77 | 0x09, 0x39, // Usage (Hat switch) 78 | 0x15, 0x01, // Logical Minimum (1) 79 | 0x25, 0x08, // Logical Maximum (8) 80 | 0x35, 0x00, // Physical Minimum (0) 81 | 0x46, 0x3B, 0x01, // Physical Maximum (315) 82 | 0x66, 0x14, 0x00, // Unit (System: English Rotation, Length: Centimeter) 83 | 0x75, 0x04, // Report Size (4) 84 | 0x95, 0x01, // Report Count (1) 85 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 86 | 0x75, 0x04, // Report Size (4) 87 | 0x95, 0x01, // Report Count (1) 88 | 0x15, 0x00, // Logical Minimum (0) 89 | 0x25, 0x00, // Logical Maximum (0) 90 | 0x35, 0x00, // Physical Minimum (0) 91 | 0x45, 0x00, // Physical Maximum (0) 92 | 0x65, 0x00, // Unit (None) 93 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 94 | 0x05, 0x09, // Usage Page (Button) 95 | 0x19, 0x01, // Usage Minimum (0x01) 96 | 0x29, 0x0A, // Usage Maximum (0x0A) 97 | 0x15, 0x00, // Logical Minimum (0) 98 | 0x25, 0x01, // Logical Maximum (1) 99 | 0x75, 0x01, // Report Size (1) 100 | 0x95, 0x0A, // Report Count (10) 101 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 102 | 0x15, 0x00, // Logical Minimum (0) 103 | 0x25, 0x00, // Logical Maximum (0) 104 | 0x75, 0x06, // Report Size (6) 105 | 0x95, 0x01, // Report Count (1) 106 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 107 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 108 | 0x09, 0x80, // Usage (Sys Control) 109 | 0x85, 0x02, // Report ID (2) 110 | 0xA1, 0x00, // Collection (Physical) 111 | 0x09, 0x85, // Usage (Sys Main Menu) 112 | 0x15, 0x00, // Logical Minimum (0) 113 | 0x25, 0x01, // Logical Maximum (1) 114 | 0x95, 0x01, // Report Count (1) 115 | 0x75, 0x01, // Report Size (1) 116 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 117 | 0x15, 0x00, // Logical Minimum (0) 118 | 0x25, 0x00, // Logical Maximum (0) 119 | 0x75, 0x07, // Report Size (7) 120 | 0x95, 0x01, // Report Count (1) 121 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 122 | 0xC0, // End Collection 123 | 0x05, 0x0F, // Usage Page (PID Page) 124 | 0x09, 0x21, // Usage (0x21) 125 | 0x85, 0x03, // Report ID (3) 126 | 0xA1, 0x02, // Collection (Logical) 127 | 0x09, 0x97, // Usage (0x97) 128 | 0x15, 0x00, // Logical Minimum (0) 129 | 0x25, 0x01, // Logical Maximum (1) 130 | 0x75, 0x04, // Report Size (4) 131 | 0x95, 0x01, // Report Count (1) 132 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 133 | 0x15, 0x00, // Logical Minimum (0) 134 | 0x25, 0x00, // Logical Maximum (0) 135 | 0x75, 0x04, // Report Size (4) 136 | 0x95, 0x01, // Report Count (1) 137 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 138 | 0x09, 0x70, // Usage (0x70) 139 | 0x15, 0x00, // Logical Minimum (0) 140 | 0x25, 0x64, // Logical Maximum (100) 141 | 0x75, 0x08, // Report Size (8) 142 | 0x95, 0x04, // Report Count (4) 143 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 144 | 0x09, 0x50, // Usage (0x50) 145 | 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) 146 | 0x55, 0x0E, // Unit Exponent (-2) 147 | 0x15, 0x00, // Logical Minimum (0) 148 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 149 | 0x75, 0x08, // Report Size (8) 150 | 0x95, 0x01, // Report Count (1) 151 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 152 | 0x09, 0xA7, // Usage (0xA7) 153 | 0x15, 0x00, // Logical Minimum (0) 154 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 155 | 0x75, 0x08, // Report Size (8) 156 | 0x95, 0x01, // Report Count (1) 157 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 158 | 0x65, 0x00, // Unit (None) 159 | 0x55, 0x00, // Unit Exponent (0) 160 | 0x09, 0x7C, // Usage (0x7C) 161 | 0x15, 0x00, // Logical Minimum (0) 162 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 163 | 0x75, 0x08, // Report Size (8) 164 | 0x95, 0x01, // Report Count (1) 165 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 166 | 0xC0, // End Collection 167 | 0x85, 0x04, // Report ID (4) 168 | 0x05, 0x06, // Usage Page (Generic Dev Ctrls) 169 | 0x09, 0x20, // Usage (Battery Strength) 170 | 0x15, 0x00, // Logical Minimum (0) 171 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 172 | 0x75, 0x08, // Report Size (8) 173 | 0x95, 0x01, // Report Count (1) 174 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 175 | 0xC0, // End Collection 176 | 0x00, // Unknown (bTag: 0x00, bType: 0x00) 177 | 178 | // 307 bytes 179 | 180 | // best guess: USB HID Report Descriptor 181 | ``` 182 | 183 | Converted to tables of report IDs: 184 | ``` 185 | TBD 186 | ``` 187 | 188 | Button bitmap (extracted from `btmon`): 189 | ``` 190 | ID -- -- -- -- -- -- -- -- -- -- -- -- Buttons 191 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 01 00 - B 0000 0001 = 90001 192 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - B 0000 0001 193 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 02 00 - A 0000 0010 = 90002 194 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - A 0000 0010 195 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 04 00 - Y 0000 0100 = 90003 196 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - Y 0000 0100 197 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 08 00 - X 0000 1000 = 90004 198 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - X 0000 1000 199 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 10 00 - L 0001 0000 = 90005 (shoulder) 200 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - L 0001 0000 201 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 20 00 - R 0010 0000 = 90006 (shoulder) 202 | 01 00 80 00 80 00 80 00 80 00 00 00 00 00 00 00 - R 0010 0000 203 | ``` 204 | -------------------------------------------------------------------------------- /docs/descriptors/gulikit_kingkong2_android.md: -------------------------------------------------------------------------------- 1 | # USB Descriptor for GuliKit KingKong 2 (Android mode) 2 | 3 | Hex dump of the controller descriptor: 4 | ``` 5 | # xxd -c20 -g1 /sys/class/hidraw/hidraw18/device/report_descriptor 6 | 7 | 00000000: 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff .............0.1..'. 8 | 00000014: ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00 .....u.........3.4.. 9 | 00000028: 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff '......u.......2..&. 10 | 0000003c: 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09 ...u.....%.u........ 11 | 00000050: 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 5..&....u.....%.u... 12 | 00000064: 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04 .....9..%.5.F;.f..u. 13 | 00000078: 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03 ...Bu.....%.5.E.e... 14 | 0000008c: 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 15 00 25 00 ....)...%.u.......%. 15 | 000000a0: 75 06 95 01 81 03 05 01 09 80 85 02 a1 00 09 85 15 00 25 01 u.................%. 16 | 000000b4: 95 01 75 01 81 02 15 00 25 00 75 07 95 01 81 03 c0 05 0f 09 ..u.....%.u......... 17 | 000000c8: 21 85 03 a1 02 09 97 15 00 25 01 75 04 95 01 91 02 15 00 25 !........%.u.......% 18 | 000000dc: 00 75 04 95 01 91 03 09 70 15 00 25 64 75 08 95 04 91 02 09 .u......p..%du...... 19 | 000000f0: 50 66 01 10 55 0e 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 Pf..U...&..u........ 20 | 00000104: 00 26 ff 00 75 08 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff .&..u.....e.U..|..&. 21 | 00000118: 00 75 08 95 01 91 02 c0 85 04 05 06 09 20 15 00 26 ff 00 75 .u........... ..&..u 22 | 0000012c: 08 95 01 81 02 c0 00 23 | ``` 24 | 25 | Parsed descriptor: 26 | (via https://eleccelerator.com/usbdescreqparser/) 27 | ``` 28 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 29 | 0x09, 0x05, // Usage (Game Pad) 30 | 0xA1, 0x01, // Collection (Application) 31 | 0x85, 0x01, // Report ID (1) 32 | 0x09, 0x01, // Usage (Pointer) 33 | 0xA1, 0x00, // Collection (Physical) 34 | 0x09, 0x30, // Usage (X) 35 | 0x09, 0x31, // Usage (Y) 36 | 0x15, 0x00, // Logical Minimum (0) 37 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 38 | 0x95, 0x02, // Report Count (2) 39 | 0x75, 0x10, // Report Size (16) 40 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 | 0xC0, // End Collection 42 | 0x09, 0x01, // Usage (Pointer) 43 | 0xA1, 0x00, // Collection (Physical) 44 | 0x09, 0x33, // Usage (Rx) 45 | 0x09, 0x34, // Usage (Ry) 46 | 0x15, 0x00, // Logical Minimum (0) 47 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 48 | 0x95, 0x02, // Report Count (2) 49 | 0x75, 0x10, // Report Size (16) 50 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 51 | 0xC0, // End Collection 52 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 53 | 0x09, 0x32, // Usage (Z) 54 | 0x15, 0x00, // Logical Minimum (0) 55 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 56 | 0x95, 0x01, // Report Count (1) 57 | 0x75, 0x0A, // Report Size (10) 58 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 59 | 0x15, 0x00, // Logical Minimum (0) 60 | 0x25, 0x00, // Logical Maximum (0) 61 | 0x75, 0x06, // Report Size (6) 62 | 0x95, 0x01, // Report Count (1) 63 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 64 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 65 | 0x09, 0x35, // Usage (Rz) 66 | 0x15, 0x00, // Logical Minimum (0) 67 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 68 | 0x95, 0x01, // Report Count (1) 69 | 0x75, 0x0A, // Report Size (10) 70 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 71 | 0x15, 0x00, // Logical Minimum (0) 72 | 0x25, 0x00, // Logical Maximum (0) 73 | 0x75, 0x06, // Report Size (6) 74 | 0x95, 0x01, // Report Count (1) 75 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 76 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 77 | 0x09, 0x39, // Usage (Hat switch) 78 | 0x15, 0x01, // Logical Minimum (1) 79 | 0x25, 0x08, // Logical Maximum (8) 80 | 0x35, 0x00, // Physical Minimum (0) 81 | 0x46, 0x3B, 0x01, // Physical Maximum (315) 82 | 0x66, 0x14, 0x00, // Unit (System: English Rotation, Length: Centimeter) 83 | 0x75, 0x04, // Report Size (4) 84 | 0x95, 0x01, // Report Count (1) 85 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 86 | 0x75, 0x04, // Report Size (4) 87 | 0x95, 0x01, // Report Count (1) 88 | 0x15, 0x00, // Logical Minimum (0) 89 | 0x25, 0x00, // Logical Maximum (0) 90 | 0x35, 0x00, // Physical Minimum (0) 91 | 0x45, 0x00, // Physical Maximum (0) 92 | 0x65, 0x00, // Unit (None) 93 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 94 | 0x05, 0x09, // Usage Page (Button) 95 | 0x19, 0x01, // Usage Minimum (0x01) 96 | 0x29, 0x0A, // Usage Maximum (0x0A) 97 | 0x15, 0x00, // Logical Minimum (0) 98 | 0x25, 0x01, // Logical Maximum (1) 99 | 0x75, 0x01, // Report Size (1) 100 | 0x95, 0x0A, // Report Count (10) 101 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 102 | 0x15, 0x00, // Logical Minimum (0) 103 | 0x25, 0x00, // Logical Maximum (0) 104 | 0x75, 0x06, // Report Size (6) 105 | 0x95, 0x01, // Report Count (1) 106 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 107 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 108 | 0x09, 0x80, // Usage (Sys Control) 109 | 0x85, 0x02, // Report ID (2) 110 | 0xA1, 0x00, // Collection (Physical) 111 | 0x09, 0x85, // Usage (Sys Main Menu) 112 | 0x15, 0x00, // Logical Minimum (0) 113 | 0x25, 0x01, // Logical Maximum (1) 114 | 0x95, 0x01, // Report Count (1) 115 | 0x75, 0x01, // Report Size (1) 116 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 117 | 0x15, 0x00, // Logical Minimum (0) 118 | 0x25, 0x00, // Logical Maximum (0) 119 | 0x75, 0x07, // Report Size (7) 120 | 0x95, 0x01, // Report Count (1) 121 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 122 | 0xC0, // End Collection 123 | 0x05, 0x0F, // Usage Page (PID Page) 124 | 0x09, 0x21, // Usage (0x21) 125 | 0x85, 0x03, // Report ID (3) 126 | 0xA1, 0x02, // Collection (Logical) 127 | 0x09, 0x97, // Usage (0x97) 128 | 0x15, 0x00, // Logical Minimum (0) 129 | 0x25, 0x01, // Logical Maximum (1) 130 | 0x75, 0x04, // Report Size (4) 131 | 0x95, 0x01, // Report Count (1) 132 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 133 | 0x15, 0x00, // Logical Minimum (0) 134 | 0x25, 0x00, // Logical Maximum (0) 135 | 0x75, 0x04, // Report Size (4) 136 | 0x95, 0x01, // Report Count (1) 137 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 138 | 0x09, 0x70, // Usage (0x70) 139 | 0x15, 0x00, // Logical Minimum (0) 140 | 0x25, 0x64, // Logical Maximum (100) 141 | 0x75, 0x08, // Report Size (8) 142 | 0x95, 0x04, // Report Count (4) 143 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 144 | 0x09, 0x50, // Usage (0x50) 145 | 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) 146 | 0x55, 0x0E, // Unit Exponent (-2) 147 | 0x15, 0x00, // Logical Minimum (0) 148 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 149 | 0x75, 0x08, // Report Size (8) 150 | 0x95, 0x01, // Report Count (1) 151 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 152 | 0x09, 0xA7, // Usage (0xA7) 153 | 0x15, 0x00, // Logical Minimum (0) 154 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 155 | 0x75, 0x08, // Report Size (8) 156 | 0x95, 0x01, // Report Count (1) 157 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 158 | 0x65, 0x00, // Unit (None) 159 | 0x55, 0x00, // Unit Exponent (0) 160 | 0x09, 0x7C, // Usage (0x7C) 161 | 0x15, 0x00, // Logical Minimum (0) 162 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 163 | 0x75, 0x08, // Report Size (8) 164 | 0x95, 0x01, // Report Count (1) 165 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 166 | 0xC0, // End Collection 167 | 0x85, 0x04, // Report ID (4) 168 | 0x05, 0x06, // Usage Page (Generic Dev Ctrls) 169 | 0x09, 0x20, // Usage (Battery Strength) 170 | 0x15, 0x00, // Logical Minimum (0) 171 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 172 | 0x75, 0x08, // Report Size (8) 173 | 0x95, 0x01, // Report Count (1) 174 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 175 | 0xC0, // End Collection 176 | 0x00, // Unknown (bTag: 0x00, bType: 0x00) 177 | 178 | // 307 bytes 179 | 180 | // best guess: USB HID Report Descriptor 181 | ``` 182 | -------------------------------------------------------------------------------- /docs/descriptors/xb1s_linux.md: -------------------------------------------------------------------------------- 1 | # USB Descriptor for Xbox One S Wireless (Linux mode) 2 | 3 | Hex dump of the controller descriptor: 4 | ``` 5 | # xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:02FD.005C/report_descriptor 6 | 7 | 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff 8 | ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 32 09 35 15 00 9 | 27 ff ff 00 00 95 02 75 10 81 02 c0 05 02 09 c5 15 00 26 ff 10 | 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 02 09 11 | c4 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 12 | 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04 13 | 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03 14 | 05 09 19 01 29 0f 15 00 25 01 75 01 95 0f 81 02 15 00 25 00 15 | 75 01 95 01 81 03 05 0c 0a 24 02 15 00 25 01 95 01 75 01 81 16 | 02 15 00 25 00 75 07 95 01 81 03 05 0c 09 01 85 02 a1 01 05 17 | 0c 0a 23 02 15 00 25 01 95 01 75 01 81 02 15 00 25 00 75 07 18 | 95 01 81 03 c0 05 0f 09 21 85 03 a1 02 09 97 15 00 25 01 75 19 | 04 95 01 91 02 15 00 25 00 75 04 95 01 91 03 09 70 15 00 25 20 | 64 75 08 95 04 91 02 09 50 66 01 10 55 0e 15 00 26 ff 00 75 21 | 08 95 01 91 02 09 a7 15 00 26 ff 00 75 08 95 01 91 02 65 00 22 | 55 00 09 7c 15 00 26 ff 00 75 08 95 01 91 02 c0 05 06 09 20 23 | 85 04 15 00 26 ff 00 75 08 95 01 81 02 c0 00 24 | ``` 25 | 26 | Parsed descriptor: 27 | (via https://eleccelerator.com/usbdescreqparser/) 28 | ``` 29 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 30 | 0x09, 0x05, // Usage (Game Pad) 31 | 0xA1, 0x01, // Collection (Application) 32 | 0x85, 0x01, // Report ID (1) 33 | 0x09, 0x01, // Usage (Pointer) 34 | 0xA1, 0x00, // Collection (Physical) 35 | 0x09, 0x30, // Usage (X) 36 | 0x09, 0x31, // Usage (Y) 37 | 0x15, 0x00, // Logical Minimum (0) 38 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 39 | 0x95, 0x02, // Report Count (2) 40 | 0x75, 0x10, // Report Size (16) 41 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 42 | 0xC0, // End Collection 43 | 0x09, 0x01, // Usage (Pointer) 44 | 0xA1, 0x00, // Collection (Physical) 45 | 0x09, 0x32, // Usage (Z) 46 | 0x09, 0x35, // Usage (Rz) 47 | 0x15, 0x00, // Logical Minimum (0) 48 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 49 | 0x95, 0x02, // Report Count (2) 50 | 0x75, 0x10, // Report Size (16) 51 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 52 | 0xC0, // End Collection 53 | 0x05, 0x02, // Usage Page (Sim Ctrls) 54 | 0x09, 0xC5, // Usage (Brake) 55 | 0x15, 0x00, // Logical Minimum (0) 56 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 57 | 0x95, 0x01, // Report Count (1) 58 | 0x75, 0x0A, // Report Size (10) 59 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 60 | 0x15, 0x00, // Logical Minimum (0) 61 | 0x25, 0x00, // Logical Maximum (0) 62 | 0x75, 0x06, // Report Size (6) 63 | 0x95, 0x01, // Report Count (1) 64 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 65 | 0x05, 0x02, // Usage Page (Sim Ctrls) 66 | 0x09, 0xC4, // Usage (Accelerator) 67 | 0x15, 0x00, // Logical Minimum (0) 68 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 69 | 0x95, 0x01, // Report Count (1) 70 | 0x75, 0x0A, // Report Size (10) 71 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 72 | 0x15, 0x00, // Logical Minimum (0) 73 | 0x25, 0x00, // Logical Maximum (0) 74 | 0x75, 0x06, // Report Size (6) 75 | 0x95, 0x01, // Report Count (1) 76 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 77 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 78 | 0x09, 0x39, // Usage (Hat switch) 79 | 0x15, 0x01, // Logical Minimum (1) 80 | 0x25, 0x08, // Logical Maximum (8) 81 | 0x35, 0x00, // Physical Minimum (0) 82 | 0x46, 0x3B, 0x01, // Physical Maximum (315) 83 | 0x66, 0x14, 0x00, // Unit (System: English Rotation, Length: Centimeter) 84 | 0x75, 0x04, // Report Size (4) 85 | 0x95, 0x01, // Report Count (1) 86 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 87 | 0x75, 0x04, // Report Size (4) 88 | 0x95, 0x01, // Report Count (1) 89 | 0x15, 0x00, // Logical Minimum (0) 90 | 0x25, 0x00, // Logical Maximum (0) 91 | 0x35, 0x00, // Physical Minimum (0) 92 | 0x45, 0x00, // Physical Maximum (0) 93 | 0x65, 0x00, // Unit (None) 94 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 95 | 0x05, 0x09, // Usage Page (Button) 96 | 0x19, 0x01, // Usage Minimum (0x01) 97 | 0x29, 0x0F, // Usage Maximum (0x0F) 98 | 0x15, 0x00, // Logical Minimum (0) 99 | 0x25, 0x01, // Logical Maximum (1) 100 | 0x75, 0x01, // Report Size (1) 101 | 0x95, 0x0F, // Report Count (15) 102 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 103 | 0x15, 0x00, // Logical Minimum (0) 104 | 0x25, 0x00, // Logical Maximum (0) 105 | 0x75, 0x01, // Report Size (1) 106 | 0x95, 0x01, // Report Count (1) 107 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 108 | 0x05, 0x0C, // Usage Page (Consumer) 109 | 0x0A, 0x24, 0x02, // Usage (AC Back) 110 | 0x15, 0x00, // Logical Minimum (0) 111 | 0x25, 0x01, // Logical Maximum (1) 112 | 0x95, 0x01, // Report Count (1) 113 | 0x75, 0x01, // Report Size (1) 114 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 115 | 0x15, 0x00, // Logical Minimum (0) 116 | 0x25, 0x00, // Logical Maximum (0) 117 | 0x75, 0x07, // Report Size (7) 118 | 0x95, 0x01, // Report Count (1) 119 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 120 | 0x05, 0x0C, // Usage Page (Consumer) 121 | 0x09, 0x01, // Usage (Consumer Control) 122 | 0x85, 0x02, // Report ID (2) 123 | 0xA1, 0x01, // Collection (Application) 124 | 0x05, 0x0C, // Usage Page (Consumer) 125 | 0x0A, 0x23, 0x02, // Usage (AC Home) 126 | 0x15, 0x00, // Logical Minimum (0) 127 | 0x25, 0x01, // Logical Maximum (1) 128 | 0x95, 0x01, // Report Count (1) 129 | 0x75, 0x01, // Report Size (1) 130 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 131 | 0x15, 0x00, // Logical Minimum (0) 132 | 0x25, 0x00, // Logical Maximum (0) 133 | 0x75, 0x07, // Report Size (7) 134 | 0x95, 0x01, // Report Count (1) 135 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 136 | 0xC0, // End Collection 137 | 0x05, 0x0F, // Usage Page (PID Page) 138 | 0x09, 0x21, // Usage (0x21) 139 | 0x85, 0x03, // Report ID (3) 140 | 0xA1, 0x02, // Collection (Logical) 141 | 0x09, 0x97, // Usage (0x97) 142 | 0x15, 0x00, // Logical Minimum (0) 143 | 0x25, 0x01, // Logical Maximum (1) 144 | 0x75, 0x04, // Report Size (4) 145 | 0x95, 0x01, // Report Count (1) 146 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 147 | 0x15, 0x00, // Logical Minimum (0) 148 | 0x25, 0x00, // Logical Maximum (0) 149 | 0x75, 0x04, // Report Size (4) 150 | 0x95, 0x01, // Report Count (1) 151 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 152 | 0x09, 0x70, // Usage (0x70) 153 | 0x15, 0x00, // Logical Minimum (0) 154 | 0x25, 0x64, // Logical Maximum (100) 155 | 0x75, 0x08, // Report Size (8) 156 | 0x95, 0x04, // Report Count (4) 157 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 158 | 0x09, 0x50, // Usage (0x50) 159 | 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) 160 | 0x55, 0x0E, // Unit Exponent (-2) 161 | 0x15, 0x00, // Logical Minimum (0) 162 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 163 | 0x75, 0x08, // Report Size (8) 164 | 0x95, 0x01, // Report Count (1) 165 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 166 | 0x09, 0xA7, // Usage (0xA7) 167 | 0x15, 0x00, // Logical Minimum (0) 168 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 169 | 0x75, 0x08, // Report Size (8) 170 | 0x95, 0x01, // Report Count (1) 171 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 172 | 0x65, 0x00, // Unit (None) 173 | 0x55, 0x00, // Unit Exponent (0) 174 | 0x09, 0x7C, // Usage (0x7C) 175 | 0x15, 0x00, // Logical Minimum (0) 176 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 177 | 0x75, 0x08, // Report Size (8) 178 | 0x95, 0x01, // Report Count (1) 179 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 180 | 0xC0, // End Collection 181 | 0x05, 0x06, // Usage Page (Generic Dev Ctrls) 182 | 0x09, 0x20, // Usage (Battery Strength) 183 | 0x85, 0x04, // Report ID (4) 184 | 0x15, 0x00, // Logical Minimum (0) 185 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 186 | 0x75, 0x08, // Report Size (8) 187 | 0x95, 0x01, // Report Count (1) 188 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 189 | 0xC0, // End Collection 190 | 0x00, // Unknown (bTag: 0x00, bType: 0x00) 191 | 192 | // 335 bytes 193 | 194 | // best guess: USB HID Report Descriptor 195 | ``` 196 | 197 | Converted to tables of report IDs: 198 | ``` 199 | Bit | 0 | 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 200 | Byt | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | EOF 201 | ID | | | | | | | | | | | | | | | | | 202 | ----|----------------------------------------------------------------------------------------------------------|---------- 203 | 01 | X : Y | Z : Rz | Brake | Accel | Dpad | Buttons | AC Back | 204 | Rng | 0-65534 : | 0-65534 : | 0-1023 | 0-1023 | 0-1 | 0-1 | 0-1 | 205 | Sz | 16 : 16 | 16 : 16 | 10+(6) | 10+(6) | 4+(4) | 15+(1) | 1+(7) | 128 Bits 206 | ----|--------------------------------------------------------------------------------------------------------------------- 207 | 02 | AC Home | | | | | | | | | | | | | | | | 208 | Rng | 0-1 | | | | | | | | | | | | | | | | 209 | Sz | 1+(7) | | | | | | | | | | | | | | | | 8 Bits 210 | ----|--------------------------------------------------------------------------------------------------------------------- 211 | 03 | 0x97 | 0x70 (Motors) | 0x50 | 0xA7 | 0x7C | | | | | | | | | 212 | Rng | 0-1 | 0-100 | 0-255 | 0-255 | 0-255 | | | | | | | | | 213 | Sz | 4+(4) | 8 : 8 : 8 : 8 | 8 | 8 | 8 | | | | | | | | | 64 Bits 214 | ----|--------------------------------------------------------------------------------------------------------------------- 215 | 04 | Bat | | | | | | | | | | | | | | | | 216 | Rng | 0-255 | | | | | | | | | | | | | | | | 217 | Sz | 8 | | | | | | | | | | | | | | | | 8 Bits 218 | ``` 219 | 220 | Button bitmap: 221 | ``` 222 | BTN_A 0000 0001 .000 0000 01 00 Bit 1 223 | BTN_B 0000 0010 .000 0000 02 00 Bit 2 224 | 225 | BTN_X 0000 1000 .000 0000 08 00 Bit 4 226 | BTN_Y 0001 0000 .000 0000 10 00 Bit 5 227 | 228 | BTN_TL 0100 0000 .000 0000 40 00 Bit 7 229 | BTN_TR 1000 0000 .000 0000 80 00 Bit 8 230 | 231 | BTN_SELECT AC Back (left) 232 | BTN_START 0000 0000 .000 1000 00 08 Bit 12 (right) 233 | BTN_HOME 0000 0000 .001 0000 00 10 Bit 13 AC Home (Xbox button, center) 234 | 235 | BTN_THUMBL 0000 0000 .010 0000 00 20 Bit 14 236 | BTN_THUMBR 0000 0000 .100 0000 00 40 Bit 15 237 | ``` 238 | -------------------------------------------------------------------------------- /docs/descriptors/xb1s_windows.md: -------------------------------------------------------------------------------- 1 | # USB Descriptor for Xbox One S Wireless (Windows mode) 2 | 3 | Hex dump of the controller descriptor: 4 | ``` 5 | # xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:02FD.005C/report_descriptor 6 | 7 | 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff 8 | ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 33 09 34 15 00 9 | 27 ff ff 00 00 95 02 75 10 81 02 c0 05 01 09 32 15 00 26 ff 10 | 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 01 09 11 | 35 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 12 | 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04 13 | 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03 14 | 05 09 19 01 29 0a 15 00 25 01 75 01 95 0a 81 02 15 00 25 00 15 | 75 06 95 01 81 03 05 01 09 80 85 02 a1 00 09 85 15 00 25 01 16 | 95 01 75 01 81 02 15 00 25 00 75 07 95 01 81 03 c0 05 0f 09 17 | 21 85 03 a1 02 09 97 15 00 25 01 75 04 95 01 91 02 15 00 25 18 | 00 75 04 95 01 91 03 09 70 15 00 25 64 75 08 95 04 91 02 09 19 | 50 66 01 10 55 0e 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 20 | 00 26 ff 00 75 08 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 21 | 00 75 08 95 01 91 02 c0 85 04 05 06 09 20 15 00 26 ff 00 75 22 | 08 95 01 81 02 c0 00 23 | ``` 24 | 25 | Parsed descriptor: 26 | (via https://eleccelerator.com/usbdescreqparser/) 27 | ``` 28 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 29 | 0x09, 0x05, // Usage (Game Pad) 30 | 0xA1, 0x01, // Collection (Application) 31 | 0x85, 0x01, // Report ID (1) 32 | 0x09, 0x01, // Usage (Pointer) 33 | 0xA1, 0x00, // Collection (Physical) 34 | 0x09, 0x30, // Usage (X) 35 | 0x09, 0x31, // Usage (Y) 36 | 0x15, 0x00, // Logical Minimum (0) 37 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 38 | 0x95, 0x02, // Report Count (2) 39 | 0x75, 0x10, // Report Size (16) 40 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 41 | 0xC0, // End Collection 42 | 0x09, 0x01, // Usage (Pointer) 43 | 0xA1, 0x00, // Collection (Physical) 44 | 0x09, 0x33, // Usage (Rx) 45 | 0x09, 0x34, // Usage (Ry) 46 | 0x15, 0x00, // Logical Minimum (0) 47 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 48 | 0x95, 0x02, // Report Count (2) 49 | 0x75, 0x10, // Report Size (16) 50 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 51 | 0xC0, // End Collection 52 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 53 | 0x09, 0x32, // Usage (Z) 54 | 0x15, 0x00, // Logical Minimum (0) 55 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 56 | 0x95, 0x01, // Report Count (1) 57 | 0x75, 0x0A, // Report Size (10) 58 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 59 | 0x15, 0x00, // Logical Minimum (0) 60 | 0x25, 0x00, // Logical Maximum (0) 61 | 0x75, 0x06, // Report Size (6) 62 | 0x95, 0x01, // Report Count (1) 63 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 64 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 65 | 0x09, 0x35, // Usage (Rz) 66 | 0x15, 0x00, // Logical Minimum (0) 67 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 68 | 0x95, 0x01, // Report Count (1) 69 | 0x75, 0x0A, // Report Size (10) 70 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 71 | 0x15, 0x00, // Logical Minimum (0) 72 | 0x25, 0x00, // Logical Maximum (0) 73 | 0x75, 0x06, // Report Size (6) 74 | 0x95, 0x01, // Report Count (1) 75 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 76 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 77 | 0x09, 0x39, // Usage (Hat switch) 78 | 0x15, 0x01, // Logical Minimum (1) 79 | 0x25, 0x08, // Logical Maximum (8) 80 | 0x35, 0x00, // Physical Minimum (0) 81 | 0x46, 0x3B, 0x01, // Physical Maximum (315) 82 | 0x66, 0x14, 0x00, // Unit (System: English Rotation, Length: Centimeter) 83 | 0x75, 0x04, // Report Size (4) 84 | 0x95, 0x01, // Report Count (1) 85 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 86 | 0x75, 0x04, // Report Size (4) 87 | 0x95, 0x01, // Report Count (1) 88 | 0x15, 0x00, // Logical Minimum (0) 89 | 0x25, 0x00, // Logical Maximum (0) 90 | 0x35, 0x00, // Physical Minimum (0) 91 | 0x45, 0x00, // Physical Maximum (0) 92 | 0x65, 0x00, // Unit (None) 93 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 94 | 0x05, 0x09, // Usage Page (Button) 95 | 0x19, 0x01, // Usage Minimum (0x01) 96 | 0x29, 0x0A, // Usage Maximum (0x0A) 97 | 0x15, 0x00, // Logical Minimum (0) 98 | 0x25, 0x01, // Logical Maximum (1) 99 | 0x75, 0x01, // Report Size (1) 100 | 0x95, 0x0A, // Report Count (10) 101 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 102 | 0x15, 0x00, // Logical Minimum (0) 103 | 0x25, 0x00, // Logical Maximum (0) 104 | 0x75, 0x06, // Report Size (6) 105 | 0x95, 0x01, // Report Count (1) 106 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 107 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 108 | 0x09, 0x80, // Usage (Sys Control) 109 | 0x85, 0x02, // Report ID (2) 110 | 0xA1, 0x00, // Collection (Physical) 111 | 0x09, 0x85, // Usage (Sys Main Menu) 112 | 0x15, 0x00, // Logical Minimum (0) 113 | 0x25, 0x01, // Logical Maximum (1) 114 | 0x95, 0x01, // Report Count (1) 115 | 0x75, 0x01, // Report Size (1) 116 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 117 | 0x15, 0x00, // Logical Minimum (0) 118 | 0x25, 0x00, // Logical Maximum (0) 119 | 0x75, 0x07, // Report Size (7) 120 | 0x95, 0x01, // Report Count (1) 121 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 122 | 0xC0, // End Collection 123 | 0x05, 0x0F, // Usage Page (PID Page) 124 | 0x09, 0x21, // Usage (0x21) 125 | 0x85, 0x03, // Report ID (3) 126 | 0xA1, 0x02, // Collection (Logical) 127 | 0x09, 0x97, // Usage (0x97) 128 | 0x15, 0x00, // Logical Minimum (0) 129 | 0x25, 0x01, // Logical Maximum (1) 130 | 0x75, 0x04, // Report Size (4) 131 | 0x95, 0x01, // Report Count (1) 132 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 133 | 0x15, 0x00, // Logical Minimum (0) 134 | 0x25, 0x00, // Logical Maximum (0) 135 | 0x75, 0x04, // Report Size (4) 136 | 0x95, 0x01, // Report Count (1) 137 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 138 | 0x09, 0x70, // Usage (0x70) 139 | 0x15, 0x00, // Logical Minimum (0) 140 | 0x25, 0x64, // Logical Maximum (100) 141 | 0x75, 0x08, // Report Size (8) 142 | 0x95, 0x04, // Report Count (4) 143 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 144 | 0x09, 0x50, // Usage (0x50) 145 | 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) 146 | 0x55, 0x0E, // Unit Exponent (-2) 147 | 0x15, 0x00, // Logical Minimum (0) 148 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 149 | 0x75, 0x08, // Report Size (8) 150 | 0x95, 0x01, // Report Count (1) 151 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 152 | 0x09, 0xA7, // Usage (0xA7) 153 | 0x15, 0x00, // Logical Minimum (0) 154 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 155 | 0x75, 0x08, // Report Size (8) 156 | 0x95, 0x01, // Report Count (1) 157 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 158 | 0x65, 0x00, // Unit (None) 159 | 0x55, 0x00, // Unit Exponent (0) 160 | 0x09, 0x7C, // Usage (0x7C) 161 | 0x15, 0x00, // Logical Minimum (0) 162 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 163 | 0x75, 0x08, // Report Size (8) 164 | 0x95, 0x01, // Report Count (1) 165 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 166 | 0xC0, // End Collection 167 | 0x85, 0x04, // Report ID (4) 168 | 0x05, 0x06, // Usage Page (Generic Dev Ctrls) 169 | 0x09, 0x20, // Usage (Battery Strength) 170 | 0x15, 0x00, // Logical Minimum (0) 171 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 172 | 0x75, 0x08, // Report Size (8) 173 | 0x95, 0x01, // Report Count (1) 174 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 175 | 0xC0, // End Collection 176 | 0x00, // Unknown (bTag: 0x00, bType: 0x00) 177 | 178 | // 307 bytes 179 | 180 | // best guess: USB HID Report Descriptor``` 181 | 182 | Converted to tables of report IDs: 183 | ``` 184 | TBD 185 | ``` 186 | 187 | Button bitmap: 188 | ``` 189 | TBD 190 | ``` 191 | -------------------------------------------------------------------------------- /docs/descriptors/xbxs.md: -------------------------------------------------------------------------------- 1 | # USB Descriptor for Xbox Series X|S Wireless 2 | 3 | Hex dump of the controller descriptor: 4 | ``` 5 | # xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:0B13.000A/report_descriptor 6 | 7 | 05 01 09 05 a1 01 85 01 09 01 a1 00 09 30 09 31 15 00 27 ff 8 | ff 00 00 95 02 75 10 81 02 c0 09 01 a1 00 09 32 09 35 15 00 9 | 27 ff ff 00 00 95 02 75 10 81 02 c0 05 02 09 c5 15 00 26 ff 10 | 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 81 03 05 02 09 11 | c4 15 00 26 ff 03 95 01 75 0a 81 02 15 00 25 00 75 06 95 01 12 | 81 03 05 01 09 39 15 01 25 08 35 00 46 3b 01 66 14 00 75 04 13 | 95 01 81 42 75 04 95 01 15 00 25 00 35 00 45 00 65 00 81 03 14 | 05 09 19 01 29 0f 15 00 25 01 75 01 95 0f 81 02 15 00 25 00 15 | 75 01 95 01 81 03 05 0c 0a b2 00 15 00 25 01 95 01 75 01 81 16 | 02 15 00 25 00 75 07 95 01 81 03 05 0f 09 21 85 03 a1 02 09 17 | 97 15 00 25 01 75 04 95 01 91 02 15 00 25 00 75 04 95 01 91 18 | 03 09 70 15 00 25 64 75 08 95 04 91 02 09 50 66 01 10 55 0e 19 | 15 00 26 ff 00 75 08 95 01 91 02 09 a7 15 00 26 ff 00 75 08 20 | 95 01 91 02 65 00 55 00 09 7c 15 00 26 ff 00 75 08 95 01 91 21 | 02 c0 c0 22 | ``` 23 | 24 | Parsed descriptor: 25 | (via https://eleccelerator.com/usbdescreqparser/) 26 | ``` 27 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 28 | 0x09, 0x05, // Usage (Game Pad) 29 | 0xA1, 0x01, // Collection (Application) 30 | 0x85, 0x01, // Report ID (1) 31 | 0x09, 0x01, // Usage (Pointer) 32 | 0xA1, 0x00, // Collection (Physical) 33 | 0x09, 0x30, // Usage (X) 34 | 0x09, 0x31, // Usage (Y) 35 | 0x15, 0x00, // Logical Minimum (0) 36 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 37 | 0x95, 0x02, // Report Count (2) 38 | 0x75, 0x10, // Report Size (16) 39 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 40 | 0xC0, // End Collection 41 | 0x09, 0x01, // Usage (Pointer) 42 | 0xA1, 0x00, // Collection (Physical) 43 | 0x09, 0x32, // Usage (Z) 44 | 0x09, 0x35, // Usage (Rz) 45 | 0x15, 0x00, // Logical Minimum (0) 46 | 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) 47 | 0x95, 0x02, // Report Count (2) 48 | 0x75, 0x10, // Report Size (16) 49 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 50 | 0xC0, // End Collection 51 | 0x05, 0x02, // Usage Page (Sim Ctrls) 52 | 0x09, 0xC5, // Usage (Brake) 53 | 0x15, 0x00, // Logical Minimum (0) 54 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 55 | 0x95, 0x01, // Report Count (1) 56 | 0x75, 0x0A, // Report Size (10) 57 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 58 | 0x15, 0x00, // Logical Minimum (0) 59 | 0x25, 0x00, // Logical Maximum (0) 60 | 0x75, 0x06, // Report Size (6) 61 | 0x95, 0x01, // Report Count (1) 62 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 63 | 0x05, 0x02, // Usage Page (Sim Ctrls) 64 | 0x09, 0xC4, // Usage (Accelerator) 65 | 0x15, 0x00, // Logical Minimum (0) 66 | 0x26, 0xFF, 0x03, // Logical Maximum (1023) 67 | 0x95, 0x01, // Report Count (1) 68 | 0x75, 0x0A, // Report Size (10) 69 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 70 | 0x15, 0x00, // Logical Minimum (0) 71 | 0x25, 0x00, // Logical Maximum (0) 72 | 0x75, 0x06, // Report Size (6) 73 | 0x95, 0x01, // Report Count (1) 74 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 75 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 76 | 0x09, 0x39, // Usage (Hat switch) 77 | 0x15, 0x01, // Logical Minimum (1) 78 | 0x25, 0x08, // Logical Maximum (8) 79 | 0x35, 0x00, // Physical Minimum (0) 80 | 0x46, 0x3B, 0x01, // Physical Maximum (315) 81 | 0x66, 0x14, 0x00, // Unit (System: English Rotation, Length: Centimeter) 82 | 0x75, 0x04, // Report Size (4) 83 | 0x95, 0x01, // Report Count (1) 84 | 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State) 85 | 0x75, 0x04, // Report Size (4) 86 | 0x95, 0x01, // Report Count (1) 87 | 0x15, 0x00, // Logical Minimum (0) 88 | 0x25, 0x00, // Logical Maximum (0) 89 | 0x35, 0x00, // Physical Minimum (0) 90 | 0x45, 0x00, // Physical Maximum (0) 91 | 0x65, 0x00, // Unit (None) 92 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 93 | 0x05, 0x09, // Usage Page (Button) 94 | 0x19, 0x01, // Usage Minimum (0x01) 95 | 0x29, 0x0F, // Usage Maximum (0x0F) 96 | 0x15, 0x00, // Logical Minimum (0) 97 | 0x25, 0x01, // Logical Maximum (1) 98 | 0x75, 0x01, // Report Size (1) 99 | 0x95, 0x0F, // Report Count (15) 100 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 101 | 0x15, 0x00, // Logical Minimum (0) 102 | 0x25, 0x00, // Logical Maximum (0) 103 | 0x75, 0x01, // Report Size (1) 104 | 0x95, 0x01, // Report Count (1) 105 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 106 | 0x05, 0x0C, // Usage Page (Consumer) 107 | 0x0A, 0xB2, 0x00, // Usage (Record) 108 | 0x15, 0x00, // Logical Minimum (0) 109 | 0x25, 0x01, // Logical Maximum (1) 110 | 0x95, 0x01, // Report Count (1) 111 | 0x75, 0x01, // Report Size (1) 112 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 113 | 0x15, 0x00, // Logical Minimum (0) 114 | 0x25, 0x00, // Logical Maximum (0) 115 | 0x75, 0x07, // Report Size (7) 116 | 0x95, 0x01, // Report Count (1) 117 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 118 | 0x05, 0x0F, // Usage Page (PID Page) 119 | 0x09, 0x21, // Usage (0x21) 120 | 0x85, 0x03, // Report ID (3) 121 | 0xA1, 0x02, // Collection (Logical) 122 | 0x09, 0x97, // Usage (0x97) 123 | 0x15, 0x00, // Logical Minimum (0) 124 | 0x25, 0x01, // Logical Maximum (1) 125 | 0x75, 0x04, // Report Size (4) 126 | 0x95, 0x01, // Report Count (1) 127 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 128 | 0x15, 0x00, // Logical Minimum (0) 129 | 0x25, 0x00, // Logical Maximum (0) 130 | 0x75, 0x04, // Report Size (4) 131 | 0x95, 0x01, // Report Count (1) 132 | 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 133 | 0x09, 0x70, // Usage (0x70) 134 | 0x15, 0x00, // Logical Minimum (0) 135 | 0x25, 0x64, // Logical Maximum (100) 136 | 0x75, 0x08, // Report Size (8) 137 | 0x95, 0x04, // Report Count (4) 138 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 139 | 0x09, 0x50, // Usage (0x50) 140 | 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) 141 | 0x55, 0x0E, // Unit Exponent (-2) 142 | 0x15, 0x00, // Logical Minimum (0) 143 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 144 | 0x75, 0x08, // Report Size (8) 145 | 0x95, 0x01, // Report Count (1) 146 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 147 | 0x09, 0xA7, // Usage (0xA7) 148 | 0x15, 0x00, // Logical Minimum (0) 149 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 150 | 0x75, 0x08, // Report Size (8) 151 | 0x95, 0x01, // Report Count (1) 152 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 153 | 0x65, 0x00, // Unit (None) 154 | 0x55, 0x00, // Unit Exponent (0) 155 | 0x09, 0x7C, // Usage (0x7C) 156 | 0x15, 0x00, // Logical Minimum (0) 157 | 0x26, 0xFF, 0x00, // Logical Maximum (255) 158 | 0x75, 0x08, // Report Size (8) 159 | 0x95, 0x01, // Report Count (1) 160 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 161 | 0xC0, // End Collection 162 | 0xC0, // End Collection 163 | 164 | // 283 bytes 165 | 166 | // best guess: USB HID Report Descriptor 167 | ``` 168 | 169 | btmon Logs: 170 | ``` 171 | Bluetooth monitor ver 5.55 172 | = Note: Linux version 5.10.5-arch1-1 (x86_64) 0.182753 173 | = Note: Bluetooth subsystem version 2.22 0.182760 174 | = New Index: 9C:FC:E8:B8:2C:A6 (Primary,USB,hci0) [hci0] 0.182763 175 | = Open Index: 9C:FC:E8:B8:2C:A6 [hci0] 0.182765 176 | = Index Info: 9C:FC:E8:B8:2C:A6 (Intel Corp.) [hci0] 0.182767 177 | @ MGMT Open: bluetoothd (privileged) version 1.18 {0x0001} 0.182770 178 | > ACL Data RX: Handle 256 flags 0x02 dlen 14 #1 [hci0] 0.254476 179 | Channel: 65 len 10 [PSM 0 mode Basic (0x00)] {chan 65535} 180 | a1 01 00 00 00 00 00 00 00 00 .......... 181 | 182 | 183 | ## select 184 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #2 [hci0] 3.043182 185 | ATT: Handle Value Notification (0x1b) len 18 186 | Handle: 0x001e 187 | Data: eb7e5f80eb7f85800000000000000800 188 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #3 [hci0] 3.160076 189 | ATT: Handle Value Notification (0x1b) len 18 190 | Handle: 0x001e 191 | Data: eb7e5f80eb7f85800000000000000800 192 | ## share 193 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #27 [hci0] 5.140647 194 | ATT: Handle Value Notification (0x1b) len 18 195 | Handle: 0x001e 196 | Data: eb7e5f80eb7f85800000000000000001 197 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #28 [hci0] 5.230076 198 | ATT: Handle Value Notification (0x1b) len 18 199 | Handle: 0x001e 200 | Data: eb7e5f80eb7f85800000000000000001 201 | ## back 202 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #43 [hci0] 6.535466 203 | ATT: Handle Value Notification (0x1b) len 18 204 | Handle: 0x001e 205 | Data: eb7e5f80eb7f85800000000000000400 206 | > ACL Data RX: Handle 3586 flags 0x02 dlen 23 #44 [hci0] 6.580045 207 | ATT: Handle Value Notification (0x1b) len 18 208 | Handle: 0x001e 209 | Data: eb7e5f80eb7f85800000000000000400 210 | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 211 | 1 2 3 4 5 6 7 8 9 10 12 14 16 212 | 11 13 15 213 | 214 | [15] = 0x04 Back 215 | [15] = 0x08 Select 216 | [16] = 0x01 Share 217 | ``` 218 | -------------------------------------------------------------------------------- /docs/heuristics/gamesir-nova.md: -------------------------------------------------------------------------------- 1 | # GameSir Nova OUIs 2 | 3 | Gamesir Nova uses random MAC OUIs. We collect them here to implement a 4 | working heuristic matcher. 5 | 6 | We also collect OUIs here which should not match the heuristics because we 7 | are seeing conflicts with some official vendors. 8 | 9 | Officially validated OUIs are marked with a "+". 10 | 11 | | OUI | Vendor | Bit representation | descriptor length 12 | | ------------ | --------- | --------------------------------------- | ------------------- 13 | | 3E:42:6C | GameSir | `0011 1110 : 0100 0010 : 0110 1100` | 283 14 | | ED:BC:9A | GameSir | `1110 1101 : 1011 1100 : 1001 1010` | 283 15 | | 6A:07:14 | GameSir | `0110 1010 : 0000 0111 : 0001 0100` | 283 16 | | **AND mask** | | **`0010 1000 : 0000 0000 : 0000 0000`** | **mask 0x28** 17 | | 3C:FA:06 + | Microsoft | `0011 1100 : 1111 1010 : 0000 0110` | 283 inval match 18 | | 44:16:22 + | Microsoft | `0100 0100 : 0001 0110 : 0010 0010` | 19 | | 68:6C:E6 + | Microsoft | `0110 1000 : 0110 1100 : 1110 0110` | 283 inval match 20 | | 98:7A:14 + | Microsoft | `1001 1000 : 0111 1010 : 0001 0100` | 21 | | AC:8E:BD + | Microsoft | `1010 1100 : 1000 1110 : 1011 1101` | 283 inval match 22 | | C8:3F:26 + | Microsoft | `1100 1000 : 0011 1111 : 0010 0110` | 23 | | **AND mask** | | **`0000 0000 : 0000 0000 : 0000 0000`** | **mask 0x00** 24 | | 98:B6:E9 + | Nintendo | `1001 1000 : 1011 0110 : 1110 1001` | 25 | | **AND mask** | | **`0010 1000 : 1011 0110 : 1110 1001`** | **mask 0x98 B6 E9** 26 | | 98:B6:E8 | GuliKit | `1001 1000 : 1011 0110 : 1110 1000` | 27 | | 98:B6:EA | GuliKit | `1001 1000 : 1011 0110 : 1110 1010` | 28 | | 98:B6:EC | GuliKit | `1001 1000 : 1011 0110 : 1110 1100` | 29 | | **AND mask** | | **`0010 1000 : 1011 0110 : 1110 1000`** | **mask 0x98 B6 E8** 30 | | E4:17:D8 + | 8BitDo | `1110 0100 : 0001 0111 : 1101 1000` | 31 | | **AND mask** | | **`1110 0100 : 0001 0111 : 1101 1000`** | **mask 0xE4 17 D8** 32 | -------------------------------------------------------------------------------- /docs/img/battery_support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atar-axis/xpadneo/cd256807c5f916735ae18749c43d5b0bd73240fa/docs/img/battery_support.png -------------------------------------------------------------------------------- /docs/img/xpadneo-sq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atar-axis/xpadneo/cd256807c5f916735ae18749c43d5b0bd73240fa/docs/img/xpadneo-sq.png -------------------------------------------------------------------------------- /docs/img/xpadneo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atar-axis/xpadneo/cd256807c5f916735ae18749c43d5b0bd73240fa/docs/img/xpadneo.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | {% include_relative README.md %} 2 | {% include_relative BT_DONGLES.md %} 3 | {% include_relative CONFIGURATION.md %} 4 | {% include_relative TROUBLESHOOTING.md %} 5 | {% include_relative PACKAGING.md %} 6 | {% include_relative DEBUGGING.md %} 7 | {% include_relative 3P-BUGS.md %} 8 | {% include_relative SDL.md %} 9 | -------------------------------------------------------------------------------- /docs/reports/xb1s_battery_event.md: -------------------------------------------------------------------------------- 1 | # Report ID 0x04 2 | 3 | Received from device 4 | ``` 5 | | ID | Byte 1 | 6 | ---------------------- 7 | | 04 | battery flags | 8 | ``` 9 | 10 | Flags 11 | ``` 12 | msb ID 04 lsb 13 | +---+---+---+---+---+---+---+---+ 14 | | O | R | E | C | M | M | L | L | 15 | +---+---+---+---+---+---+---+---+ 16 | O: Online (always 1, except shutdown) 17 | R: Reserved / Unused 18 | E: Error (?) / Unknown 19 | C: Charging, I mean really charging the battery (P 'n C) 20 | not (only) the power cord powering the controller 21 | M M: Mode 22 | 00: Powered by USB 23 | 01: Powered by (disposable) batteries 24 | 10: Powered by Play 'n Charge battery pack (only, no cable) 25 | 26 | L L: Capacity Level (always 0 with M=00) 27 | 00: (Super) Critical 28 | 01: Low 29 | 10: Medium 30 | 11: Full 31 | ``` 32 | -------------------------------------------------------------------------------- /hid-xpadneo/Makefile: -------------------------------------------------------------------------------- 1 | KERNEL_SOURCE_DIR ?= /lib/modules/$(shell uname -r)/build 2 | LD := ld.bfd 3 | 4 | all: modules 5 | 6 | .INTERMEDIATE: ../VERSION 7 | 8 | ../VERSION: 9 | $(MAKE) -C .. $(@:../%=%) 10 | 11 | # convenience rules for local development 12 | 13 | clean modules modules_install: ../VERSION 14 | $(MAKE) -C $(KERNEL_SOURCE_DIR) INSTALL_MOD_DIR="kernel/drivers/hid" LD=$(LD) M=$(shell pwd)/src VERSION="$(shell cat ../VERSION)" $@ 15 | 16 | reinstall: modules 17 | sudo make modules_install 18 | sudo rmmod hid-xpadneo || true 19 | sudo modprobe hid-xpadneo $(MOD_PARAMS) 20 | 21 | # DKMS support rules 22 | 23 | dkms.conf: dkms.conf.in ../VERSION 24 | sed 's/"@DO_NOT_CHANGE@"/"$(shell cat ../VERSION)"/g' <"$<" >"$@" 25 | -------------------------------------------------------------------------------- /hid-xpadneo/dkms.conf.in: -------------------------------------------------------------------------------- 1 | # vim:syntax=bash 2 | 3 | PACKAGE_NAME="hid-xpadneo" 4 | PACKAGE_VERSION="@DO_NOT_CHANGE@" 5 | 6 | BUILT_MODULE_NAME[0]="hid-xpadneo" 7 | BUILT_MODULE_LOCATION[0]="src" 8 | DEST_MODULE_LOCATION[0]="/kernel/drivers/hid" 9 | 10 | MAKE[0]="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' VERSION='${PACKAGE_VERSION}' modules" 11 | CLEAN="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' clean" 12 | 13 | BUILD_EXCLUSIVE_KERNEL_MIN="4.18.0" 14 | BUILD_EXCLUSIVE_CONFIG="CONFIG_HID CONFIG_INPUT_FF_MEMLESS CONFIG_POWER_SUPPLY" 15 | 16 | AUTOINSTALL="yes" 17 | 18 | POST_INSTALL="dkms.post_install" 19 | POST_REMOVE="dkms.post_remove" 20 | -------------------------------------------------------------------------------- /hid-xpadneo/dkms.post_install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #TODO Remove ERTM after kernel patch is deployed in the wild 4 | ERTM_OVERRIDE="/etc/modprobe.d/99-xpadneo-bluetooth.conf" 5 | DISABLE_ERTM="/sys/module/bluetooth/parameters/disable_ertm" 6 | 7 | if [ "$(uname -r | awk -F. '{ printf "%03d%03d",$1,$2 }')" -ge 005012 ]; then 8 | echo "Not disabling ERTM, kernel version doesn't require it..." 9 | elif [ "$(readlink "${ERTM_OVERRIDE}" 2>/dev/null)" = "/dev/null" ]; then 10 | echo "Not disabling ERTM, local override in place..." 11 | elif [ -L "${ERTM_OVERRIDE}" ]; then 12 | echo >&2 "WARNING: '${ERTM_OVERRIDE}' is an arbitrary symlink, this is not supported." 13 | echo >&2 "Skipping ERTM fixup, you're expected to manage the options on your own..." 14 | else 15 | echo "Disabling ERTM permanently (requires reboot)..." 16 | echo "options bluetooth disable_ertm=y" >"${ERTM_OVERRIDE}" 17 | echo "HINT: If you want to prevent this in the future, run 'ln -snf /dev/null ${ERTM_OVERRIDE}'." 18 | 19 | if [ -w "${DISABLE_ERTM}" ]; then 20 | echo "Disabling ERTM instantly..." 21 | echo "Y" >"${DISABLE_ERTM}" 22 | fi 23 | fi 24 | 25 | echo "Installing modalias database..." 26 | install -D -m 0644 -t /etc/modprobe.d etc-modprobe.d/xpadneo.conf 27 | 28 | echo "Installing udev rules..." 29 | install -D -m 0644 -t /etc/udev/rules.d etc-udev-rules.d/60-xpadneo.rules 30 | install -D -m 0644 -t /etc/udev/rules.d etc-udev-rules.d/70-xpadneo-disable-hidraw.rules 31 | 32 | echo "Reloading udev..." 33 | udevadm control --reload 34 | -------------------------------------------------------------------------------- /hid-xpadneo/dkms.post_remove: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #TODO Remove ERTM after kernel patch is deployed in the wild 4 | ERTM_OVERRIDE="/etc/modprobe.d/99-xpadneo-bluetooth.conf" 5 | 6 | [ -L "${ERTM_OVERRIDE}" ] || { echo "Uninstalling ERTM override..."; rm -f "${ERTM_OVERRIDE}"; } 7 | 8 | echo "Uninstalling modalias database..." 9 | rm -f /etc/modprobe.d/xpadneo.conf 10 | 11 | echo "Uninstalling udev rules..." 12 | rm -f /etc/udev/rules.d/70-xpadneo-disable-hidraw.rules 13 | rm -f /etc/udev/rules.d/60-xpadneo.rules 14 | 15 | echo "Reloading udev..." 16 | udevadm control --reload 17 | -------------------------------------------------------------------------------- /hid-xpadneo/etc-modprobe.d/xpadneo.conf: -------------------------------------------------------------------------------- 1 | alias hid:b0005g*v0000045Ep000002E0 hid_xpadneo 2 | alias hid:b0005g*v0000045Ep000002FD hid_xpadneo 3 | alias hid:b0005g*v0000045Ep00000B05 hid_xpadneo 4 | alias hid:b0005g*v0000045Ep00000B13 hid_xpadneo 5 | alias hid:b0005g*v0000045Ep00000B20 hid_xpadneo 6 | alias hid:b0005g*v0000045Ep00000B22 hid_xpadneo 7 | -------------------------------------------------------------------------------- /hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules: -------------------------------------------------------------------------------- 1 | # Rebind driver to xpadneo 2 | ACTION=="bind", SUBSYSTEM=="hid", DRIVER!="xpadneo", KERNEL=="0005:045E:*", KERNEL=="*:02FD.*|*:02E0.*|*:0B05.*|*:0B13.*|*:0B20.*|*:0B22.*", ATTR{driver/unbind}="%k", ATTR{[drivers/hid:xpadneo]bind}="%k" 3 | 4 | # Tag xpadneo devices for access in the user session 5 | ACTION=="add|change", DRIVERS=="xpadneo", SUBSYSTEM=="input", TAG+="uaccess" 6 | -------------------------------------------------------------------------------- /hid-xpadneo/etc-udev-rules.d/70-xpadneo-disable-hidraw.rules: -------------------------------------------------------------------------------- 1 | #FIXME(issue-291) Work around Steamlink not properly detecting the mappings 2 | #FIXME(issue-457) Word around QMK overriding our hidraw rules 3 | ACTION=="add|change", DRIVERS=="xpadneo", SUBSYSTEM=="hidraw", MODE:="0000", TAG-="uaccess" 4 | -------------------------------------------------------------------------------- /hid-xpadneo/src/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{c,h}] 2 | indent_style = tab 3 | indent_size = 8 4 | -------------------------------------------------------------------------------- /hid-xpadneo/src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the HID driver 3 | # 4 | ccflags-y += -DVERSION=$(VERSION) 5 | obj-m += hid-xpadneo.o 6 | 7 | #FIXME(kakra) Work-around, cleanup after source code split 8 | hid-xpadneo-y += xpadneo.o 9 | $(obj)/xpadneo.c: $(src)/hid-xpadneo.c 10 | cp $< $@ 11 | 12 | hid-xpadneo-y += xpadneo/core.o xpadneo/consumer.o xpadneo/keyboard.o 13 | -------------------------------------------------------------------------------- /hid-xpadneo/src/hid-ids.h: -------------------------------------------------------------------------------- 1 | #ifndef HID_IDS_H_FILE 2 | #define HID_IDS_H_FILE 3 | 4 | #define USB_VENDOR_ID_MICROSOFT 0x045e 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /hid-xpadneo/src/xpadneo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Force feedback support for XBOX ONE S and X gamepads via Bluetooth 3 | * 4 | * This driver was developed for a student project at fortiss GmbH in Munich. 5 | * Copyright (c) 2017 Florian Dollinger 6 | * 7 | * Additional features and code redesign 8 | * Copyright (c) 2020 Kai Krakow 9 | */ 10 | 11 | #ifndef XPADNEO_H_FILE 12 | #define XPADNEO_H_FILE 13 | 14 | #include 15 | #include 16 | 17 | #include "hid-ids.h" 18 | 19 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0) 20 | #error "kernel version 4.18.0+ required for HID_QUIRK_INPUT_PER_APP" 21 | #endif 22 | 23 | #ifndef VERSION 24 | #error "xpadneo version not defined" 25 | #endif 26 | 27 | #define XPADNEO_VERSION __stringify(VERSION) 28 | 29 | /* helper for printing a notice only once */ 30 | #ifndef hid_notice_once 31 | #define hid_notice_once(hid, fmt, ...) \ 32 | do { \ 33 | static bool __print_once __read_mostly; \ 34 | if (!__print_once) { \ 35 | __print_once = true; \ 36 | hid_notice(hid, fmt, ##__VA_ARGS__); \ 37 | } \ 38 | } while (0) 39 | #endif 40 | 41 | /* benchmark helper */ 42 | #define xpadneo_benchmark_start(name) \ 43 | do { \ 44 | unsigned long __##name_jiffies = jiffies; \ 45 | pr_info("xpadneo " #name " start\n") 46 | #define xpadneo_benchmark_stop(name) \ 47 | pr_info("xpadneo " #name " took %ums\n", jiffies_to_msecs(jiffies - __##name_jiffies)); \ 48 | } while (0) 49 | 50 | /* button aliases */ 51 | #define BTN_PADDLES(b) (BTN_TRIGGER_HAPPY5+(b)) 52 | #define BTN_SHARE KEY_F12 53 | #define BTN_XBOX BTN_MODE 54 | 55 | /* module parameter "trigger_rumble_mode" */ 56 | #define PARAM_TRIGGER_RUMBLE_PRESSURE 0 57 | #define PARAM_TRIGGER_RUMBLE_RESERVED 1 58 | #define PARAM_TRIGGER_RUMBLE_DISABLE 2 59 | 60 | /* module parameter "quirks" */ 61 | #define XPADNEO_QUIRK_NO_PULSE 1 62 | #define XPADNEO_QUIRK_NO_TRIGGER_RUMBLE 2 63 | #define XPADNEO_QUIRK_NO_MOTOR_MASK 4 64 | #define XPADNEO_QUIRK_USE_HW_PROFILES 8 65 | #define XPADNEO_QUIRK_LINUX_BUTTONS 16 66 | #define XPADNEO_QUIRK_NINTENDO 32 67 | #define XPADNEO_QUIRK_SHARE_BUTTON 64 68 | #define XPADNEO_QUIRK_REVERSE_MASK 128 69 | #define XPADNEO_QUIRK_SWAPPED_MASK 256 70 | #define XPADNEO_QUIRK_NO_HEURISTICS 512 71 | 72 | #define XPADNEO_QUIRK_NO_HAPTICS (XPADNEO_QUIRK_NO_PULSE|XPADNEO_QUIRK_NO_MOTOR_MASK) 73 | #define XPADNEO_QUIRK_SIMPLE_CLONE (XPADNEO_QUIRK_NO_HAPTICS|XPADNEO_QUIRK_NO_TRIGGER_RUMBLE) 74 | 75 | /* MAC OUI masks */ 76 | #define XPADNEO_OUI_MASK(oui,mask) (((oui)&(mask))==(mask)) 77 | #define XPADNEO_OUI_MASK_GAMESIR_NOVA 0x28 78 | 79 | /* timing of rumble commands to work around firmware crashes */ 80 | #define XPADNEO_RUMBLE_THROTTLE_DELAY msecs_to_jiffies(50) 81 | #define XPADNEO_RUMBLE_THROTTLE_JIFFIES (jiffies + XPADNEO_RUMBLE_THROTTLE_DELAY) 82 | 83 | /* helpers */ 84 | #define SWAP_BITS(v,b1,b2) \ 85 | (((v)>>(b1)&1)==((v)>>(b2)&1)?(v):(v^(1ULL<<(b1))^(1ULL<<(b2)))) 86 | 87 | /* rumble motors enable bits */ 88 | enum xpadneo_rumble_motors { 89 | FF_RUMBLE_NONE = 0x00, 90 | FF_RUMBLE_WEAK = 0x01, 91 | FF_RUMBLE_STRONG = 0x02, 92 | FF_RUMBLE_MAIN = FF_RUMBLE_WEAK | FF_RUMBLE_STRONG, 93 | FF_RUMBLE_RIGHT = 0x04, 94 | FF_RUMBLE_LEFT = 0x08, 95 | FF_RUMBLE_TRIGGERS = FF_RUMBLE_LEFT | FF_RUMBLE_RIGHT, 96 | FF_RUMBLE_ALL = 0x0F 97 | } __packed; 98 | 99 | /* rumble packet structure */ 100 | struct ff_data { 101 | enum xpadneo_rumble_motors enable; 102 | u8 magnitude_left; 103 | u8 magnitude_right; 104 | u8 magnitude_strong; 105 | u8 magnitude_weak; 106 | u8 pulse_sustain_10ms; 107 | u8 pulse_release_10ms; 108 | u8 loop_count; 109 | } __packed; 110 | #ifdef static_assert 111 | static_assert(sizeof(struct ff_data) == 8); 112 | #endif 113 | 114 | /* report number for rumble commands */ 115 | #define XPADNEO_XB1S_FF_REPORT 0x03 116 | 117 | /* maximum length of report 0x01 for duplicate packet filtering */ 118 | #define XPADNEO_REPORT_0x01_LENGTH (55+1) 119 | 120 | /* HID packet for rumble commands */ 121 | struct ff_report { 122 | u8 report_id; 123 | struct ff_data ff; 124 | } __packed; 125 | #ifdef static_assert 126 | static_assert(sizeof(struct ff_report) == 9); 127 | #endif 128 | 129 | /* trigger range limits implemented in XBE2 controllers */ 130 | enum xpadneo_trigger_scale { 131 | XBOX_TRIGGER_SCALE_FULL, 132 | XBOX_TRIGGER_SCALE_HALF, 133 | XBOX_TRIGGER_SCALE_DIGITAL, 134 | XBOX_TRIGGER_SCALE_NUM 135 | } __packed; 136 | 137 | #define XPADNEO_MISSING_CONSUMER 1 138 | #define XPADNEO_MISSING_GAMEPAD 2 139 | #define XPADNEO_MISSING_KEYBOARD 4 140 | 141 | /* private driver instance data */ 142 | struct xpadneo_devdata { 143 | /* unique physical device id (randomly assigned) */ 144 | int id; 145 | 146 | /* logical device interfaces */ 147 | struct hid_device *hdev; 148 | struct input_dev *consumer, *gamepad, *keyboard; 149 | bool consumer_sync, gamepad_sync, keyboard_sync; 150 | short int missing_reported; 151 | 152 | /* revert fixups on removal */ 153 | u16 original_product; 154 | u32 original_version; 155 | 156 | /* quirk flags */ 157 | unsigned int original_rsize; 158 | u32 quirks; 159 | 160 | /* profile switching */ 161 | bool xbox_button_down, profile_switched; 162 | u8 profile; 163 | 164 | /* mouse mode */ 165 | bool mouse_mode; 166 | 167 | /* trigger scale */ 168 | struct { 169 | u8 left, right; 170 | } trigger_scale; 171 | 172 | /* battery information */ 173 | struct { 174 | bool initialized; 175 | struct power_supply *psy; 176 | struct power_supply_desc desc; 177 | char *name; 178 | char *name_pnc; 179 | u8 report_id; 180 | u8 flags; 181 | } battery; 182 | 183 | /* duplicate report buffers */ 184 | u8 input_report_0x01[XPADNEO_REPORT_0x01_LENGTH]; 185 | 186 | /* axis states */ 187 | u8 count_abs_z_rz; 188 | s32 last_abs_z; 189 | s32 last_abs_rz; 190 | 191 | /* buffer for ff_worker */ 192 | spinlock_t ff_lock; 193 | struct delayed_work ff_worker; 194 | unsigned long ff_throttle_until; 195 | bool ff_scheduled; 196 | struct ff_data ff; 197 | struct ff_data ff_shadow; 198 | void *output_report_dmabuf; 199 | }; 200 | 201 | extern int xpadneo_init_consumer(struct xpadneo_devdata *); 202 | extern int xpadneo_init_keyboard(struct xpadneo_devdata *); 203 | extern int xpadneo_init_synthetic(struct xpadneo_devdata *, char *, struct input_dev **); 204 | extern void xpadneo_report(struct hid_device *, struct hid_report *); 205 | extern void xpadneo_core_missing(struct xpadneo_devdata *, u32); 206 | 207 | #endif 208 | -------------------------------------------------------------------------------- /hid-xpadneo/src/xpadneo/consumer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xpadneo consumer control driver 3 | * 4 | * Copyright (c) 2021 Kai Krakow 5 | */ 6 | 7 | #include "../xpadneo.h" 8 | 9 | extern int xpadneo_init_consumer(struct xpadneo_devdata *xdata) 10 | { 11 | struct hid_device *hdev = xdata->hdev; 12 | int ret, synth = 0; 13 | 14 | if (!xdata->consumer) { 15 | synth = 1; 16 | ret = xpadneo_init_synthetic(xdata, "Consumer Control", &xdata->consumer); 17 | if (ret || !xdata->consumer) 18 | return ret; 19 | } 20 | 21 | if (synth) { 22 | ret = input_register_device(xdata->consumer); 23 | if (ret) { 24 | hid_err(hdev, "failed to register consumer control\n"); 25 | return ret; 26 | } 27 | 28 | hid_info(hdev, "consumer control added\n"); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /hid-xpadneo/src/xpadneo/core.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xpadneo driver core 3 | * 4 | * Copyright (c) 2021 Kai Krakow 5 | */ 6 | 7 | #include "../xpadneo.h" 8 | 9 | extern int xpadneo_init_synthetic(struct xpadneo_devdata *xdata, char *suffix, 10 | struct input_dev **devp) 11 | { 12 | struct hid_device *hdev = xdata->hdev; 13 | struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); 14 | size_t suffix_len, name_len; 15 | 16 | if (!input_dev) 17 | return -ENOMEM; 18 | 19 | name_len = strlen(hdev->name); 20 | suffix_len = strlen(suffix); 21 | if ((name_len < suffix_len) || strcmp(hdev->name + name_len - suffix_len, suffix)) { 22 | input_dev->name = kasprintf(GFP_KERNEL, "%s %s", hdev->name, suffix); 23 | if (!input_dev->name) 24 | return -ENOMEM; 25 | } 26 | 27 | dev_set_drvdata(&input_dev->dev, xdata); 28 | input_dev->phys = hdev->phys; 29 | input_dev->uniq = hdev->uniq; 30 | input_dev->id.bustype = hdev->bus; 31 | input_dev->id.vendor = hdev->vendor; 32 | input_dev->id.product = hdev->product; 33 | input_dev->id.version = hdev->version; 34 | 35 | *devp = input_dev; 36 | return 0; 37 | } 38 | 39 | extern void xpadneo_report(struct hid_device *hdev, struct hid_report *report) 40 | { 41 | struct xpadneo_devdata *xdata = hid_get_drvdata(hdev); 42 | 43 | if (xdata->consumer && xdata->consumer_sync) { 44 | xdata->consumer_sync = false; 45 | input_sync(xdata->consumer); 46 | } 47 | 48 | if (xdata->gamepad && xdata->gamepad_sync) { 49 | xdata->gamepad_sync = false; 50 | input_sync(xdata->gamepad); 51 | } 52 | 53 | if (xdata->keyboard && xdata->keyboard_sync) { 54 | xdata->keyboard_sync = false; 55 | input_sync(xdata->keyboard); 56 | } 57 | } 58 | 59 | extern void xpadneo_core_missing(struct xpadneo_devdata *xdata, u32 flag) 60 | { 61 | struct hid_device *hdev = xdata->hdev; 62 | 63 | if ((xdata->missing_reported & flag) == 0) { 64 | xdata->missing_reported |= flag; 65 | switch (flag) { 66 | case XPADNEO_MISSING_GAMEPAD: 67 | hid_err(hdev, "gamepad not detected\n"); 68 | break; 69 | case XPADNEO_MISSING_KEYBOARD: 70 | hid_err(hdev, "keyboard not detected\n"); 71 | break; 72 | default: 73 | hid_err(hdev, "unexpected subdevice missing: %d\n", flag); 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /hid-xpadneo/src/xpadneo/keyboard.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xpadneo keyboard driver 3 | * 4 | * Copyright (c) 2021 Kai Krakow 5 | */ 6 | 7 | #include "../xpadneo.h" 8 | 9 | extern int xpadneo_init_keyboard(struct xpadneo_devdata *xdata) 10 | { 11 | struct hid_device *hdev = xdata->hdev; 12 | int ret, synth = 0; 13 | 14 | if (!xdata->keyboard) { 15 | synth = 1; 16 | ret = xpadneo_init_synthetic(xdata, "Keyboard", &xdata->keyboard); 17 | if (ret || !xdata->keyboard) 18 | return ret; 19 | } 20 | 21 | /* enable key events for keyboard */ 22 | input_set_capability(xdata->keyboard, EV_KEY, BTN_SHARE); 23 | 24 | if (synth) { 25 | ret = input_register_device(xdata->keyboard); 26 | if (ret) { 27 | hid_err(hdev, "failed to register keyboard\n"); 28 | return ret; 29 | } 30 | 31 | hid_info(hdev, "keyboard added\n"); 32 | } 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | source "lib/options.sh" 5 | source "lib/installer.sh" 6 | 7 | set -e 8 | 9 | if [[ ! -d /sys/devices/virtual/misc/uhid ]]; then 10 | 11 | >&2 echo "WARNING: kernel uhid module not found, controller firmware 5.x will not be supported" 12 | 13 | fi 14 | 15 | echo "* deploying DKMS package" 16 | make "${MAKE_OPTS[@]}" VERSION="${VERSION}" install || maybe_already_installed 17 | 18 | echo "* building module" 19 | dkms build "${V[@]}" "hid-xpadneo/${VERSION}" || cat_dkms_make_log 20 | 21 | echo "* installing module" 22 | dkms install "${V[@]}" "${FORCE}" "hid-xpadneo/${VERSION}" 23 | -------------------------------------------------------------------------------- /lib/installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -n "${PREFIX}" ] && { echo >&2 "ERROR: Prefix installations are not supported, use make instead."; exit 1; } 4 | 5 | if [ ${EUID} -ne 0 ]; then 6 | echo >&2 "ERROR: You most probably need superuser privileges to use this script, please run me via sudo!" 7 | exit 3 8 | fi 9 | 10 | # shellcheck disable=SC2034 11 | GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true) 12 | 13 | __version() { 14 | git describe --tags --dirty 2>/dev/null || sed -re's/v?(.*)/v\1/' "$(dirname "${BASH_SOURCE[0]}")/../VERSION" || { 15 | echo >&2 "ERROR: If you install from a git repository, you may need to run" 16 | echo >&2 "ERROR: sudo git config --global --add safe.directory \$PWD" 17 | echo >&2 "ERROR: to trust this git checkout for the root user." 18 | echo >&2 "ERROR: See https://github.com/atar-axis/xpadneo/issues/346" 19 | echo >&2 20 | echo >&2 "HINT: Do not clone forks directly, add them as remotes to your" 21 | echo >&2 "HINT: original clone. See docs/TESTING.md" 22 | exit 3 23 | } 24 | } 25 | 26 | __version_lte() { 27 | [ "$1" = "$(echo -e "$1\n${2/-/.9999-}" | sort -V | head -n1)" ] 28 | } 29 | 30 | # shellcheck disable=SC2034 31 | VERSION=$(__version) 32 | 33 | DKMS_BIN=$(type -p dkms) 34 | 35 | # shellcheck disable=SC2086 36 | : ${DKMS_BIN:?Please install dkms to continue} 37 | 38 | get_dkms_versions_installed() { 39 | ${DKMS_BIN} status 2>/dev/null | tr -s ':,/ ' ' ' | awk -- '$1 == "hid-xpadneo" { print $2 }' | sort -nu 40 | } 41 | 42 | get_upstream_version_latest() { 43 | curl -sI "https://github.com/atar-axis/xpadneo/releases/latest" | \ 44 | awk -- 'BEGIN{IGNORECASE=1} /^location:/ { n = split($2, v, /\//); print v[n]; exit }' | \ 45 | tr -d '[:space:]' 46 | } 47 | 48 | cat_dkms_make_log() { 49 | local last_error=$? 50 | if [ -n "${V[*]}" ]; then 51 | cat "/var/lib/dkms/hid-xpadneo/${VERSION}/build/make.log" || true 52 | fi 53 | exit ${last_error} 54 | } 55 | 56 | maybe_already_installed() { 57 | local last_error=$? 58 | >&2 echo "HINT: Try uninstalling xpadneo first" 59 | exit $last_error 60 | } 61 | 62 | # shellcheck disable=SC2034 63 | mapfile -t INSTALLED < <(get_dkms_versions_installed) 64 | -------------------------------------------------------------------------------- /lib/options.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck disable=SC2046 4 | OPTIONS=$(getopt --name "$0" --longoptions "force,kernelsourcedir:,verbose" -- "" "$@") || exit 1 5 | # shellcheck disable=SC2086 6 | eval set -- $OPTIONS 7 | 8 | while true; do 9 | case "$1" in 10 | --force) 11 | # shellcheck disable=SC2034 12 | FORCE="--force" 13 | ;; 14 | --kernelsourcedir) 15 | shift 16 | # shellcheck disable=SC2034 17 | KERNEL_SOURCE_DIR="--kernelsourcedir=$1" 18 | ;; 19 | --verbose) 20 | echo "* verbose mode enabled" 21 | # shellcheck disable=SC2034 22 | V=("$1") 23 | ;; 24 | --) 25 | shift 26 | break 27 | ;; 28 | *) 29 | echo "usage: $0 [--kernelsourcedir] [--verbose]" 30 | exit 1 31 | esac 32 | shift 33 | done 34 | 35 | # shellcheck disable=SC2034 36 | [ ${#V[*]} -gt 0 ] || MAKE_OPTS=("-s") 37 | [ ${#V[*]} -eq 0 ] || set -x 38 | -------------------------------------------------------------------------------- /misc/examples/c_hidraw/Makefile: -------------------------------------------------------------------------------- 1 | PROGRAM = hidraw 2 | 3 | CFLAGS += $(shell pkg-config ncurses --cflags) 4 | LDFLAGS += $(shell pkg-config ncurses --libs) 5 | 6 | SRC = hidraw.c 7 | 8 | OBJ = $(SRC:.c=.o) 9 | 10 | .PHONY: all clean 11 | 12 | all: $(PROGRAM) 13 | 14 | $(PROGRAM): $(OBJ) 15 | $(CC) $< $(LDFLAGS) -o $@ 16 | 17 | %.o: %.c 18 | $(CC) $(CFLAGS) -c $< -o $@ 19 | 20 | clean: 21 | rm -f $(PROGRAM) $(OBJ) 22 | -------------------------------------------------------------------------------- /misc/examples/c_hidraw/hidraw.c: -------------------------------------------------------------------------------- 1 | /* hidraw test, bypassing the driver for rumble control 2 | * for Xbox compatible devices only, use at your own risk 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | typedef unsigned char u8; 13 | 14 | static struct ff_pack_t { 15 | char cmd; 16 | struct { 17 | u8 weak:1; 18 | u8 strong:1; 19 | u8 right:1; 20 | u8 left:1; 21 | } enable; 22 | struct { 23 | u8 left; 24 | u8 right; 25 | u8 strong; 26 | u8 weak; 27 | } strength; 28 | struct { 29 | u8 sustain_10ms; 30 | u8 release_10ms; 31 | u8 loop_count; 32 | } pulse; 33 | } ff_pack; 34 | 35 | WINDOW *input, *output; 36 | 37 | static void print_pack(WINDOW * window) 38 | { 39 | if (window == output) { 40 | scroll(output); 41 | wmove(output, LINES - 6, 0); 42 | } 43 | wprintw(window, 44 | "%02X %d %u %u %u 0 0 0 0 %03d %03d %03d %03d %03d %03d %03d", 45 | ff_pack.cmd, 46 | ff_pack.enable.strong, 47 | ff_pack.enable.weak, 48 | ff_pack.enable.left, 49 | ff_pack.enable.right, 50 | ff_pack.strength.strong, 51 | ff_pack.strength.weak, 52 | ff_pack.strength.left, 53 | ff_pack.strength.right, 54 | ff_pack.pulse.sustain_10ms, ff_pack.pulse.release_10ms, ff_pack.pulse.loop_count); 55 | } 56 | 57 | static void print_input() 58 | { 59 | wmove(input, 0, 0); 60 | wprintw(input, "--[ MotorEnable ]---------------[ Strength in %% ][ 10ms ][cnt]--\n"); 61 | print_pack(input); 62 | wprintw(input, 63 | "\n" 64 | " | | | | | | | | | | |\n" 65 | " STR WEA LTR RTR - - - - STR WEA LTR RTR SUS REL LOP\n" 66 | " [1] [2] [3] [4] q/a w/s e/d r/f h/j k/l u/i " 67 | " <-- keys, or Enter = SEND, Ctrl+C = ABORT"); 68 | wrefresh(input); 69 | } 70 | 71 | int hidraw = -1; 72 | 73 | int main(int argc, char **argv) 74 | { 75 | char ch; 76 | ff_pack.cmd = 0x03; 77 | 78 | ff_pack.enable.strong = 1; 79 | ff_pack.enable.weak = 1; 80 | ff_pack.enable.left = 1; 81 | ff_pack.enable.right = 1; 82 | 83 | ff_pack.strength.strong = 40; 84 | ff_pack.strength.weak = 30; 85 | ff_pack.strength.left = 20; 86 | ff_pack.strength.right = 20; 87 | 88 | ff_pack.pulse.sustain_10ms = 5; 89 | ff_pack.pulse.release_10ms = 5; 90 | ff_pack.pulse.loop_count = 3; 91 | 92 | if (argc == 2) { 93 | hidraw = open(argv[1], O_WRONLY); 94 | } else { 95 | fprintf(stderr, "usage: %s /dev/hidraw##\n", argv[0]); 96 | exit(1); 97 | } 98 | 99 | if (hidraw < 0) { 100 | fprintf(stderr, "%s: error %d opening '%s': %s\n", argv[0], errno, argv[1], 101 | strerror(errno)); 102 | exit(1); 103 | } 104 | 105 | initscr(); 106 | raw(); 107 | keypad(stdscr, TRUE); 108 | noecho(); 109 | 110 | output = newwin(LINES - 5, COLS, 0, 0); 111 | input = newwin(5, COLS, LINES - 5, 0); 112 | 113 | print_input(); 114 | scrollok(output, TRUE); 115 | 116 | while ((ch = wgetch(input)) != 3) { 117 | switch (ch) { 118 | case 10: 119 | print_pack(output); 120 | write(hidraw, &ff_pack, sizeof(ff_pack)); 121 | wrefresh(output); 122 | break; 123 | case '1': 124 | ff_pack.enable.strong ^= 1; 125 | break; 126 | case '2': 127 | ff_pack.enable.weak ^= 1; 128 | break; 129 | case '3': 130 | ff_pack.enable.left ^= 1; 131 | break; 132 | case '4': 133 | ff_pack.enable.right ^= 1; 134 | break; 135 | case 'q': 136 | if (ff_pack.strength.strong < 100) 137 | ff_pack.strength.strong++; 138 | break; 139 | case 'a': 140 | if (ff_pack.strength.strong > 0) 141 | ff_pack.strength.strong--; 142 | break; 143 | case 'w': 144 | if (ff_pack.strength.weak < 100) 145 | ff_pack.strength.weak++; 146 | break; 147 | case 's': 148 | if (ff_pack.strength.weak > 0) 149 | ff_pack.strength.weak--; 150 | break; 151 | case 'e': 152 | if (ff_pack.strength.left < 100) 153 | ff_pack.strength.left++; 154 | break; 155 | case 'd': 156 | if (ff_pack.strength.left > 0) 157 | ff_pack.strength.left--; 158 | break; 159 | case 'r': 160 | if (ff_pack.strength.right < 100) 161 | ff_pack.strength.right++; 162 | break; 163 | case 'f': 164 | if (ff_pack.strength.right > 0) 165 | ff_pack.strength.right--; 166 | break; 167 | case 'h': 168 | if (ff_pack.pulse.sustain_10ms > 0) 169 | ff_pack.pulse.sustain_10ms--; 170 | break; 171 | case 'j': 172 | if (ff_pack.pulse.sustain_10ms < 255) 173 | ff_pack.pulse.sustain_10ms++; 174 | break; 175 | case 'k': 176 | if (ff_pack.pulse.release_10ms > 0) 177 | ff_pack.pulse.release_10ms--; 178 | break; 179 | case 'l': 180 | if (ff_pack.pulse.release_10ms < 255) 181 | ff_pack.pulse.release_10ms++; 182 | break; 183 | case 'u': 184 | if (ff_pack.pulse.loop_count > 0) 185 | ff_pack.pulse.loop_count--; 186 | break; 187 | case 'i': 188 | if (ff_pack.pulse.loop_count < 255) 189 | ff_pack.pulse.loop_count++; 190 | break; 191 | } 192 | print_input(); 193 | } 194 | 195 | delwin(input); 196 | delwin(output); 197 | 198 | endwin(); 199 | 200 | close(hidraw); 201 | exit(0); 202 | } 203 | -------------------------------------------------------------------------------- /misc/examples/python_asyncio_evdev/gamepad.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """ 4 | example class to use the controller with asyncio 5 | python>=3.6 is necessary 6 | script is tested on a raspberry pi 3 7 | """ 8 | import asyncio 9 | from evdev import InputDevice, ff, ecodes 10 | 11 | class gamepad(): 12 | def __init__(self, file = '/dev/input/event0'): 13 | #self.event_value = 0 14 | self.power_on = True 15 | self.device_file = InputDevice(file) 16 | self.joystick_left_y = 0 # values are mapped to [-1 ... 1] 17 | self.joystick_left_x = 0 # values are mapped to [-1 ... 1] 18 | self.joystick_right_x = 0 # values are mapped to [-1 ... 1] 19 | self.trigger_right = 0 # values are mapped to [0 ... 1] 20 | self.trigger_left = 0 # values are mapped to [0 ... 1] 21 | self.button_x = False 22 | self.button_y = False 23 | self.button_b = False 24 | self.rumble_effect = 0 25 | self.effect1_id = 0 # light rumble, played continuously 26 | self.effect2_id = 0 # strong rumble, played once 27 | self.load_effects() 28 | 29 | def load_effects(self): 30 | #effect 1, light rumble 31 | rumble = ff.Rumble(strong_magnitude=0x0000, weak_magnitude=0x500) 32 | duration_ms = 300 33 | effect = ff.Effect(ecodes.FF_RUMBLE, -1, 0, ff.Trigger(0, 0), ff.Replay(duration_ms, 0), ff.EffectType(ff_rumble_effect=rumble)) 34 | self.effect1_id = self.device_file.upload_effect(effect) 35 | # effect 2, strong rumble 36 | rumble = ff.Rumble(strong_magnitude=0xc000, weak_magnitude=0x0000) 37 | duration_ms = 200 38 | effect = ff.Effect(ecodes.FF_RUMBLE, -1, 0, ff.Trigger(0, 0), ff.Replay(duration_ms, 0), ff.EffectType(ff_rumble_effect=rumble)) 39 | self.effect2_id = self.device_file.upload_effect(effect) 40 | 41 | 42 | async def read_gamepad_input(self): # asyncronus read-out of events 43 | max_abs_joystick_left_x = 0xFFFF/2 44 | uncertainty_joystick_left_x = 2500 45 | max_abs_joystick_left_y = 0xFFFF/2 46 | uncertainty_joystick_left_y = 2500 47 | max_abs_joystick_right_x = 0xFFFF/2 48 | uncertainty_joystick_right_x = 2000 49 | max_trigger = 1023 50 | 51 | async for event in self.device_file.async_read_loop(): 52 | if not(self.power_on): #stop reading device when power_on = false 53 | break 54 | if event.type == 3: # type is analog trigger or joystick 55 | if event.code == 1: # left joystick y-axis 56 | if -event.value > uncertainty_joystick_left_y: 57 | self.joystick_left_y = (-event.value - uncertainty_joystick_left_y) / (max_abs_joystick_left_y - uncertainty_joystick_left_y + 1) 58 | elif -event.value < -uncertainty_joystick_left_y: 59 | self.joystick_left_y = (-event.value + uncertainty_joystick_left_y) / (max_abs_joystick_left_y - uncertainty_joystick_left_y + 1) 60 | else: 61 | self.joystick_left_y = 0 62 | elif event.code == 0: # left joystick x-axis 63 | if event.value > uncertainty_joystick_left_x: 64 | self.joystick_left_x = (event.value - uncertainty_joystick_left_x) / (max_abs_joystick_left_x - uncertainty_joystick_left_x + 1) 65 | elif event.value < -uncertainty_joystick_left_x: 66 | self.joystick_left_x = (event.value + uncertainty_joystick_left_x) / (max_abs_joystick_left_x - uncertainty_joystick_left_x + 1) 67 | else: 68 | self.joystick_left_x = 0 69 | elif event.code == 3: # right joystick x-axis 70 | if event.value > uncertainty_joystick_right_x: 71 | self.joystick_right_x = (event.value - uncertainty_joystick_right_x) / (max_abs_joystick_right_x - uncertainty_joystick_right_x + 1) 72 | elif event.value < -uncertainty_joystick_right_x: 73 | self.joystick_right_x = (event.value + uncertainty_joystick_right_x) / (max_abs_joystick_right_x - uncertainty_joystick_right_x + 1) 74 | else: 75 | self.joystick_right_x = 0 76 | elif event.code == 5: # right trigger 77 | self.trigger_right = event.value / max_trigger 78 | elif event.code == 2: # left trigger 79 | self.trigger_left = event.value / max_trigger 80 | if (event.type == 1): # type is button 81 | if event.code == 307: # button "X" pressed ? 82 | self.button_x = True 83 | if event.code == 308: # button "Y" pressed ? 84 | self.button_y = True 85 | if event.code == 305: # button "B" pressed ? 86 | self.button_b = True 87 | 88 | async def rumble(self): # asyncronus control of force feed back effects 89 | repeat_count = 1 90 | while self.power_on: 91 | if self.rumble_effect == 1: 92 | self.device_file.write(ecodes.EV_FF, self.effect1_id, repeat_count) 93 | elif self.rumble_effect == 2: 94 | self.device_file.write(ecodes.EV_FF, self.effect2_id, repeat_count) 95 | self.rumble_effect = 0 # turn of effect in order to play effect2 only once 96 | await asyncio.sleep(0.2) 97 | 98 | def erase_rumble(self): 99 | self.device_file.erase_effect(self.effect1_id) 100 | 101 | if __name__ == "__main__": 102 | 103 | async def main(): 104 | print("press x to stop, Y to rumble light, B to rumble once, trigger and joystick right to see analog value") 105 | while True: 106 | print(" trigger_right = ", round(remote_control.trigger_right,2), " joystick_right_x = ", round(remote_control.joystick_right_x,2),end="\r") 107 | if remote_control.button_y: # turn on light rumble effect 108 | remote_control.button_y = False 109 | remote_control.rumble_effect = 1 110 | if remote_control.button_b: # play once strong rumble effect 111 | remote_control.button_b = False 112 | remote_control.rumble_effect = 2 113 | if remote_control.button_x: # stop the script 114 | remote_control.power_on = False 115 | remote_control.erase_rumble() 116 | break 117 | await asyncio.sleep(0) 118 | 119 | remote_control = gamepad(file = '/dev/input/event0') 120 | futures = [remote_control.read_gamepad_input(), remote_control.rumble(), main()] 121 | loop = asyncio.get_event_loop() 122 | loop.run_until_complete(asyncio.wait(futures)) 123 | loop.close() 124 | print(" ") 125 | -------------------------------------------------------------------------------- /misc/examples/python_evdev_rumble/rumble.py: -------------------------------------------------------------------------------- 1 | from evdev import ecodes, InputDevice, ff, util 2 | import time 3 | 4 | dev = None 5 | 6 | # Find first EV_FF capable event device (that we have permissions to use). 7 | for name in util.list_devices(): 8 | dev = InputDevice(name) 9 | if ecodes.EV_FF in dev.capabilities(): 10 | break 11 | 12 | if dev is None: 13 | 14 | print("Sorry, no FF capable device found") 15 | 16 | else: 17 | print("found " + dev.name + " at " + dev.path) 18 | print("Preparing FF effect...") 19 | 20 | rumble = ff.Rumble(strong_magnitude=0xc000, weak_magnitude=0xc000) 21 | effect_type = ff.EffectType(ff_rumble_effect=rumble) 22 | duration_ms = 1000 23 | 24 | effect = ff.Effect( 25 | ecodes.FF_RUMBLE, # type 26 | -1, # id (set by ioctl) 27 | 0, # direction 28 | ff.Trigger(0, 0), # no triggers 29 | ff.Replay(duration_ms, 0), # length and delay 30 | ff.EffectType(ff_rumble_effect=rumble) 31 | ) 32 | 33 | print("Uploading FF effect...") 34 | 35 | effect_id = dev.upload_effect(effect) 36 | 37 | 38 | print("Playing FF effect...") 39 | 40 | repeat_count = 1 41 | 42 | 43 | dev.write(ecodes.EV_FF, effect_id, repeat_count) 44 | time.sleep(1) 45 | 46 | dev.erase_effect(effect_id) 47 | -------------------------------------------------------------------------------- /misc/examples/udev-rules/99-xpadneo-joydev.rules: -------------------------------------------------------------------------------- 1 | # Auto-load your customized joydev mapping, needed for some emulators 2 | KERNEL=="js*", ACTION=="add|change", DRIVERS=="xpadneo", RUN+="/usr/bin/jscal-restore %E{DEVNAME}" 3 | -------------------------------------------------------------------------------- /misc/kernel_patches/0002-hid_generic_claims_devices.patch: -------------------------------------------------------------------------------- 1 | From 8bcfd1f6aa89fdf40591c4181b69dfab88b30403 Mon Sep 17 00:00:00 2001 2 | From: Florian Dollinger 3 | Date: Mon, 8 Jan 2018 12:25:06 +0100 4 | Subject: [PATCH] Added new Xpad driver to the list of specialized drivers, in order 5 | to prevent hid-generic claiming Xbox One S devices. 6 | 7 | Signed-off-by: Florian Dollinger 8 | --- 9 | drivers/hid/hid-core.c | 4 ++++ 10 | 1 file changed, 4 insertions(+) 11 | 12 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c 13 | index f3fcb836a..5e52255ce 100644 14 | --- a/drivers/hid/hid-core.c 15 | +++ b/drivers/hid/hid-core.c 16 | @@ -2387,6 +2387,10 @@ static const struct hid_device_id hid_have_special_driver[] = { 17 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, 18 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) }, 19 | #endif 20 | +#if IS_ENABLED(CONFIG_HID_XPADNEO) 21 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x02FD) }, 22 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x02E0) }, 23 | +#endif 24 | #if IS_ENABLED(CONFIG_HID_ZEROPLUS) 25 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 26 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 27 | -- 28 | 2.15.1 29 | 30 | -------------------------------------------------------------------------------- /misc/kernel_patches/raspi3/0002-hid_generic_claims_devices.patch: -------------------------------------------------------------------------------- 1 | From 8bcfd1f6aa89fdf40591c4181b69dfab88b30403 Mon Sep 17 00:00:00 2001 2 | From: Florian Dollinger 3 | Date: Mon, 8 Jan 2018 12:25:06 +0100 4 | Subject: [PATCH] Added new Xpad driver to the list of specialized drivers, in order 5 | to prevent hid-generic claiming Xbox One S devices. 6 | 7 | Signed-off-by: Florian Dollinger 8 | --- 9 | drivers/hid/hid-core.c | 4 ++++ 10 | 1 file changed, 4 insertions(+) 11 | 12 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c 13 | index f3fcb836a..5e52255ce 100644 14 | --- a/drivers/hid/hid-core.c 15 | +++ b/drivers/hid/hid-core.c 16 | @@ -1769,3 +1769,5 @@ static const struct hid_device_id hid_have_special_driver[] = { 17 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x02FD) }, 18 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x02E0) }, 19 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 20 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 21 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, 22 | -- 23 | 2.15.1 24 | -------------------------------------------------------------------------------- /misc/old/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atar-axis/xpadneo/cd256807c5f916735ae18749c43d5b0bd73240fa/misc/old/Makefile -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | source "lib/options.sh" 5 | source "lib/installer.sh" 6 | 7 | set -e 8 | 9 | echo "* unloading current driver module" 10 | modprobe -r hid_xpadneo || true 11 | 12 | echo "* looking for registered instances" 13 | echo "found ${#INSTALLED[@]} registered instance(s) on your system" 14 | 15 | # NOTE: overrides VERSION from lib/installer.sh but we don't need it 16 | for VERSION in "${INSTALLED[@]}"; do 17 | make "${MAKE_OPTS[@]}" VERSION="${VERSION}" uninstall 18 | done 19 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname "$0")" 4 | source "lib/installer.sh" 5 | 6 | set -e 7 | 8 | LATEST=$(get_upstream_version_latest) 9 | 10 | reinstall() { 11 | if [[ "${VERSION}" == "${INSTALLED[0]}" ]]; then 12 | echo "You have already installed ${VERSION}!" 13 | else 14 | echo "* uninstalling outdated modules" 15 | ./uninstall.sh 16 | 17 | echo "* installing latest version" 18 | ./install.sh 19 | fi 20 | } 21 | 22 | if [[ "${LATEST}" == "${VERSION}" ]]; then 23 | echo "Looks like the repo is up to date, fine!" 24 | reinstall 25 | elif __version_lte "${LATEST}" "${VERSION}"; then 26 | echo "Looks like you are on a developer version, reinstalling!" 27 | reinstall 28 | else 29 | echo "Latest stable version: ${LATEST}" 30 | echo "Installed versions: ${INSTALLED[*]}" 31 | echo "Repository version: ${VERSION}" 32 | 33 | if [[ "${GIT_ROOT}" != "" ]]; then 34 | echo "Please update this directory by running 'git reset --hard' and 'git pull', afterwards run this script again" 35 | else 36 | echo "Please update this directory by downloading the latest version from https://github.com/atar-axis/xpadneo/archive/${LATEST}.tar.gz" 37 | fi 38 | exit 1 39 | fi 40 | --------------------------------------------------------------------------------