diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-14 20:16:26 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-14 20:16:26 +0300 |
| commit | a3aba95241247c5aa5c8e16c839cf6909ffe80a9 (patch) | |
| tree | 5f4692527eb9a82d95d08754e4eb96be7df90ba5 | |
| parent | b2872a893afd0f9cd0bfd4644348f3b8645edbed (diff) | |
| parent | 1ac3f52cfd972787e4684350f7593614837b6b19 (diff) | |
| download | hid-tmff2-a3aba95241247c5aa5c8e16c839cf6909ffe80a9.tar.gz hid-tmff2-a3aba95241247c5aa5c8e16c839cf6909ffe80a9.zip | |
Merge branch 'RaySlash-rebase'
| -rw-r--r-- | .gitmodules | 6 | ||||
| -rw-r--r-- | Kbuild | 2 | ||||
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | README.md | 208 | ||||
| -rw-r--r-- | TODO | 7 | ||||
| m--------- | deps/hid-tminit | 0 | ||||
| -rwxr-xr-x | dkms/dkms-install.sh (renamed from dkms-install.sh) | 10 | ||||
| -rw-r--r-- | dkms/dkms.conf (renamed from dkms.conf) | 2 | ||||
| -rw-r--r-- | docs/CONTRIBUTING.md | 107 | ||||
| -rw-r--r-- | docs/DRIVER.md | 49 | ||||
| -rw-r--r-- | docs/FFBEFFECTS.md | 558 | ||||
| -rw-r--r-- | docs/INTEGRATION.md | 6 | ||||
| -rw-r--r-- | docs/STRUCTURE.md | 42 | ||||
| -rw-r--r-- | docs/TODO.md | 3 | ||||
| -rw-r--r-- | force-effects.txt | 462 | ||||
| m--------- | hid-tminit | 0 | ||||
| -rw-r--r-- | ps4-input.txt | 54 | ||||
| -rw-r--r-- | src/hid-tmff2.c (renamed from hid-tmff2.c) | 16 | ||||
| -rw-r--r-- | src/hid-tmff2.h (renamed from hid-tmff2.h) | 21 | ||||
| -rw-r--r-- | src/tmt248/hid-tmt248.c (renamed from hid-tmt248.c) | 2 | ||||
| -rw-r--r-- | src/tmt300rs/hid-tmt300rs.c (renamed from hid-tmt300rs.c) | 19 | ||||
| -rw-r--r-- | src/tmt300rs/hid-tmt300rs.h (renamed from hid-tmt300rs.h) | 4 | ||||
| -rw-r--r-- | src/tmtx/hid-tmtx.c (renamed from hid-tmtx.c) | 10 | ||||
| -rw-r--r-- | t248-effects.txt | 2 |
24 files changed, 951 insertions, 651 deletions
diff --git a/.gitmodules b/.gitmodules index 9415bdf..998e8c6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "hid-tminit"] - path = hid-tminit - url = https://github.com/scarburato/hid-tminit.git +[submodule "deps/hid-tminit"] + path = deps/hid-tminit + url = https://github.com/scarburato/hid-tminit @@ -1,2 +1,2 @@ obj-m := hid-tmff-new.o -hid-tmff-new-y := hid-tmff2.o hid-tmt300rs.o hid-tmt248.o hid-tmtx.o +hid-tmff-new-y := src/hid-tmff2.o src/tmt300rs/hid-tmt300rs.o src/tmt248/hid-tmt248.o src/tmtx/hid-tmtx.o @@ -1,16 +1,16 @@ KDIR ?= /lib/modules/$(shell uname -r)/build -all: hid-tminit +all: deps/hid-tminit $(MAKE) -C $(KDIR) M=$(shell pwd) modules -install: hid-tminit +install: deps/hid-tminit $(MAKE) -C $(KDIR) M=$(shell pwd) modules_install depmod -A -clean: hid-tminit +clean: deps/hid-tminit $(MAKE) -C $(KDIR) M=$(shell pwd) clean -.PHONY: hid-tminit -hid-tminit: - $(MAKE) -C hid-tminit KDIR="$(KDIR)" $(MAKECMDGOALS) +.PHONY: deps/hid-tminit +deps/hid-tminit: + $(MAKE) -C deps/hid-tminit KDIR="$(KDIR)" $(MAKECMDGOALS) @@ -1,114 +1,168 @@ -# Linux kernel module for Thrustmaster T300RS, T248 and (experimental) TX wheels +# Linux kernel module for Thrustmaster T300RS, T248 and TX (experimental) wheels -## Current state -Playable. I've made some improvements to the dynamic updating of effects, and -while still far for perfect, the experience is slowly getting better and better. -Some drawbacks include possible effect inaccuracies in comparison with the Windows driver and in some -games inconsistent pedal mapping. Meaning that all pedals should be detected in games, but may be mapped incorrectly. +> **DISCLAIMER:** The module is now ready for near-stable USE in most force +> feedback games, supports rangesetting as well as gain and autocentering along +> with most force feedback effects. While I haven't personally come across any +> crashes or lockups with this version, I can't promise that they won't occur +> under any circumstances. -Anycase, **this version is usable in most force feedback games, supports -rangesetting as well as gain and autocentering along with most force feedback effects.** + + + -### Help wanted with adding more Thrustmaster wheels -Currently open requests for wheels: +## Description -+ [T500 RS](https://github.com/Kimplul/hid-tmff2/issues/18) -+ [T818](https://github.com/Kimplul/hid-tmff2/issues/58) -+ [T-GT II](https://github.com/Kimplul/hid-tmff2/issues/55) - -If you would like to help add a wheel to this driver, please have a look through the -[wiki](https://github.com/Kimplul/hid-tmff2/wiki#how-to-add-in-support-for-a-new-t-series-wheel) for what might need to be done. -If you have a wheel that's not on the list, but suspect it might fit into the driver, please feel free to open up an issue about it. - -## Small note - -While I haven't personally come across any crashes or lockups with this -version, I can't promise that they won't occur under any circumstances. +A Linux kernel module for Thrustmaster T300RS, T248, and TX +(experimental support) wheels. -With that in mind, +I've been working on enhancing the real-time updating of effects, and although +it's not flawless yet, the overall experience is gradually improving. There are +a couple of issues, though. First, there might be occasional inaccuracies in how +the effects compare to the Windows driver. Second, in certain games, the mapping +of pedal inputs can be inconsistent. This means that while all pedals should be +recognized by the games, they might not be mapped correctly. ## Installation +You can either install this kernel module by using DKMS or +manually building from source: + ### Dependencies -Kernel modules require kernel headers to be installed. +Kernel modules require kernel headers to be installed. Use any +one of the right command for your distribution: -+ Debian-based: `apt install linux-headers-$(uname -r)` -+ Arch-based: `pacman -S linux-headers` -+ Fedora-based: `yum install kernel-devel kernel-headers` +```shell +sudo apt install linux-headers-$(uname -r) # Debian-based +sudo pacman -S linux-headers # Arch-based +sudo yum install kernel-devel kernel-headers # Fedora-based +``` +#### Manual installation ++ Unplug wheel from computer ++ Run + ```shell + git clone --recurse-submodules https://github.com/Kimplul/hid-tmff2.git + cd hid-tmff2 + make + sudo make install + ``` ++ Plug wheel back in ++ Reboot *(Optional, yet Recommended)* -### Manual installation +#### DKMS (Dynamic Kernel Module Support) + Unplug wheel from computer -+ `git clone --recurse-submodules https://github.com/Kimplul/hid-tmff2.git` -+ `make` -+ `sudo make install` ++ Run + ```shell + git clone --recurse-submodules https://github.com/Kimplul/hid-tmff2.git + cd hid-tmff2 + sudo ./dkms/dkms-install.sh + ``` + Plug wheel back in -+ reboot (not strictly necessary, but definitely recommended) - -Done! ++ Reboot *(Optional, yet Recommended)* -> Note: On some systems, you will get an error/warning about SSL. This is normal for unsigned modules. For info on signing modules yourself (completely optional), see [here](https://www.kernel.org/doc/html/latest/admin-guide/module-signing.html?highlight=module%20signing). +> **NOTE:** See [INTEGRATION](./docs/INTEGRATION.md) +> for install instructions for other linux distributions. -> Note: Thrustmaster TX wheels aren't supported by `hid-tminit` as of yet, meaning that TX wheels have to be initialized with `tmrd`. Please see https://github.com/Kimplul/hid-tmff2/issues/48. +> **NOTE:** On some systems, you will get an error/warning about SSL. This is +> normal for unsigned modules. For info on signing modules yourself +> (completely optional), see +> [here](https://www.kernel.org/doc/html/latest/admin-guide/module-signing.html). -### DKMS +> **NOTE:** Thrustmaster TX wheels aren't supported by `hid-tminit` as of yet, +> meaning that TX wheels have to be initialized with `tmdrv`. Please see +> https://github.com/Kimplul/hid-tmff2/issues/48. -+ Unplug wheel from computer -+ `sudo ./dkms-install.sh` -+ Plug wheel back in -+ reboot (not strictly necessary, but definitely recommended) +> **WARNING:** There have been reports that this driver does not work if +> the wheel's firmware version is older than v. 31. To update the firmware, you +> will have to fire up a Windows installation and update the firmware using the +> official Thrustmaster tools. -Done! -> :warning: Warning: There have been reports that this driver does not work if the wheel's firmware version is older than v. 31. -> To update the firmware, you will have to fire up a Windows installation and update the firmware using the official Thrustmaster tools. +> **WARNING:** There was a name change when adding support for the T248 +> from `hid-tmt300rs` to `hid-tmff-new`, and you may have to uninstall the older +> version of the driver. -> :warning: Warning: There was a name change when adding support for the T248 from `hid-tmt300rs` to `hid-tmff-new`, -> and you may have to uninstall the older version of the driver. +## Contribute to project -## Additional tidbits +This project wants help from people who can contribute. +If you would like to help add a wheel to this driver, +please have a look through `docs` and/or [CONTRIBUTING.md](./docs/CONTRIBUTING.md) +for what might need to be done. -+ Reportedly some games running under Wine/Proton won't recognize wheels without the official Thrustmaster drivers installed within the prefix. See [#46](https://github.com/Kimplul/hid-tmff2/issues/46#issuecomment-1199080845). For installation instructions, see [wiki](https://github.com/Kimplul/hid-tmff2/wiki) +If you have a wheel that's not not supported, but suspect it might fit into the +driver, please feel free to open up an issue about it. Currently open requests +for wheels: - Note that you will still need the Linux driver, the Windows driver just installs some files needed by games to correctly recognize the Linux driver. The Windows driver itself does not work under Wine/Proton. ++ [T500 RS](https://github.com/Kimplul/hid-tmff2/issues/18) ++ [T818](https://github.com/Kimplul/hid-tmff2/issues/58) ++ [T-GT II](https://github.com/Kimplul/hid-tmff2/issues/55) ++ [T128P](https://github.com/Kimplul/hid-tmff2/issues/67) ++ [TS-PC](https://github.com/Kimplul/hid-tmff2/issues/65) + +## FAQ (Frequently Asked Questions) ++ Reportedly some games running under Wine/Proton won't recognize wheels without + the official Thrustmaster drivers installed within the prefix. See + [#46](https://github.com/Kimplul/hid-tmff2/issues/46#issuecomment-1199080845). + For installation instructions, see + [DRIVER](./docs/DRIVER.md). + + Note that you will still need + the Linux driver, the Windows driver just installs some files needed by games to + correctly recognize the Linux driver. The Windows driver itself does not work + under Wine/Proton. -+ Until the updated `hid-tminit` is upstreamed, you might want to blacklist the kernel module `hid-thrustmaster`. Do this with - ``` - echo 'blacklist hid_thrustmaster' > /etc/modprobe.d/hid_thrustmaster.con - ``` ++ Until the updated `hid-tminit` is + [upstreamed](https://github.com/scarburato/hid-tminit), you might want to + blacklist the kernel module `hid-thrustmaster`. Do this with + ```shell + echo 'blacklist hid_thrustmaster' > /etc/modprobe.d/hid_thrustmaster.conf + ``` -+ If you've bought a new wheel, you will most likely have to update the firmware through Windows before it will work with this driver. ++ If you've bought a new wheel, you will most likely have to update the firmware + through Windows before it will work with this driver. -+ T300 RS has an advanced F1 mode that can be activated with an F1 attachment when in PS3 mode. The base wheel will also work in PS4 mode, - but it's less tested and if you encounter issues with this mode, please feel free to open up an issue about it. - -+ T248 isn't as extensively tested as T300 RS, please see issues and open new ones if you encounter problems. - There is currently no support for the built-in screen. ++ T300 RS has an advanced F1 mode that can be activated with an F1 attachment + when in PS3 mode. The base wheel will also work in PS4 mode, but it's less + tested and if you encounter issues with this mode, please feel free to open up + an issue about it. -+ TX support is considered experimental, please see issues (especially https://github.com/Kimplul/hid-tmff2/issues/48) and open new ones - if you encounter issues. ++ T248 isn't as extensively tested as T300 RS, please see issues and open new + ones if you encounter problems. There is currently no support for the built-in + screen. -+ To change gain, autocentering etc. use [Oversteer](https://github.com/berarma/oversteer). ++ TX support is considered experimental, please see issues + (especially https://github.com/Kimplul/hid-tmff2/issues/48) + and open new ones if you encounter any problems. + ++ To change gain, autocentering etc. use + [Oversteer](https://github.com/berarma/oversteer). + If a wheel has a deadzone in games, you can try setting up a udev rule: - - `/etc/udev/rules.d/99-joydev.rules` + `/etc/udev/rules.d/99-joydev.rules` + + ``` + SUBSYSTEM=="input", ATTRS{idVendor}=="044f", ATTRS{idProduct}=="WHEEL_ID", RUN+="/usr/bin/evdev-joystick --evdev %E{DEVNAME} --deadzone 0" + ``` + + where `WHEEL_ID` is + + | Wheel | WHEEL_ID | + |----------------------------|------------| + | T300 RS, PS3 normal mode | b66e | + | T300 RS, PS3 advanced mode | b66f | + | T300 RS, PS4 normal mode | b66d | + | T248 | b696 | + | TX | b669 | - ``` - SUBSYSTEM=="input", ATTRS{idVendor}=="044f", ATTRS{idProduct}=="WHEEL_ID", RUN+="/usr/bin/evdev-joystick --evdev %E{DEVNAME} --deadzone 0" - ``` - - where `WHEEL_ID` is - | Wheel | WHEEL_ID | - |----------------------------|------| - | T300 RS, PS3 normal mode | b66e | - | T300 RS, PS3 advanced mode | b66f | - | T300 RS, PS4 normal mode | b66d | - | T248 | b696 | + This should make sure that the wheel behaves like you'd want from a wheel. - This should make sure that the wheel behaves like you'd want from a wheel. ++ There have been reports that some games work better with a different timer + period (see [#11](https://github.com/Kimplul/hid-tmff2/issues/11) and + [#10](https://github.com/Kimplul/hid-tmff2/issues/10)). -+ There have been reports that some games work better with a different timer period (see [#11](https://github.com/Kimplul/hid-tmff2/issues/11) and [#10](https://github.com/Kimplul/hid-tmff2/issues/10)). To change the timer period, create `/etc/modprobe.d/hid-tmff-new.conf` and add `options hid-tmff-new timer_msecs=NUMBER` into it. The default timer period is 8, but numbers as low as 2 should work alright. + To change the timer period, create `/etc/modprobe.d/hid-tmff-new.conf` + and add `options hid-tmff-new timer_msecs=NUMBER` into it. + The default timer period is 8, but numbers as low as 2 should work alright. @@ -1,7 +0,0 @@ -+ Make code more general to allow for stuff like T150/T248/T500 to be relatively -easily included. - -+ Use workqueues instead of doing everything in t300rs_timer - -+ T248 open/close seems to crash the wheel and the kernel along with it, check how Windows handles it -+ T248 fix rdesc, 0x0a somewhere needs to be set to 0x60 diff --git a/deps/hid-tminit b/deps/hid-tminit new file mode 160000 +Subproject 9375f6c7d83af5dd6c8b8fe30351d0f36043b20 diff --git a/dkms-install.sh b/dkms/dkms-install.sh index 6e77e80..261bbe7 100755 --- a/dkms-install.sh +++ b/dkms/dkms-install.sh @@ -1,5 +1,8 @@ #!/bin/sh +# script assumes it is being run from root, i.e. +# sudo ./dkms/dkms-install.sh + if ! [ $(id -u) = 0 ]; then echo "You must run this script as root!" exit 1 @@ -10,7 +13,12 @@ TM_VER=0.8 DST="/usr/src/${TM_NAME}-${TM_VER}" mkdir -p "${DST}" -cp -r ./* "${DST}" +cp -r * "${DST}" + +# copy dkms.conf specifically to be in root dir or build area +cp dkms/dkms.conf "${DST}" + +cd dkms dkms add -m "${TM_NAME}" -v "${TM_VER}" dkms build -m "${TM_NAME}" -v "${TM_VER}" diff --git a/dkms.conf b/dkms/dkms.conf index 25ef2ca..3863d31 100644 --- a/dkms.conf +++ b/dkms/dkms.conf @@ -12,7 +12,7 @@ CLEAN[0]="'make' KDIR=\"$kernel_source_dir\" clean" # The list of kernel modules. #__DKMS_MODULES BUILT_MODULE_NAME[0]="hid-tminit" -BUILT_MODULE_LOCATION="hid-tminit/" +BUILT_MODULE_LOCATION="deps/hid-tminit/" DEST_MODULE_LOCATION[0]="/kernel/drivers/hid" BUILT_MODULE_NAME[1]="hid-tmff-new" DEST_MODULE_LOCATION[1]="/kernel/drivers/hid" diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 0000000..51b405e --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1,107 @@ +# Contributing + +## Overview This file contains general contributing information. + +This project is seeking for help from people who can contribute. If you have a +wheel that's not on the list, but suspect it might fit into the driver, please +feel free to open up an issue about it. + +Other documents available are linked here: + ++ [FFBEEFFECTS](./FFBEFFECTS.md): + Force feedback effects example for T300RS and compatible wheels + ++ [STRUCTURE](./STRUCTURE.md): + Structure of Thrustmaster device stack + ++ [DRIVER.md](./DRIVER.md): + Info on installing Thrustmaster drivers under Wine + ++ [TODO](./TODO.md): + TODO list for maintainers + +## How to capture what effects a game sends to the driver? + +Use ffbwrap from ffbtools: +[github:berarma/ffbtools](https://github.com/berarma/ffbtools) + +The documentation gives good examples, but tl;dr; For steam, insert the following +into a game's launch options: + +```shell +ffbwrap --logger=/home/$USER/game.log /dev/input/by-id/usb-Thrustmaster_Thrustmaster_T300RS_Racing_wheel-event-joystick -- %command% +``` + +This will create a file called `game.log` (with additional timestamp) in your +home directory. Preferably change the name to suit the game, but you do you. + +> **NOTE:** Most fixes presented in the documentation are more or less obsolete +> by now, but the tool is still very useful for logging purposes. + +## How to capture what USB packets the driver sends to the device? + +I'd recommend +[wireshark](https://www.wireshark.org/) + +Usb capture setup is fairly straightforward: +[wireshark/CaptureSetup](https://wiki.wireshark.org/CaptureSetup/USB#linux) + +Here's what I typically do when starting a capture: + ++ Run `sudo modprobe usbmon`. This will load a kernel module that allows + Wireshark to read the USB packets. + ++ Open wireshark with root privileges. There are some ways to allow wireshark to + access the packets with regular user privileges, I just haven't bothered with + it. + ++ Select `usbmon0` from the view that opens up by default. + ++ The screen will quickly fill up with noise from other devices connected to the + computer, so you will have to filter out the noise. + ++ Run `lsusb` in a terminal. Look for the T300 in the list, you should see + something like `Bus 001 Device 006: ID 044f:b66e ThrustMaster, Inc. + Thrustmaster T300RS Racing wheel` + ++ From the previous command, the Bus and Device fields can be used to filter + out only packets from/to the device. To see all packets coming from the + wheel, add in a filter `usb.src ~ "1\.6\..*"`, where `1` is in this case + from the `Bus` field and `6` from the `Device` field. To see all packets + being sent to the device, use `usb.dst`. + ++ This data is probably also filled with a lot of cruft. Data to/from + endpoint 2 is button state info, which is probably unnecessary. To see FFB + data being sent to the device, use endpoint 1, i.e. `usb.dst == "1.6.1"`. + `~` is a Perl-compliant regex operator, whereas `==` just matches the string + directly. To see both data coming from the device and going to it, use + `usb.dst == "..." || usb.src == "..."`. + ++ There is also endpoint 0, `usb.src == "1.6.0"` but it doesn't seem to be + used for much. + ++ Use the three buttons in the top left of the screen to start, stop and restart + captures. + ++ Do whatever you want with the device, packets should automatically be + captured. When you want to save your capture to a file, stop the recording and + go to `File > Export Specified Packets` and make sure `Displayed` is selected. + This will apply the filter you've been using, and will only include the packets + that are visible in Wireshark, i.e. it applies the filter you've specified. + +> **NOTE:** Every time you unplug and replug your wheel, its `Device` field will +> probably change. + +## How to add in support for a new T-series wheel? + +Should probably not be too often that you need this info, but essentially use +wireshark like in the previous example, but spin up a Windows virtual machine +and install the Thrustmaster drivers on to it, and pass the device to the +virtual machine. I prefer to use `qemu` with `virt-manager` as a frontend. + +With the wheel working under Windows, install +[fedit.exe](https://gimx.fr/download/b882e209a0ac023d03abbf560dfc3f25fe6367ca/fedit.zip) +and methodically go through all effects the device supports and compare the USB +packets the driver sends out. You should be able to build up a table of what +each value in the USB packet means, see [FFBEFFECTS.md](./FFBEFFECTS.md) +for an example of what I found out about the T300. diff --git a/docs/DRIVER.md b/docs/DRIVER.md new file mode 100644 index 0000000..053ee41 --- /dev/null +++ b/docs/DRIVER.md @@ -0,0 +1,49 @@ +There are some reports that games will work better with the Thrustmaster Windows +drivers installed. + +# Installing the Windows drivers inside a proton prefix + +1. Install [protontricks](https://github.com/Matoking/protontricks). + +2. Download the + [Thrustmaster drivers](https://support.thrustmaster.com/en/product/t300rs-en/). + +3. Look up the ID of your game with `protontricks -s NAME`. For example: + ```shell + $ protontricks -s Dirt + Found the following games: + DiRT 3 Complete Edition (321040) + DiRT 4 (421020) + DiRT Rally (310560) + DiRT Rally 2.0 (690790) + + To run Protontricks for the chosen game, run: $ protontricks APPID COMMAND + + NOTE: A game must be launched at least once before Protontricks can find the + game. + ``` + +4. Run the driver installer with protontricks. + ```shell + protontricks -c 'wine ~/Downloads/DRIVER_INSTALL_EXE' APPID + ``` + + Dirt 4 for example: + ```shell + protontricks -c 'wine ~/Downloads/2022_TTRS_1.exe' 421020 + ``` + +Note that `protontricks` may change the working directory, so relative paths may +end up not working as expected. + +# Installing the Windows drivers manually + +Assuming you've already downloaded the installer: + +```shell +WINE_PREFIX=/path/to/prefix wine ./DRIVER_INSTALL_EXE +``` + +[Lutris](https://lutris.net/) is an excellent way to keep track of which +non-steam games exist in which prefixes, and allows you to run executables in +prefixes from a GUI if that's more your thing. diff --git a/docs/FFBEFFECTS.md b/docs/FFBEFFECTS.md new file mode 100644 index 0000000..e2b3edc --- /dev/null +++ b/docs/FFBEFFECTS.md @@ -0,0 +1,558 @@ +# Force Feedback Effects - Thrustmaster T300RS and compatible + +Here I will gather all info I can find out about the different force feedback +effects and their USB commands. All values seem to be little-endian. + +Also, general note, it seems like some effects are affected by the direction of +the force, denoted by `***`. As far as I can tell, `fade_level` and +`attack_level` values are calculated by mapping the `u16` into `s16` and taking +the absolute value, and after that multiplying by the direction. + +A full list of wheels that use USB packets in the format documented here is yet +to be determined, but at least T300, T248 and TX seem to use it. Each wheel may +have model specific peculiarities, though. + +> **NOTE:** All values are examples of actual commands that I captured on the +> USB interface, not the only available ones. + +## GENERAL +### Playing +``` + 60 00 - standard header + 01 - ID + 89 - playing options + 01 - play + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Stopping/removing (why are they rolled into one?) +``` + 60 00 - standard header + 01 - ID + 89 - playing options + 00 - stop + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## Open: +``` + 60 01 - standard header? + 04 - ? + 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + (this command doesn't appear every time, odd) + 60 12 - ? + bf 04 00 00 03 b7 1e - ? /* wow, this is different on different wheels? */ + 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 60 01 - ? + 05 - ? + 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## Close: +``` + 60 01 - standard header? + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## Rotation angle: +``` + 60 08 - header plus settings? + 11 - set rotation angle + 55 d5 - angle (between ff ff and 7b 09, one degree is roughly 3c) + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## FF_AUTOCENTER: +``` + 60 08 - header plus settings? + 03 - set autocenter force + 8f 02 - force (between ff ff and 00 00) + 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## FF_GAIN: +``` + 60 02 - header plus gain? + bf - gain (between ff and 00) + 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +## FF_CONSTANT +### Initialization +``` + 60 00 - standard header + 01 - ID + 6a - new constant effect(?) + fe ff - strength *** + 00 00 - attack_length + 00 00 - attack_level *** + 00 00 - fade_length + 00 00 - fade_level *** + 00 4f - ? + f7 17 - time in milliseconds, unsigned + 00 00 + 07 00 - offset from start(?) + 00 ff ff - end of new effect(?) + 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Modifying (For dynamic updating of effects) + +#### Direction: ``N/A`` + +#### Constant force: +``` + 60 00 - standard header + 01 - ID + 0a - modify constant force + 05 16 - constant force *** + 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Envelope: +``` + 60 00 - standard header + 01 - ID + 31 - modify envelope + 84 - ID of envelope attribute ( attack_level 82, + attack_length 81, + fade_level 88, + fade_length 84 ) + 63 04 - value attribute should be set to ?***? + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Duration: +``` + 60 00 - standard header + 01 - ID + 49 00 41 - modify timing? + 6c 20 - length in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Offset: `N/A` + +## FF_RAMP + +Ramps seem to follow triangle wave parameters. + +### Init: +``` + 60 00 - standard header + 01 - ID + 6b - new ramp effect + f6 7f - difference *** + fe ff - level? *** (level = (if end_level > start_level, end_level, else + start_level) - difference?) (signed) + 00 00 + f7 17 - time + 00 80 - some kind of marker + 00 00 - attack_length + f6 7f - attack_level *** + 00 00 - fade_length + f6 7f - fade_level*** + 04 - invert (going "down", 05, going "up", 04) + 4f + f7 17 - time again? + 00 00 + 00 00 - offset + 00 ff ff - end of init + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Modifying: +``` + 60 00 - standard header + 01 - ID + 0e - ??? + 03 - ramp? + e3 04 - difference? + 7d 75 - "level"? + 05 - ???? + 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Envelope: +``` + 60 00 - standard header + 01 - ID + 31 - modify envelope + 84 - ID of envelope attribute ( attack_level 82, + attack_length 81, + fade_level 88, + fade_length 84 ) + 63 04 - value attribute should be set to + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Duration: +``` + 60 00 + 01 - ID + 4e - ? + 08 - ? + 01 00 - time in milliseconds + 05 - ? + 41 - ? + 01 00 - time in milliseconds + 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +#### Offset: `N/A` + +## FF_SPRING: +### Init: +``` + 60 00 - standard header + 01 - ID + 64 - new conditional effect + fc 7f - positive coefficient (right?) + fc 7f - negative coefficient (left?) + fe ff - deadband (left?) (deadband + offset) (fe ff means no deadband) + fe ff - deadband (right?) (deadband + offset) + a6 6a a6 6a fe ff fe ff fe ff fe ff df 58 a6 6a 06 - some weird hard-coded + values to do with springs? + + 4f + f7 17 - duration + 00 00 + 00 00 - offset + 00 ff ff - end of init + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Modifying: +Same as below (FF_DAMPER + FF_FRICTION + FF_INERTIA) + +## FF_DAMPER + FF_FRICTION + FF_INERTIA: +### Init: +``` + 60 00 - standard header + 02 -ID + 64 - new conditional effect + fc 7f - positive coefficient (right?) + fc 7f - negative coefficient (left?) + fe ff - deadband (left?) (deadband + offset) (fe ff means no deadband) + fe ff - deadband (right?) (deadband + offset) + fc 7f fc 7f fe ff fe ff fe ff fe ff fc 7f fc 7f 07 - some weird hard-coded + values to do with friction? + 4f + f7 17 - duration + 00 00 + 00 00 - offset + 00 ff ff - end of init + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Modifying: +``` + positive coefficient: + 60 00 + 02 - ID + 0e 41 + 64 35 - value, signed (between 00 00 and 01 80?) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + negative coefficient: + 60 00 + 02 - ID + 0e 42 + 64 35 - value, signed (between 00 00 and ff 7f?) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + deadband/offset: + 60 00 + 02 - ID + 0e 4c + 64 35 - deadband (right?) (deadband + offset) (fe ff means no deadband) + 00 00 - deadband (left?) (deadband + offset) + 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Duration: +``` + 60 00 - standard header + 01 - ID + 49 06 41 - modify timing? + 6c 20 - length in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Offset: `N/A` + +## FF_PERIODIC: +### Init +``` + 60 00 - standard header + 01 - ID + 6b - new periodic effect + 00 00 - magnitude *** + fe ff - offset (up/down) + 00 00 - phase (left/right) + e8 03 - period + 00 80 + 00 00 - attack_length + 00 00 - attack_level *** + 00 00 - fade_length + 00 00 - fade_level *** + 01 - type of periodic ( square 01, + sine 03, + triangle 02, + sawtooth down 05, + sawtooth up 04 ) + 4f + f7 17 - duration + 00 00 + 00 00 - offset + 00 ff ff - end of init + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Modifying: +``` + magnitude: + 60 00 + 02 - ID + 0e 01 + 64 35 - value, signed (between 00 00 and ff 7f?) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + offset of effect: + 60 00 + 02 - ID + 0e 02 + 64 35 - value, signed (between 00 00 and ff 7f?) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + phase: + 60 00 + 02 - ID + 0e 04 + 64 35 - value, signed (between 80 01 and ff 7f?) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + period: + 60 00 + 02 - ID + 0e 08 + 64 35 - value, signed (between 00 00 and I guess ff 7f?) (max value in + wireshark is 0d 07, but I don't know if that's a driver or program issue) + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +``` + +### Envelope: +``` + 60 00 - standard header + 01 - ID + 31 - modify envelope + 84 - ID of envelope attribute ( attack_level 82, + attack_length 81, + fade_level 88, + fade_length 84 ) + 63 04 - value attribute should be set to + 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + +### Duration: +``` + Square: + 60 00 + 01 - ID + 49 - ? + 01 - Effect type + 41 - ? + 4e 0c - Time in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + Sine: + 60 00 + 01 - ID + 49 - ? + 03 - Effect type + 41 - ? + ec 13 - Time in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + Triangle: + 60 00 + 01 - ID + 49 - ? + 02 - Effect type + 41 - ? + 4e 0c - Time in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + Sawtooth up: + 60 00 + 01 - ID + 49 - ? + 04 - Effect type + 41 - ? + 4e 0c - Time in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + Sawtooth down: + 60 00 + 01 - ID + 49 - ? + 05 - Effect type + 41 - ? + ec 13 - Time in milliseconds + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` +### Offset: `N/A ?` + +## PS4 Input `rdesc` +``` + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 226 /* wheel */ + ff00.0021 = 125 /* wheel */ + ff00.0021 = 255 /* gas */ + ff00.0021 = 255 /* gas */ + ff00.0021 = 255 /* brake */ + ff00.0021 = 255 /* brake */ + ff00.0021 = 255 /* clutch */ + ff00.0021 = 255 /* clutch */ + ff00.0021 = 0 + ff00.0021 = 255 + ff00.0021 = 255 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 + ff00.0021 = 0 +``` diff --git a/docs/INTEGRATION.md b/docs/INTEGRATION.md new file mode 100644 index 0000000..bcdb9f4 --- /dev/null +++ b/docs/INTEGRATION.md @@ -0,0 +1,6 @@ +Some distros require more complicated installation methods than what's outlined +in the README. This page is intended to collect information about the topic. + +# NixOS + +See https://github.com/Kimplul/hid-tmff2/issues/71. diff --git a/docs/STRUCTURE.md b/docs/STRUCTURE.md new file mode 100644 index 0000000..e7778ba --- /dev/null +++ b/docs/STRUCTURE.md @@ -0,0 +1,42 @@ +# Structure of the Thrustmaster device 'stack' + ++ `hid-tmff` + +Driver for older Thrustmaster wheels, has existed in the Kernel for a long time +and I have nothing to with it. + ++ `hid-thrustmaster` + +Driver for initializing newer Thrustmaster wheels, initially added in version +5.13. Essentially `hid-tminit`, with some modifications to better fit into the +kernel. + ++ `hid-tminit` + +Driver for initializing newer Thrustmaster wheels, currently maintained over at +https://github.com/scarburato/hid-tminit. + +All newer Thrustmaster wheels initially identify themselves as `Thrustmaster FFB +Wheel`, and it is up to the `hid-tminit` driver to boot the wheel into its +correct designation, after which the corresponding driver can take over. No FFB +takes place while this driver is active. + ++ `hid-tmff-new` + +Active driver module for different wheels, responsible for handling FFB. +At the moment only supports T300 RS and T248. Note that the T300 RS has a number +of different modes, of which PS3, PS4, and PS3 F1 (advanced) mode are known to +work (at least on some systems, please open up any issues you encounter.) + ++ `hid-tmff2` + +Name of this projects, initially I intended to write `hid-tmff` but for newer +wheels, hence the name. Because of some slight weirdness in the Kernel build +configuration, I couldn't use `hid-tmff2` as the module name, so I chose +`hid-tmff-new`. + +I don't know exactly which wheels are 'newer' and which are 'older', but at +least T150/T248/T300/T500 are in the 'newer' category. + +Note that the T150 already has a driver in a separate module +(https://github.com/scarburato/t150_driver). diff --git a/docs/TODO.md b/docs/TODO.md new file mode 100644 index 0000000..632a8a8 --- /dev/null +++ b/docs/TODO.md @@ -0,0 +1,3 @@ +# TODO list + ++ Try to figure out how/if RRRE (#39) determines FFB from wheel input diff --git a/force-effects.txt b/force-effects.txt deleted file mode 100644 index 0595611..0000000 --- a/force-effects.txt +++ /dev/null @@ -1,462 +0,0 @@ -Here I will gather all info I can find out about the different force effects and -their USB commands. All values seem to be little-endian. -Also, general note, it seems like some effects are affected by the direction of -the force, denoted by *** - -As far as I can tell, fade_level and attack_level values are calculated by -mapping the u16 into s16 and taking the absolute value, and after that -multiplying by the direction. - -All values are examples of actual commands that I captured on the USB interface, -not the only ones available. - -GENERAL: - - Playing: - 60 00 - standard header - 01 - ID - 89 - playing options - 01 - play - 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - - Stopping/removing: (why are they rolled into one?) - 60 00 - standard header - 01 - ID - 89 - playing options - 00 - stop - 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -FF_CONSTANT: - Initialization: - 60 00 - standard header - 01 - ID - 6a - new constant effect(?) - fe ff - strength *** - 00 00 - attack_length - 00 00 - attack_level *** - 00 00 - fade_length - 00 00 - fade_level *** - 00 4f - ? - f7 17 - time in milliseconds, unsigned - 00 00 - 07 00 - offset from start(?) - 00 ff ff - end of new effect(?) - 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - - Modifying: (For dynamic updating of effects) - Direction: n/a - - Constant force: - 60 00 - standard header - 01 - ID - 0a - modify constant force - 05 16 - constant force *** - 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Envelope: - 60 00 - standard header - 01 - ID - 31 - modify envelope - 84 - ID of envelope attribute ( attack_level 82, - attack_length 81, - fade_level 88, - fade_length 84 ) - 63 04 - value attribute should be set to ?***? - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Duration: - 60 00 - standard header - 01 - ID - 49 00 41 - modify timing? - 6c 20 - length in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Offset: - Not supported? - - -FF_RAMP: - (Why on earth is it this difficult to figure out how a fucking ramp works?) - Init: - 60 00 - standard header - 01 - ID - 6b - new ramp effect - f6 7f - difference *** - fe ff - level? *** (level = (if end_level > start_level, end_level, else - start_level) - difference?) (signed) - 00 00 - f7 17 - time - 00 80 - some kind of marker - 00 00 - attack_length - f6 7f - attack_level *** - 00 00 - fade_length - f6 7f - fade_level*** - 04 - invert (going "down", 05, going "up", 04) - 4f - f7 17 - time again? - 00 00 - 00 00 - offset - 00 ff ff - end of init - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Modifying: - Sweet baby jesus - I'll figure this out later - Ramp(?): - 60 00 - standard header - 01 - ID - 0e - ??? - 03 - ramp? - e3 04 - difference? - 7d 75 - "level"? - 05 - ???? - 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - - Envelope: - 60 00 - standard header - 01 - ID - 31 - modify envelope - 84 - ID of envelope attribute ( attack_level 82, - attack_length 81, - fade_level 88, - fade_length 84 ) - 63 04 - value attribute should be set to - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Duration: - - 60 00 - 01 - ID - 4e - ? - 08 - ? - 01 00 - time in milliseconds - 05 - ? - 41 - ? - 01 00 - time in milliseconds - 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Offset: - Not supported? - -FF_SPRING: - Init: - 60 00 - standard header - 01 - ID - 64 - new conditional effect - fc 7f - positive coefficient (right?) - fc 7f - negative coefficient (left?) - fe ff - deadband (left?) (deadband + offset) (fe ff means no deadband) - fe ff - deadband (right?) (deadband + offset) - a6 6a a6 6a fe ff fe ff fe ff fe ff df 58 a6 6a 06 - some weird hard-coded - values to do with springs? - - 4f - f7 17 - duration - 00 00 - 00 00 - offset - 00 ff ff - end of init - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Modifying: - Same as under - -FF_DAMPER + FF_FRICTION + FF_INERTIA: - Init: - 60 00 - standard header - 02 -ID - 64 - new conditional effect - fc 7f - positive coefficient (right?) - fc 7f - negative coefficient (left?) - fe ff - deadband (left?) (deadband + offset) (fe ff means no deadband) - fe ff - deadband (right?) (deadband + offset) - fc 7f fc 7f fe ff fe ff fe ff fe ff fc 7f fc 7f 07 - some weird hard-coded - values to do with friction? - 4f - f7 17 - duration - 00 00 - 00 00 - offset - 00 ff ff - end of init - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Modifying: - positive coefficient: - 60 00 - 02 - ID - 0e 41 - 64 35 - value, signed (between 00 00 and 01 80?) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - negative coefficient: - 60 00 - 02 - ID - 0e 42 - 64 35 - value, signed (between 00 00 and ff 7f?) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - deadband/offset: - 60 00 - 02 - ID - 0e 4c - 64 35 - deadband (right?) (deadband + offset) (fe ff means no deadband) - 00 00 - deadband (left?) (deadband + offset) - 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Duration: - 60 00 - standard header - 01 - ID - 49 06 41 - modify timing? - 6c 20 - length in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Offset: - Not supported? - -FF_PERIODIC: - 60 00 - standard header - 01 - ID - 6b - new periodic effect - 00 00 - magnitude *** - fe ff - offset (up/down) - 00 00 - phase (left/right) - e8 03 - period - 00 80 - 00 00 - attack_length - 00 00 - attack_level *** - 00 00 - fade_length - 00 00 - fade_level *** - 01 - type of periodic ( square 01, - sine 03, - triangle 02, - sawtooth down 05, - sawtooth up 04 ) - 4f - f7 17 - duration - 00 00 - 00 00 - offset - 00 ff ff - end of init - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Modifying: - magnitude: - 60 00 - 02 - ID - 0e 01 - 64 35 - value, signed (between 00 00 and ff 7f?) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - offset of effect: - 60 00 - 02 - ID - 0e 02 - 64 35 - value, signed (between 00 00 and ff 7f?) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - phase: - 60 00 - 02 - ID - 0e 04 - 64 35 - value, signed (between 80 01 and ff 7f?) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - period: - 60 00 - 02 - ID - 0e 08 - 64 35 - value, signed (between 00 00 and I guess ff 7f?) (max value in - wireshark is 0d 07, but I don't know if that's a driver or program issue) - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - - Envelope: - 60 00 - standard header - 01 - ID - 31 - modify envelope - 84 - ID of envelope attribute ( attack_level 82, - attack_length 81, - fade_level 88, - fade_length 84 ) - 63 04 - value attribute should be set to - 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Duration: - - Square: - 60 00 - 01 - ID - 49 - ? - 01 - Effect type - 41 - ? - 4e 0c - Time in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Sine: - 60 00 - 01 - ID - 49 - ? - 03 - Effect type - 41 - ? - ec 13 - Time in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Triangle: - 60 00 - 01 - ID - 49 - ? - 02 - Effect type - 41 - ? - 4e 0c - Time in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Sawtooth up: - 60 00 - 01 - ID - 49 - ? - 04 - Effect type - 41 - ? - 4e 0c - Time in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Sawtooth down: - 60 00 - 01 - ID - 49 - ? - 05 - Effect type - 41 - ? - ec 13 - Time in milliseconds - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - Offset: - Not supported? - - -FF_AUTOCENTER: - 60 08 - header plus settings? - 03 - set autocenter force - 8f 02 - force (between ff ff and 00 00) - 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -FF_GAIN: - 60 02 - header plus gain? - bf - gain (between ff and 00) - 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -Rotation angle: - 60 08 - header plus settings? - 11 - set rotation angle - 55 d5 - angle (between ff ff and 7b 09, one degree is roughly 3c) - 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -Open: - 60 01 - standard header? - 04 - ? - 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - (this command doesn't appear every time, odd) - 60 12 - ? - bf 04 00 00 03 b7 1e - ? /* wow, this is different on different wheels? */ - 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - - 60 01 - ? - 05 - ? - 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -Close: - 60 01 - standard header? - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - diff --git a/hid-tminit b/hid-tminit deleted file mode 160000 -Subproject 53fde059e88a4314d987ab75518edb8ce86cf8a diff --git a/ps4-input.txt b/ps4-input.txt deleted file mode 100644 index 9286c7e..0000000 --- a/ps4-input.txt +++ /dev/null @@ -1,54 +0,0 @@ -1 ff00.0021 = 0 -2 ff00.0021 = 0 -3 ff00.0021 = 0 -4 ff00.0021 = 0 -5 ff00.0021 = 0 -6 ff00.0021 = 0 -7 ff00.0021 = 0 -8 ff00.0021 = 0 -9 ff00.0021 = 0 -10 ff00.0021 = 0 -11 ff00.0021 = 0 -12 ff00.0021 = 0 -13 ff00.0021 = 0 -14 ff00.0021 = 0 -15 ff00.0021 = 0 -16 ff00.0021 = 0 -17 ff00.0021 = 0 -18 ff00.0021 = 0 -19 ff00.0021 = 0 -20 ff00.0021 = 0 -21 ff00.0021 = 0 -22 ff00.0021 = 0 -23 ff00.0021 = 0 -24 ff00.0021 = 0 -25 ff00.0021 = 0 -26 ff00.0021 = 0 -27 ff00.0021 = 0 -28 ff00.0021 = 0 -29 ff00.0021 = 0 -30 ff00.0021 = 0 -31 ff00.0021 = 0 -32 ff00.0021 = 0 -33 ff00.0021 = 0 -34 ff00.0021 = 226 /* wheel */ -35 ff00.0021 = 125 /* wheel */ -36 ff00.0021 = 255 /* gas */ -37 ff00.0021 = 255 /* gas */ -38 ff00.0021 = 255 /* brake */ -39 ff00.0021 = 255 /* brake */ -40 ff00.0021 = 255 /* clutch */ -41 ff00.0021 = 255 /* clutch */ -42 ff00.0021 = 0 -43 ff00.0021 = 255 -44 ff00.0021 = 255 -45 ff00.0021 = 0 -46 ff00.0021 = 0 -47 ff00.0021 = 0 -48 ff00.0021 = 0 -49 ff00.0021 = 0 -50 ff00.0021 = 0 -51 ff00.0021 = 0 -52 ff00.0021 = 0 -53 ff00.0021 = 0 -54 ff00.0021 = 0 diff --git a/hid-tmff2.c b/src/hid-tmff2.c index 44df1e3..013039f 100644 --- a/hid-tmff2.c +++ b/src/hid-tmff2.c @@ -101,7 +101,6 @@ static ssize_t spring_level_store(struct device *dev, static ssize_t spring_level_show(struct device *dev, struct device_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%u\n", spring_level); } static DEVICE_ATTR_RW(spring_level); @@ -132,7 +131,6 @@ static ssize_t damper_level_store(struct device *dev, static ssize_t damper_level_show(struct device *dev, struct device_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%u\n", damper_level); } static DEVICE_ATTR_RW(damper_level); @@ -163,12 +161,7 @@ static ssize_t friction_level_store(struct device *dev, static ssize_t friction_level_show(struct device *dev, struct device_attribute *attr, char *buf) { - size_t count; - - - count = scnprintf(buf, PAGE_SIZE, "%u\n", friction_level); - - return count; + return scnprintf(buf, PAGE_SIZE, "%u\n", friction_level); } static DEVICE_ATTR_RW(friction_level); @@ -179,7 +172,6 @@ static ssize_t range_store(struct device *dev, unsigned int value; int ret; - if (!tmff2) return -ENODEV; @@ -199,7 +191,6 @@ static ssize_t range_store(struct device *dev, static ssize_t range_show(struct device *dev, struct device_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%u\n", range); } static DEVICE_ATTR_RW(range); @@ -333,7 +324,7 @@ static void tmff2_work_handler(struct work_struct *w) } else { __clear_bit(FF_EFFECT_QUEUE_UPLOAD, &state->flags); /* if we're uploading an effect, it's bound to be the up - * to date available */ + * to date */ __clear_bit(FF_EFFECT_QUEUE_UPDATE, &state->flags); } } @@ -458,6 +449,8 @@ static void tmff2_close(struct input_dev *dev) return; /* since we're closing the device, no need to continue feeding it new data */ + /* TODO: check somewhere that multiple users can't open us at the same + * time */ cancel_delayed_work_sync(&tmff2->work); if (tmff2->close) { @@ -620,7 +613,6 @@ static int tmff2_probe(struct hid_device *hdev, const struct hid_device_id *id) hid_set_drvdata(tmff2->hdev, tmff2); switch (tmff2->hdev->product) { - /* t300rs */ case TMT300RS_PS3_NORM_ID: case TMT300RS_PS3_ADV_ID: case TMT300RS_PS4_NORM_ID: diff --git a/hid-tmff2.h b/src/hid-tmff2.h index 97d52a1..1eb3546 100644 --- a/hid-tmff2.h +++ b/src/hid-tmff2.h @@ -17,7 +17,7 @@ extern int alt_mode; #define USB_VENDOR_ID_THRUSTMASTER 0x044f /* the wheel seems to only be capable of processing a certain number of - * interrupts per second, and if this value is too low the kernel urb buffer(or + * interrupts per second, and if this value is too low the kernel urb buffer (or * some buffer at least) fills up. Optimally I would figure out some way to * space out the interrupts so that they all leave at regular intervals, but * for now this is good enough, go slow enough that everything works. @@ -66,7 +66,7 @@ struct tmff2_device_entry { int allow_scheduling; - /* fields relevant to each actual device (T300, T150...) */ + /* fields relevant to each actual device (T300, T248...) */ void *data; unsigned long params; unsigned long max_effects; @@ -86,15 +86,16 @@ struct tmff2_device_entry { int (*close)(void *data, int); int (*set_gain)(void *data, uint16_t gain); int (*set_range)(void *data, uint16_t range); - /* switch_mode has to not do anything if we're alredy in the specified - * mode */ + /* switch_mode is required to not do anything if we're alredy in the + * specified mode */ int (*switch_mode)(void *data, uint16_t mode); ssize_t (*alt_mode_show)(void *data, char *buf); ssize_t (*alt_mode_store)(void *data, const char *buf, size_t count); int (*set_autocenter)(void *data, uint16_t autocenter); __u8 *(*wheel_fixup)(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize); - /* void pointers are dangerous, I know, but in this case likely the best option... */ + /* void pointers are dangerous, I know, but in this case likely the + * best option... */ }; /* external */ @@ -108,11 +109,11 @@ int tx_populate_api(struct tmff2_device_entry *tmff2); #define TMT248_PC_ID 0xb696 -#define TX_ACTIVE 0xb669 +#define TX_ACTIVE 0xb669 -/* apis to different wheel families */ -/* T248 at least uses the T300RS api, not sure if there are other wheels but that's - * why these functions are given global linkage */ +/* APIs to different wheel families */ +/* T248 and TX at least uses the T300RS api, not sure if there are other wheels + * but that's why these functions are given global linkage */ struct t300rs_device_entry { struct hid_device *hdev; @@ -144,4 +145,4 @@ int t300rs_set_autocenter(void *, uint16_t); int t300rs_send_buf(struct t300rs_device_entry *t300rs, u8 *send_buffer, size_t len); int t300rs_send_int(struct t300rs_device_entry *t300rs); -#endif /* __HID_TMFF2_H */ +#endif diff --git a/hid-tmt248.c b/src/tmt248/hid-tmt248.c index 386f6d8..af3aaa9 100644 --- a/hid-tmt248.c +++ b/src/tmt248/hid-tmt248.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include <linux/usb.h> #include <linux/hid.h> -#include "hid-tmff2.h" +#include "../hid-tmff2.h" #define T248_MAX_EFFECTS 16 #define T248_BUFFER_LENGTH 63 diff --git a/hid-tmt300rs.c b/src/tmt300rs/hid-tmt300rs.c index 4499687..0191620 100644 --- a/hid-tmt300rs.c +++ b/src/tmt300rs/hid-tmt300rs.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include <linux/usb.h> #include <linux/hid.h> -#include "hid-tmff2.h" +#include "../hid-tmff2.h" #define T300RS_MAX_EFFECTS 16 #define T300RS_NORM_BUFFER_LENGTH 63 @@ -1187,7 +1187,8 @@ int t300rs_update_effect(void *data, struct tmff2_effect_state *state) case FF_PERIODIC: return t300rs_update_periodic(t300rs, state); default: - hid_err(t300rs->hdev, "invalid effect type: %x", state->effect.type); + hid_err(t300rs->hdev, "invalid effect type: %x", + state->effect.type); return -1; } } @@ -1209,7 +1210,8 @@ int t300rs_upload_effect(void *data, struct tmff2_effect_state *state) case FF_PERIODIC: return t300rs_upload_periodic(t300rs, state); default: - hid_err(t300rs->hdev, "invalid effect type: %x", state->effect.type); + hid_err(t300rs->hdev, "invalid effect type: %x", + state->effect.type); return -1; } } @@ -1328,7 +1330,9 @@ int t300rs_set_autocenter(void *data, uint16_t value) if (!t300rs) return -ENODEV; - /* TODO: this should probably also use a separately allocated buffer? */ + /* TODO: this should probably also use a separately allocated buffer? + * someone might change autocentering while we're updating the buffer + * which would cause corruption */ autocenter_packet = (struct t300rs_packet_autocenter *)t300rs->send_buffer; autocenter_packet->header.cmd = 0x08; @@ -1477,7 +1481,7 @@ static int t300rs_check_firmware(struct t300rs_device_entry *t300rs) return -ENOMEM; } - /* Fetch firmware version */ + /* fetch firmware version */ ret = usb_control_msg(t300rs->usbdev, usb_rcvctrlpipe(t300rs->usbdev, 0), t300rs_fw_request.bRequest, @@ -1494,7 +1498,7 @@ static int t300rs_check_firmware(struct t300rs_device_entry *t300rs) goto out; } - /* Educated guess */ + /* educated guess */ if (fw_response->fw_version < 31 && ret >= 0) { hid_err(t300rs->hdev, "firmware version %i is too old, please update.\n", @@ -1574,7 +1578,8 @@ static int t300rs_get_attachment(struct t300rs_device_entry *t300rs) } else if (response->type == cpu_to_le16(0x47)) { attachment = response->b.attachment; } else { - hid_err(t300rs->hdev, "unknown packet type %hx\n, please contact a maintainer", + hid_err(t300rs->hdev, + "unknown packet type %hx\n, please contact a maintainer", response->type); ret = -EINVAL; goto out; diff --git a/hid-tmt300rs.h b/src/tmt300rs/hid-tmt300rs.h index 9045341..2305f4b 100644 --- a/hid-tmt300rs.h +++ b/src/tmt300rs/hid-tmt300rs.h @@ -2,8 +2,8 @@ #ifndef __HID_TMT300RS_H #define __HID_TMT300RS_H -#include "hid-tmff2.h" +#include "../hid-tmff2.h" int t300rs_populate_api(struct tmff2_device_entry *tmff2); -#endif /* __HID_TM300RS_H */ +#endif diff --git a/hid-tmtx.c b/src/tmtx/hid-tmtx.c index 47d59ad..afca799 100644 --- a/hid-tmtx.c +++ b/src/tmtx/hid-tmtx.c @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include <linux/usb.h> #include <linux/hid.h> -#include "hid-tmff2.h" +#include "../hid-tmff2.h" -#define T248_MAX_EFFECTS 16 -#define T248_BUFFER_LENGTH 63 +#define TMTX_MAX_EFFECTS 16 +#define TMTX_BUFFER_LENGTH 63 static const u8 setup_0[64] = { 0x42, 0x01 }; static const u8 setup_1[64] = { 0x0a, 0x04, 0x90, 0x03 }; @@ -254,7 +254,7 @@ int tx_wheel_init(struct tmff2_device_entry *tmff2, int open_mode) tx->hdev = tmff2->hdev; tx->input_dev = tmff2->input_dev; tx->usbdev = to_usb_device(tmff2->hdev->dev.parent->parent); - tx->buffer_length = T248_BUFFER_LENGTH; + tx->buffer_length = TMTX_BUFFER_LENGTH; tx->send_buffer = kzalloc(tx->buffer_length, GFP_KERNEL); if (!tx->send_buffer) { @@ -275,7 +275,7 @@ int tx_wheel_init(struct tmff2_device_entry *tmff2, int open_mode) /* everything went OK */ tmff2->data = tx; tmff2->params = tx_params; - tmff2->max_effects = T248_MAX_EFFECTS; + tmff2->max_effects = TMTX_MAX_EFFECTS; memcpy(tmff2->supported_effects, tx_effects, sizeof(tx_effects)); if (!open_mode) diff --git a/t248-effects.txt b/t248-effects.txt deleted file mode 100644 index 821fc7a..0000000 --- a/t248-effects.txt +++ /dev/null @@ -1,2 +0,0 @@ -Open: Identical to T300 -Close: Identical to T300 |
