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

setVid and setPid seems to be broken since NimBLE-Arduino 1.4.2 #229

Open
microbmen opened this issue Sep 24, 2024 · 3 comments
Open

setVid and setPid seems to be broken since NimBLE-Arduino 1.4.2 #229

microbmen opened this issue Sep 24, 2024 · 3 comments

Comments

@microbmen
Copy link

Something changed on NimBLE-Arduino on version 1.4.2,

bleGamepadConfig.setVid(0xe502);
bleGamepadConfig.setPid(0xabcd);

Doesn't work any longer. No matter what its the same value
VID=0x02e5, PID=0xcdab
even if set to the above or anything else....

when i downgrade to NimBLE-Arduino 1.4.1 this works again.

@Mystfit
Copy link
Contributor

Mystfit commented Oct 3, 2024

Could this possibly be linked to this upstream issue?. The old behaviour was that there was some bit-shifting happening to the vid and pid values before they got stored in m_pnpCharacteristic. Looking BleGamepad::begin, I noticed that the high and low bytes for the vid and pid values are getting swapped before being passed to the pnp function call to set pnp values - maybe they values don't need to be swapped anymore?

@Mystfit
Copy link
Contributor

Mystfit commented Oct 3, 2024

@microbmen Can confirm that getting rid of the high/low byte flipping that was occuring with the VID, PID and GUID values before they were sent to NimBLE fixed the problem for me. Seems that upstream they removed the need for those bytes to be flipped. Submitted a PR to fix the issue.

Tested by running the CharacteristicsConfiguration example with VID set to 0xe502, PID set to 0xABCD and GUID set to 0x1234.

First I ran the sketch with the old behaviour and the following string was returned in Windows device manager for the Hardware IDs property: BTHLEDevice\{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&0102e5_PID&cdab_REV&3412
As you can see, the VID (ignoring first 01 byte), PID and REV properties have their first and second bytes flipped.

Then I re-ran the sketch with the fix applied that removes the VID, PID and GUID high/low bytes reversal and received the following: BTHLEDevice\{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&01e502_PID&abcd_REV&1234 which matches the provided PID, VID and GUID values.

I also tested this fix over in my EPS32-BLE-CompositeHID fork with my Xbox controller sketch. The VID and PID are vital for convincing Windows to load the correct Bluetooth LE XINPUT compatible input device driver and without the fix, Windows saw my board as a generic gamepad but with the fix, it started working again.

@lemmingDev
Copy link
Owner

Should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants