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

Requested device or endpoint not found: 1038:183a:03 on MacOS Ventura #200

Closed
OptimusKoala opened this issue Apr 2, 2023 · 38 comments
Closed

Comments

@OptimusKoala
Copy link

OptimusKoala commented Apr 2, 2023

Hi :)

I installed rivalcfg 4.8 with pip3 and I'm running Python 3.9.9 on MacOS Ventura 13.3
When my mouse is plugged I have this error when I try to print help

Traceback (most recent call last):
  File "/Users/optimuskoala/.pyenv/versions/3.9.9/bin/rivalcfg", line 8, in <module>
    sys.exit(main())
  File "/Users/optimuskoala/.pyenv/versions/3.9.9/lib/python3.9/site-packages/rivalcfg/__main__.py", line 78, in main
    mouse = get_first_mouse()
  File "/Users/optimuskoala/.pyenv/versions/3.9.9/lib/python3.9/site-packages/rivalcfg/__init__.py", line 29, in get_first_mouse
    return mouse.get_mouse(
  File "/Users/optimuskoala/.pyenv/versions/3.9.9/lib/python3.9/site-packages/rivalcfg/mouse.py", line 36, in get_mouse
    hid_device = usbhid.open_device(vendor_id, product_id, profile["endpoint"])
  File "/Users/optimuskoala/.pyenv/versions/3.9.9/lib/python3.9/site-packages/rivalcfg/usbhid.py", line 96, in open_device
    raise DeviceNotFound(
rivalcfg.usbhid.DeviceNotFound: Requested device or endpoint not found: 1038:183a:03

I can see my mousse with the print-debug option

RIVALCFG
========
Version: 4.8.0
Installation path: /Users/optimuskoala/.pyenv/versions/3.9.9/lib/python3.9/site-packages/rivalcfg

OPERATING SYSTEM
================
OS: Darwin
PYTHON
======
Python version: 3.9.9
HIDAPI version: 0.13.1

PLUGGED STEELSERIES DEVICES ENDPOINTS
=====================================
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:183a | 00 | SteelSeries Aerox 3 Wireless (firmware v0)

Any idea to makes it work ? :)

@flozz
Copy link
Owner

flozz commented Apr 2, 2023

I do not know why the mouse is listed bu is not found when trying to open it... I do not have macOS to help debuging this :(

@OptimusKoala
Copy link
Author

Hi Fabien :)
Do you want some debuging trace or something ?
Maybe rivalcfg is not supported under macOS Ventura ? (I think this is not the issue here)

I tried to put my mousse on usb, then bluetooth and then wifi but it's every time the same error.

@flozz
Copy link
Owner

flozz commented Apr 2, 2023

I think I do not know macOS enough to be really helpful here... :(

What is strange here is that you have 6 endpoints for the device but all are displayed as being the "endpoint 0"... Maybe an other software or a kernel diver is already attached to the device and makes some interference?

@OptimusKoala
Copy link
Author

I don't have steelseries driver installed.

I could try to make it work myself by cloning the repo and try in local.
I'll keep you in touch :)

@glyph
Copy link

glyph commented May 1, 2023

I have this issue as well.

here's what a full dump of my enumerated devices looks like:

{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4294982071',
 'product_id': 5926,
 'product_string': 'SteelSeries Rival 650 Wireless',
 'release_number': 294,
 'serial_number': '000000000000',
 'usage': 1,
 'usage_page': 65473,
 'vendor_id': 4152}
{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4294982077',
 'product_id': 5926,
 'product_string': 'SteelSeries Rival 650 Wireless',
 'release_number': 294,
 'serial_number': '000000000000',
 'usage': 2,
 'usage_page': 1,
 'vendor_id': 4152}
{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4294982077',
 'product_id': 5926,
 'product_string': 'SteelSeries Rival 650 Wireless',
 'release_number': 294,
 'serial_number': '000000000000',
 'usage': 1,
 'usage_page': 1,
 'vendor_id': 4152}
{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4294982075',
 'product_id': 5926,
 'product_string': 'SteelSeries Rival 650 Wireless',
 'release_number': 294,
 'serial_number': '000000000000',
 'usage': 6,
 'usage_page': 1,
 'vendor_id': 4152}
{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4294982075',
 'product_id': 5926,
 'product_string': 'SteelSeries Rival 650 Wireless',
 'release_number': 294,
 'serial_number': '000000000000',
 'usage': 1,
 'usage_page': 12,
 'vendor_id': 4152}

As you can see, interface_number is not unique here, so filtering on it selects a device at random. After some trial and error, I discovered that filtering on interface["usage_page"] == 65472 allowed me to find the one that would report battery status reliably. I don't know if this is the same device used for other stuff; I have only the vaguest idea what "usage pages" are or how HID devices work.

@glyph
Copy link

glyph commented May 1, 2023

I put up a PR for this, #202, since I was having this issue with my mouse too. I don't know when it started occurring, but "when upgrading to Ventura" seems plausible.

@flozz
Copy link
Owner

flozz commented May 2, 2023

on my rival 100 it seems to be 0:

 {'path': b'5-2:1.0',
  'vendor_id': 4152,
  'product_id': 5890,
  'serial_number': '',
  'release_number': 101,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 100 Gaming Mouse',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 0},
 {'path': b'5-2:1.1',
  'vendor_id': 4152,
  'product_id': 5890,
  'serial_number': '',
  'release_number': 101,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 100 Gaming Mouse',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 1},

I will check with all my other SteelSeries mice to see if it is specific to Aerox and Rival 650 / or if it may be specific to macOS Ventura...

@flozz
Copy link
Owner

flozz commented May 9, 2023

Ok I made some test on Linux with my Rival 650.

When I enumerate interfaces I have:

 {'path': b'2-7:1.0',
  'vendor_id': 4152,
  'product_id': 5926,
  'serial_number': '000000000000',
  'release_number': 294,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 650 Wireless',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 0},
 {'path': b'2-7:1.1',
  'vendor_id': 4152,
  'product_id': 5926,
  'serial_number': '000000000000',
  'release_number': 294,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 650 Wireless',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 1},
 {'path': b'2-7:1.2',
  'vendor_id': 4152,
  'product_id': 5926,
  'serial_number': '000000000000',
  'release_number': 294,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 650 Wireless',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 2},
 {'path': b'2-7:1.3',
  'vendor_id': 4152,
  'product_id': 5926,
  'serial_number': '000000000000',
  'release_number': 294,
  'manufacturer_string': 'SteelSeries',
  'product_string': 'SteelSeries Rival 650 Wireless',
  'usage_page': 0,
  'usage': 0,
  'interface_number': 3},

With Wireshark I can capture this:

image


So the problem is:

  • On macOS (at least in your enum), all endpoints are numbered as "0". This is a very strange behaviour :/
  • On Linux, the usage page seems to not be exposed by the hidraw API of the kernel (probably not useful in this context)
  • The usage page seems to be an id that defines the data type used by the endpoint (so it should probably not be used to locate the right endpoint)... Example of generic usage pages (from Microsoft doc):
Page ID Page Name hidusage.h constant
0x01 Generic Desktop Controls HID_USAGE_PAGE_GENERIC
0x05 Game Controls HID_USAGE_PAGE_GAME
0x08 LEDs HID_USAGE_PAGE_LED
0x09 Button HID_USAGE_PAGE_BUTTON

I do not know what is going on on macOS Ventura, but there is clearly an issue somewhere. We will have to find a way to know which interface is the right one without using the usage page and the interface_number :/

@flozz
Copy link
Owner

flozz commented May 10, 2023

I had an idea to fix the issue on macOS Ventura (without breaking Linux). I pushed it on the 200-macos-ventura-endpoint branch. Can someone test if it works? :)

git clone https://github.com/flozz/rivalcfg.git
cd rivalcfg
git checkout 200-macos-ventura-endpoint
python3 -m venv __env__
source __env__/bin/activate
pip install -e .

python -m rivalcfg [...]

See changes: 57756e9

@flozz
Copy link
Owner

flozz commented May 17, 2023

UP

I really need someone on macOS Ventura to test it work :)

@matthewvinton
Copy link

I am on Ventura, experiencing the issue. I will test by end of week. Thanks!

@johnelliott
Copy link

I just checked out the 200-macos-ventura-endpoint branch and it worked, it seems fixed to me 👍. Way to go @flozz :)

@glyph
Copy link

glyph commented May 18, 2023

Sadly 200-macos-ventura-endpoint doesn't fix it for me. As before, the connection is still unreliable, and I freaquently get.

Traceback (most recent call last):
  File "/Users/glyph/.local/bin/rivalcfg", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/glyph/Projects/rivalcfg/rivalcfg/__main__.py", line 81, in main
    raise error
  File "/Users/glyph/Projects/rivalcfg/rivalcfg/__main__.py", line 78, in main
    mouse = get_first_mouse()
            ^^^^^^^^^^^^^^^^^
  File "/Users/glyph/Projects/rivalcfg/rivalcfg/__init__.py", line 29, in get_first_mouse
    return mouse.get_mouse(
           ^^^^^^^^^^^^^^^^
  File "/Users/glyph/Projects/rivalcfg/rivalcfg/mouse.py", line 36, in get_mouse
    hid_device = usbhid.open_device(vendor_id, product_id, profile["endpoint"])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/glyph/Projects/rivalcfg/rivalcfg/usbhid.py", line 101, in open_device
    device.open_path(path)
  File "hid.pyx", line 154, in hid.device.open_path
OSError: open failed

@glyph
Copy link

glyph commented May 18, 2023

I also still get Unable to get the battery level sometimes, so the behavior seems identical.

@glyph
Copy link

glyph commented May 18, 2023

I also double checked to make sure it wasn't a wired/wireless issue; I tried while wired, while on wireless, and wired with the wireless entirely disconnected.

@flozz
Copy link
Owner

flozz commented May 18, 2023

@johnelliott Thank you for the feedback!

@glyph Your issue seems de be different from the previous one:

rivalcfg.usbhid.DeviceNotFound: Requested device or endpoint not found

— VS —

OSError: open failed

The endpoint seems to be found but hidapi is not able to open it (an other software or driver is attached to the device? or a permission issue?). We will have to find why it cannot be opened ^^"

@flozz
Copy link
Owner

flozz commented May 22, 2023

@glyph I turned your comment as a new issue as it is not the same problem.

I close this issue as the initial problem is solved. The fix will be released soon :)

@flozz flozz closed this as completed May 22, 2023
@glyph
Copy link

glyph commented May 22, 2023

@glyph I turned your comment as a new issue as it is not the same problem.

I close this issue as the initial problem is solved. The fix will be released soon :)

Sounds good. Looking forward to a fix for that one :)

@glyph
Copy link

glyph commented May 22, 2023

The endpoint seems to be found but hidapi is not able to open it (an other software or driver is attached to the device? or a permission issue?). We will have to find why it cannot be opened ^^"

I should ask, is there anything diagnostic you'd like me to do? I'm sure it's not permissions, but I don't know what else it might be.

@johnelliott
Copy link

I do also notice some intermittent issues with Ventura. Before the 200-macos-ventura-endpoint branch it would never work.

Now when I wake my mac from sleep and the mouse and usb adapter seem to have disassociated I need to run the script again, and it seems to work within 30 seconds or so after a few tries. Perhaps I'm seeing the same issues as @glyph.

@flozz flozz reopened this May 23, 2023
@flozz
Copy link
Owner

flozz commented May 23, 2023

I reopened the issue because I think my fix work for some devices (the ones that use an endpoint != 0, like Aerox) but not for devices that use endpoint 0... For those one, the first endpoint listed will be used and it can be the wrong one. I have to tweak the code a bit more... :)

@flozz
Copy link
Owner

flozz commented May 23, 2023

Can someone on macOS Ventura give me the result of the following command?

python3 -c "import platform ; print(platform.system()) ; print(platform.version()) ; print(platform.mac_ver())"

→ Someone on Twitter gave me the answer:

Darwin
Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103
('13.4', ('', '', ''), 'arm64')

@flozz
Copy link
Owner

flozz commented May 23, 2023

I pushed a new fix on the 200-macos-ventura-endpoint branch: 0ed4226

→ Can you test if it work?
→ Please remind me what mouse model you are using (to allow me to know if it works for both devices that use endpoint 3 and 0).

:)

