Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for Logitech PRO Racing Wheel #135

Closed
atzufuki opened this issue Mar 24, 2023 · 26 comments
Closed

Support for Logitech PRO Racing Wheel #135

atzufuki opened this issue Mar 24, 2023 · 26 comments
Labels
help wanted Extra attention is needed

Comments

@atzufuki
Copy link
Contributor

Hello,

I now own the new PRO wheel, so I am willing to help getting it supported in Oversteer.

The wheel has a G923 compatibility mode, which Oversteer seems to detect fine, but I think detecting the wheel in default mode as well wouldn't hurt anybody.

@berarma
Copy link
Owner

berarma commented Mar 24, 2023

Of course. We should add the vendor/product ids for the wheel. They can be read using lsusb.

Once added so it gets recognized, the wheel, pedals and buttons have to be tested to see if the mappings are correct.

Please, state which version do you have too, PlayStation or XBox.

@atzufuki
Copy link
Contributor Author

I have the Xbox/PC version.

Already got some readings with jstest, so I know the wheel works in the first place. 🎉 I'll try if I manage to get it recognized in the following days when I have some free time.

@alexbrrsclnt
Copy link

alexbrrsclnt commented Mar 24, 2023

Is It possible that Xbox/Pc version has different product Id than the PS/Pc one?

@berarma
Copy link
Owner

berarma commented Mar 24, 2023

Is It possible that Xbox/Pc version has different product Id than the PS/Pc one?

Yes, very probably based on what we know about previous models.

@atzufuki
Copy link
Contributor Author

Oversteer now recognizes the wheel.

Working:

  • Steering
  • Gear up, Gear down
  • Y, B, A, X, LT, RT, LSB, RSB, view, menu -buttons
  • Directional pad,
  • Right Adjustment Dial and push button

Not working:

  • Xbox button
  • Left Dual Clutch Paddle
  • Right Dual Clutch Paddle
  • Left Adjustment Dial and push button
  • Pedals
  • Force feedback

The clutch pedal including both clutch paddles registers as a break pedal, but behaves weirdly. Gas and break have no effect.

Turning the Left Adjustment Dial to the right seems to register as B24, but turning it to left or pushing doesn't register to any button slot.

Here's my changes: atzufuki#1

I had to comment out get_autocenter and get_ff_gain methods to be able to launch Oversteer. I assume we need to implement the support for FFB in new-lg4ff to make these methods work, am I right?

@berarma
Copy link
Owner

berarma commented Mar 24, 2023

I don't think this device should be supported by new-lg4ff. Hopefully it will use some other known protocol like HID++ or PIDFF and it could work with the corresponding modules with some adjustments. Someone will have to figure out unless Logitech helps us.

The axes and buttons should work though. The issue is probably that we're not mapping them correctly. You can use evtest to see the events generated by the pedals, paddles, buttons... If you can make a list of the events used and their use then I can implement the mapping for Oversteer to show them correctly.

I'll see why you had to comment out any functions, it shouldn't be needed.

@atzufuki
Copy link
Contributor Author

I see.

This constant ecodes.EV_FF returns a number 21, therefore this line below assumes the capabilities dict contains a key 21, but in my case capabilities contains keys only up to 4.

if ecodes.FF_AUTOCENTER in capabilities[ecodes.EV_FF]:

Thanks, I'll make the list. Before that I might actually update the firmware with G Hub (if any), once I get a Windows machine running...

@atzufuki
Copy link
Contributor Author

Okay so there is 4 event types which are mapped to that capabilities dict. I guess they are mapped differently in other wheels, therefore this capabilities[ecodes.EV_FF] code didn't work.

$ evtest /dev/input/event25
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x46d product 0xc272 version 0x111
Input device name: "Logitech  PRO Racing Wheel for Xbox/PC"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 288 (BTN_TRIGGER)
    Event code 289 (BTN_THUMB)
    Event code 290 (BTN_THUMB2)
    Event code 291 (BTN_TOP)
    Event code 292 (BTN_TOP2)
    Event code 293 (BTN_PINKIE)
    Event code 294 (BTN_BASE)
    Event code 295 (BTN_BASE2)
    Event code 296 (BTN_BASE3)
    Event code 297 (BTN_BASE4)
    Event code 298 (BTN_BASE5)
    Event code 299 (BTN_BASE6)
    Event code 300 (?)
    Event code 301 (?)
    Event code 302 (?)
    Event code 303 (BTN_DEAD)
    Event code 704 (BTN_TRIGGER_HAPPY1)
    Event code 705 (BTN_TRIGGER_HAPPY2)
    Event code 706 (BTN_TRIGGER_HAPPY3)
    Event code 707 (BTN_TRIGGER_HAPPY4)
    Event code 708 (BTN_TRIGGER_HAPPY5)
    Event code 709 (BTN_TRIGGER_HAPPY6)
    Event code 710 (BTN_TRIGGER_HAPPY7)
    Event code 711 (BTN_TRIGGER_HAPPY8)
    Event code 712 (BTN_TRIGGER_HAPPY9)
    Event code 713 (BTN_TRIGGER_HAPPY10)
    Event code 714 (BTN_TRIGGER_HAPPY11)
    Event code 715 (BTN_TRIGGER_HAPPY12)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value  32736
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 2 (ABS_Z)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 3 (ABS_RX)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 4 (ABS_RY)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 5 (ABS_RZ)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 6 (ABS_THROTTLE)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 7 (ABS_RUDDER)
      Value      0
      Min        0
      Max    65535
      Fuzz     255
      Flat    4095
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)

