timothycrosley / streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
https://timothycrosley.github.io/streamdeck-ui/
MIT License
1.14k stars 242 forks source link

Error during attach: Could not open HID device. #250

Closed IanTrudel closed 2 years ago

IanTrudel commented 2 years ago

Describe the bug

The UI worked fine in the first round, but it was blank after closing and reopening. Running from the console output the following message: Error during attach: Could not open HID device.

To Reproduce Steps to reproduce the behavior:

  1. Open Streamdeck UI
  2. Configure, add buttons/actions, etc.
  3. Close
  4. Reopen

Expected behavior Should connect to the device and reload the existing configuration.

Screenshots Capture d’écran du 2022-08-07 18-57-45-NO-SERIAL

Capture d’écran du 2022-08-07 18-55-51

Operating system (please complete the following information)

Stream Deck Version

OWKenobi commented 2 years ago

This sometimes happens to me as well. Usually unplugging and replugging the usb of the stream deck fixes the issue. Can you confirm this works for you as well?

An idea would be to try to programmatically detach and reattach the stream deck once this issue pops up.

IanTrudel commented 2 years ago

Pressing X is causing the issue in the first place. Some code to detach the device should be written around the X control. Unplugging and replugging the USB cable is working. If you close via File > Exit, it will reopen without a problem, but, unfortunately, Streamdeck is not functional without Streamdeck UI running (we should have a systemd service!)

Perhaps Streamdeck UI could try to reattach (first trying to detach and then attach) if it fails to attach.

Data-007 commented 2 years ago

Pressing X is causing the issue in the first place. Some code to detach the device should be written around the X control. we should have a systemd service! (https://github.com/timothycrosley/streamdeck-ui/issues/189#issuecomment-1012631171) See above HIH

IanTrudel commented 2 years ago

Thank you @Data-007 !

dodgyrabbit commented 2 years ago

I'd like to understand what is going on here and have some follow up questions:

Pressing X is causing the issue in the first place.

By this you mean, closing the window by clicking on this? image

Reopen

Can you elaborate exactly how you are reopening the application? Are you running the streamdeck command again from the terminal?

Additional question: Do you see an icon like this (or similar) in your OS notification area? Sometimes called the AppIndicator. There may be Arch specific issues here to figure out. image

Some more details: Closing the main window (clicking the X) does not actually close the application. It only hides the window. So it may be that you are in fact starting a new instance of the application, which can't access the device since the previous one already has it open. I'd like to figure out if that is what is going on or not. Maybe you could also troubleshoot this using the ps or htop command?

IanTrudel commented 2 years ago

By this you mean, closing the window by clicking on this?

This is the only thing it could ever mean. :P

RE: AppIndicator

It makes a lot of sense now. I didn't have AppIndicator installed (and not a huge fan either). Close should always mean close. Though you guys might consider having a preference for that sort of thing. Your hypothesis is correct where an existing instance was already running despite being "closed," thus preventing opening a new instance.

ulrichwisser commented 2 years ago

I got the same error message on ubuntu 22.04. My device is stream deck with 15 keys (stream deck original v2). I had the same usb vensor id, but idProduct=0080. Added that to the file in rules.d and it started working.

If seen now that the line is in the README.md on the repo, but not on the homepage of the project.

dodgyrabbit commented 2 years ago

but not on the homepage of the project Unfortunately I don't have access to update that - it's the source of quite a bit of confusion :(

No fix here. AppIndicator is a requirement for the software to function correctly.

ulrichwisser commented 2 years ago

As I wrote above, idProduct=0080 is missing in the gh-pages branch. It is in the README.md, but not on the homepage.