@glyph
Copy link

glyph commented May 23, 2023

('13.4', ('', '', ''), 'arm64')

Same here.

@glyph
Copy link

glyph commented May 23, 2023

→ Can you test if it work?

Kind of. It's better now, but still not completely reliable:

  ★ for each in $(seq 20); do rivalcfg --battery-level; done
Unable to get the battery level
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Unable to get the battery level
Unable to get the battery level
Charging [========  ] 89 %
Charging [========  ] 89 %
Unable to get the battery level
Charging [========  ] 89 %
Charging [========  ] 89 %
Unable to get the battery level
Unable to get the battery level
Charging [========  ] 89 %
Unable to get the battery level
Unable to get the battery level
Charging [========  ] 89 %
Unable to get the battery level
Charging [========  ] 89 %
Unable to get the battery level

@glyph
Copy link

glyph commented May 23, 2023

Contrast my usage-page branch:

  ★ for each in $(seq 20); do rivalcfg --battery-level; done
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %
Charging [========  ] 89 %

@glyph
Copy link

glyph commented May 23, 2023

As far as what hardware I'm using: "1038:172b | 00 | SteelSeries Rival 650 Wireless (firmware v0)"

@flozz
Copy link
Owner

flozz commented May 24, 2023

Ok... I need more info to figure what is happening... I pushed a new version of the code in a new branch : 200-macos-ventura-endpoint-test that prints some debug information.