I'' paste the missing events as is:

Xbox button

Event: time 1679737374.987339, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001c
Event: time 1679737374.987339, type 1 (EV_KEY), code 715 (BTN_TRIGGER_HAPPY12), value 0

Left Dual Clutch Paddle

Event: time 1679737502.302990, type 3 (EV_ABS), code 5 (ABS_RZ), value 206

Right Dual Clutch Paddle

Event: time 1679737577.588401, type 3 (EV_ABS), code 5 (ABS_RZ), value 151

Left Adjustment Dial and push button

# Turn left
Event: time 1679737609.084579, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001a
Event: time 1679737609.084579, type 1 (EV_KEY), code 713 (BTN_TRIGGER_HAPPY10), value 1

# Turn right
Event: time 1679737666.692884, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90019
Event: time 1679737666.692884, type 1 (EV_KEY), code 712 (BTN_TRIGGER_HAPPY9), value 1

# Push
Event: time 1679737693.442050, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001b
Event: time 1679737693.442050, type 1 (EV_KEY), code 714 (BTN_TRIGGER_HAPPY11), value 1

Throttle

Event: time 1679737727.162187, type 3 (EV_ABS), code 3 (ABS_RX), value 168

Break

Event: time 1679737743.027268, type 3 (EV_ABS), code 4 (ABS_RY), value 530

Clutch

Event: time 1679737757.207341, type 3 (EV_ABS), code 5 (ABS_RZ), value 99

@berarma
Copy link
Owner

berarma commented Mar 25, 2023

So the clutch paddles and pedal share the same axis. Is that right? Are they doing the same function?

@atzufuki
Copy link
Contributor Author

Yes, but according to this document (page 14), they can be assigned to other axis as well.

@berarma berarma added the help wanted Extra attention is needed label Jul 12, 2023
@berarma
Copy link
Owner

berarma commented Aug 29, 2023

I had to comment out get_autocenter and get_ff_gain methods to be able to launch Oversteer. I assume we need to implement the support for FFB in new-lg4ff to make these methods work, am I right?

I think this issue is already fixed. Now I'll do the mapping of the device axes and buttons.