Can you run it multiple times like you did just before and then share results here? :)

@johnelliott
Copy link

200-macos-ventura-endpoint-test ... run it multiple times like you did just before and then share results here? :)

Ran my shell script invoking the program with my flags, this time I didn't see the lights on the mouse change:

$ ./aerox.sh
================================================================================
_IS_MACOS_VENTURA: 1
--------------------------------------------------------------------------------
All interfaces:
[{'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010661',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 6,
  'usage_page': 1,
  'vendor_id': 4152},
 {'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010657',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 1,
  'usage_page': 12,
  'vendor_id': 4152},
 {'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010659',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 1,
  'usage_page': 65473,
  'vendor_id': 4152},
 {'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010663',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 1,
  'usage_page': 65472,
  'vendor_id': 4152},
 {'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010665',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 2,
  'usage_page': 1,
  'vendor_id': 4152},
 {'interface_number': 0,
  'manufacturer_string': 'SteelSeries',
  'path': b'DevSrvsID:4295010665',
  'product_id': 6200,
  'product_string': 'SteelSeries Aerox 3 Wireless',
  'release_number': 299,
  'serial_number': '',
  'usage': 1,
  'usage_page': 1,
  'vendor_id': 4152}]
--------------------------------------------------------------------------------
macOS Ventura found interface:
{'interface_number': 0,
 'manufacturer_string': 'SteelSeries',
 'path': b'DevSrvsID:4295010659',
 'product_id': 6200,
 'product_string': 'SteelSeries Aerox 3 Wireless',
 'release_number': 299,
 'serial_number': '',
 'usage': 1,
 'usage_page': 65473,
 'vendor_id': 4152}
--------------------------------------------------------------------------------

@glyph
Copy link

glyph commented May 24, 2023

Here's a log of me running it 20 times:

https://gist.github.com/glyph/09d9b3db000e04634bc66dced662a3db

@flozz
Copy link
Owner

flozz commented May 25, 2023

Thank you for the feedbacks.


It found the following issue on the HIDAPI lib that is used by Rivalcfg to access USB devices: libusb/hidapi#531

They released a fix 3 days ago!

https://github.com/libusb/hidapi/releases/tag/hidapi-0.14.0


Once the Python binding of HIDAPI released we will be able to test if it fixes the issue for us, else we will hack in Rivalcfg. :)

I will revert the change on master waiting for the update.

@johnelliott
Copy link

johnelliott commented May 25, 2023

I just logged back on to say I'd found a way to more reliably reproduce the bug: after the system goes to sleep and the usb mouse RF receiver is off, the bug happens until I switch the mouse off and back on again.

Now as I read the above, it looks like the problem is upstream.

@glyph
Copy link

glyph commented May 25, 2023

They released a fix 3 days ago!

This makes me feel a little less crazy — as I was hacking around the shifting USB endpoint attributes, I was thinking "this… can't be how it's supposed to work, right?" Glad that this is getting fixed in the right place!

@glyph
Copy link

glyph commented May 25, 2023

Went to go check whether cython-hidapi had an issue to update to the next release, and I saw @flozz was already on it :). For those following along at home, here's the link: trezor/cython-hidapi#151

@johnelliott
Copy link

Thanks so much all, I wish I was more of a help. :)

@flozz
Copy link
Owner

flozz commented May 28, 2023

hidapi was updated to v0.14! If someone can test on macOS with the master branch and this version (pip install hidapi==0.14) :)

@flozz flozz closed this as completed in 3963ea7 May 30, 2023
@flozz
Copy link
Owner

flozz commented May 30, 2023

I published the v4.9.0 where hidapi is updated to v0.14, so it should work on macOS Ventura. Please let me know if it is not the case. :)

@glyph
Copy link

glyph commented May 30, 2023

Looking good: https://gist.github.com/glyph/e858a95d4008f905ae6e4516aaa6563d

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

Successfully merging a pull request may close this issue.

5 participants