You might be interested in following this thread (berarma/new-lg4ff#82) were there's a discussion to make this wheel work with the hidpp driver.

@motolav
Copy link

motolav commented Aug 29, 2023

Here's the repo where development for the G Pro wheel is at JacKeTUs/hid-logitech-hidpp

@motolav
Copy link

motolav commented Aug 31, 2023

@atzufuki the repo above should be usable now if you'd like to test it

@atzufuki
Copy link
Contributor Author

atzufuki commented Sep 3, 2023

@motolav Tested with fftest and Oversteer's testing utility. The FFB seems to be working fine. 👍

@atzufuki
Copy link
Contributor Author

atzufuki commented Sep 5, 2023

Now I'll do the mapping of the device axes and buttons.

I messed around with the pedal axles and got rid of the weird behavior I mentioned earlier.

The clutch pedal including both clutch paddles registers as a break pedal, but behaves weirdly. Gas and break have no effect.

Here's what I did. Seems quite big of a change compared to other normalizations, so I'm wondering if it is really necessary?

atzufuki@0500f3a#diff-2ebf1a818f5427cf31b5cc3cb067a8c39787b328f11ed9da77967eb57acd20d1R387

@berarma
Copy link
Owner

berarma commented Sep 5, 2023

Now I'll do the mapping of the device axes and buttons.

I messed around with the pedal axles and got rid of the weird behavior I mentioned earlier.

Can you explain a bit for future reference?

The clutch pedal including both clutch paddles registers as a break pedal, but behaves weirdly. Gas and break have no effect.

Here's what I did. Seems quite big of a change compared to other normalizations, so I'm wondering if it is really necessary?

atzufuki@0500f3a#diff-2ebf1a818f5427cf31b5cc3cb067a8c39787b328f11ed9da77967eb57acd20d1R387

Probably. As long as the controls show right, it's probably right. I'll review it and maybe do some changes to avoid duplication of code if necessary. Can you make a PR? Thanks!

@atzufuki
Copy link
Contributor Author

atzufuki commented Sep 5, 2023

Here's the PR #153. I guess you can link it with this issue? (I mainly use Gitlab, the flow is a bit different)

Can you explain a bit for future reference?

Yes so basically G PRO's pedals seem quite sensitive. By this I mean that the event value for the pedals goes all the way up to 65535 (the maximum value I was able to get while pressing the throttle down). Now I assume that the max value for the pedals in Oversteer is 257, since this existing configuration for Fanatec used that value as a divisor.

if self.vendor_id == wid.VENDOR_FANATEC and event.code in [ecodes.ABS_Y, ecodes.ABS_Z, ecodes.ABS_RZ]:
    event.value = int(event.value / 257)

But since that calculation had a reversed result with the G PRO, I had to unreverse it with int(257 - event.value / 257).

berarma added a commit that referenced this issue Sep 13, 2023
- Tentative changes for #135
- Tentative changes for #47

Feedback required.
@berarma
Copy link
Owner

berarma commented Sep 13, 2023

I've merged the PR and made some changes that I hope are correct. Can someone please test it?

@atzufuki
Copy link
Contributor Author

The reorganization itself looks good and seems to work in my test. However since I now learned that the range for the axes is actually 0-255, I think the divisor should be 255 as well, not 257. And same goes for the Fanatec configuration.

Therefore I would suggest this change:
event.value = int(255 - event.value / 257) -> event.value = int(255 - event.value / 255)

Or am I missing something? Is there a real reason for the divisor being 257 and not 255?

@atzufuki
Copy link
Contributor Author

Then another topic. We still need to map the rest of the buttons:

Xbox button

Event: time 1679737374.987339, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001c
Event: time 1679737374.987339, type 1 (EV_KEY), code 715 (BTN_TRIGGER_HAPPY12), value 0

Left Adjustment Dial and push button

# Turn left
Event: time 1679737609.084579, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001a
Event: time 1679737609.084579, type 1 (EV_KEY), code 713 (BTN_TRIGGER_HAPPY10), value 1
# Turn right
Event: time 1679737666.692884, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90019
Event: time 1679737666.692884, type 1 (EV_KEY), code 712 (BTN_TRIGGER_HAPPY9), value 1
# Push
Event: time 1679737693.442050, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001b
Event: time 1679737693.442050, type 1 (EV_KEY), code 714 (BTN_TRIGGER_HAPPY11), value 1

I don't have any ideas where they should get mapped though.

@berarma
Copy link
Owner

berarma commented Sep 13, 2023

The reorganization itself looks good and seems to work in my test. However since I now learned that the range for the axes is actually 0-255, I think the divisor should be 255 as well, not 257. And same goes for the Fanatec configuration.

Therefore I would suggest this change: event.value = int(255 - event.value / 257) -> event.value = int(255 - event.value / 255)

Or am I missing something? Is there a real reason for the divisor being 257 and not 255?

We're converting from [0, 65535] to [0, 255]. Intuitively, we might think 65535 = 255 * 255 and consequently 65535 / 255 = 255 but this isn't true. The correct equality is 65535 = 256 * 256 - 1, or 65535 = 255 * 257. Thus, scaling 65535 to 255 is done dividing by 257, not 255.

@berarma
Copy link
Owner

berarma commented Sep 13, 2023

Then another topic. We still need to map the rest of the buttons:

Xbox button

Event: time 1679737374.987339, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001c
Event: time 1679737374.987339, type 1 (EV_KEY), code 715 (BTN_TRIGGER_HAPPY12), value 0

Left Adjustment Dial and push button

# Turn left
Event: time 1679737609.084579, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001a
Event: time 1679737609.084579, type 1 (EV_KEY), code 713 (BTN_TRIGGER_HAPPY10), value 1
# Turn right
Event: time 1679737666.692884, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90019
Event: time 1679737666.692884, type 1 (EV_KEY), code 712 (BTN_TRIGGER_HAPPY9), value 1
# Push
Event: time 1679737693.442050, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9001b
Event: time 1679737693.442050, type 1 (EV_KEY), code 714 (BTN_TRIGGER_HAPPY11), value 1

I don't have any ideas where they should get mapped though.

They should be mapped as buttons. I've counted 28 buttons/triggers from the posted evtest run. Currently, the interface only shows 25 buttons. I'll have to add a few more.

berarma added a commit that referenced this issue Sep 28, 2023
@berarma
Copy link
Owner

berarma commented Sep 28, 2023

Can you please test the latest master? It should show all buttons now.

@atzufuki
Copy link
Contributor Author

Thus, scaling 65535 to 255 is done dividing by 257, not 255.

Of course, had some brain fog.

Can you please test the latest master? It should show all buttons now.

Tested the latest master and all buttons are now showing. 🎉

@Lawstorant
Copy link

Guys, is Force Feedback working for you? I can't seem to change any settings in the application.

@berarma
Copy link
Owner

berarma commented Nov 3, 2023

Guys, is Force Feedback working for you? I can't seem to change any settings in the application.

That's an issue related to the drivers.

@berarma berarma closed this as completed Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants