LennardKittner / HyperXCloudIIWireless

A CLI and tray application to monitor HyperX Cloud II Wireless headset battery level.
MIT License
16 stars 4 forks source link

Getting 'no device found' on running the cli app and tray app. #6

Closed mediocretwo closed 4 months ago

mediocretwo commented 4 months ago

Hi, I have the Hyprx Cloud II Wirless Gaming headset with the HP name in the lsusb command output. I have compiled the code successfully and tried running the cli app and tray app. Both are giving the same 'no device found' output even though the headset is on and connected. I have also created the udev rules as given in the Readme. Would appreciate some help, thanks !

Distro Config: Fedora 40 workstation, gnome 46

LennardKittner commented 4 months ago

Hi, does the device ID also match? The IDs should be 03f0:018b. You could also try running the cli_app with sudo; this should also work even if the udev rules are wrong. Lastly, you could change line 88 in src/lib.rs from }).ok_or(DeviceError::NoDeviceFound())??; to }).unwrap().unwrap();, I also included the git diff. This might give me more information.

diff --git a/src/lib.rs b/src/lib.rs
index 67d86b7..131dbd4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,7 +85,7 @@ impl Device {
             } else {
                 None
             }
-        }).ok_or(DeviceError::NoDeviceFound())??;
+        }).unwrap().unwrap();
         Ok(Device { 
             hid_device,
             charging: None,
mediocretwo commented 4 months ago

You could also try running the cli_app with sudo

I tried with sudo, unfortunately its the same output.

Hi, does the device ID also match? The IDs should be 03f0:018b.

The lsusb command has put out this and it seems like only one of the id's is matching. lsusb Bus 003 Device 002: ID 03f0:0d93 HP, Inc HyperX Cloud Stinger 2 Wireless Is this the issue? If so how do I fix it?

LennardKittner commented 4 months ago

Yes, that is potentially a problem. You are using a HyperX Cloud Stinger 2 Wireless, but I developed the app for a HyperX Cloud  2 Wireless. You could try to add the product ID. But I don't know if the code will work for your headset. You can add the product ID by changing src/lib.rs line 9 from const PRODUCT_IDS: [u16; 2] = [0x1718, 0x018B]; to  const PRODUCT_IDS: [u16; 3] = [0x1718, 0x018B, 0x0D93];

diff --git a/src/lib.rs b/src/lib.rs
index 67d86b7..fd00108 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,7 @@ use thistermination::TerminationFull;
 // Possible vendor IDs [hyperx , HP]
 const VENDOR_IDS: [u16; 2] = [0x0951, 0x03F0];
 // Possible Cloud II Wireless product IDs
-const PRODUCT_IDS: [u16; 2] = [0x1718, 0x018B];
+const PRODUCT_IDS: [u16; 3] = [0x1718, 0x018B, 0x0D93];

 const BATTERY_LEVEL_INDEX: usize = 7;
 const CHARGING_PREAMBLE: [u8; 5] = [6, 255, 187, 2, 0];
mediocretwo commented 4 months ago

Oh!! I did not notice that! I recompiled with your changes and like magic it is detecting the headset. It reported the battery level correctly. However, it is only running with sudo. If I dont use sudo im getting the following error: HidApiError { message: "Failed to open a device with path '/dev/hidraw0': Permission denied" } Is it possible to run it as normal user? Should I change the udev rules too maybe to match my headset?

LennardKittner commented 4 months ago

Very nice. Yes you have to add a new rule for your headset. Don't forget to replug the dongle after adding the new rule. I would appreciate it if you could test all the features and let me know if everything works. To test all the features please start the tray icon app and than mute the headset, charge the headset, and unplug the mic.

SUBSYSTEMS=="usb", ATTRS{idProduct}=="0d93", ATTRS{idVendor}=="03f0", MODE="0666"

KERNEL=="hidraw*", ATTRS{idProduct}=="0d93", ATTRS{idVendor}=="03f0", MODE="0666"
mediocretwo commented 4 months ago

Now working without sudo, thanks.

I would appreciate it if you could test all the features and let me know if everything works.

Sure, I can test it. Running the tray app there is a 3-dots icon showing and there is no response on clicking the icon or right-clicking the icon. By the way I'm using gnome with the extension 'AppIndicator and KStatusNotifierItem Support'. I think that supports system tray but I'm not fully sure. Let me know if the extension is the problem, otherwise the tray is not working.

LennardKittner commented 4 months ago

ok  It should show some information, as seen in the readme if you hover over the icon, but I think someone else had the same problem and therefore created the PR https://github.com/LennardKittner/HyperXCloudIIWireless/pull/5

I will try to merge the pull request and add the product ID of your headset tomorrow.

mediocretwo commented 4 months ago

Ok, thanks. Let me know if you need any other info, happy to help!

LennardKittner commented 4 months ago

I have added the product ID to the main branch and merged the PR with the menu. You should now be able to compile the latest commit and use it with your headset. You can also now right-click the icon and see additional information, for example, if the headset is muted, charging, or if the mic is connected. Note that this information is only updated if it changes, i.e., it will only show whether the headset is muted if it was muted at least once during the lifetime of the app. I would appreciate it if you could tell me if everything works with your headset.

mediocretwo commented 4 months ago

Hi, I tested the latest code, the tray icon works but there are a few issues.

The good news is, the battery level is showing accurately without problems.

Here's the screenshot when the headset is on.

Screenshot from 2024-05-31 01-58-46

LennardKittner commented 4 months ago

It looks like the packet that is sent to the headset to retrieve the battery level and the response from the headset are the same as the HyperX Cloud 2. However, most other packets are apparently different, which is why the other things are not displayed correctly. Luckily, at least the battery level works. If you want, I could try to add more features if you sent me more unknown responses and the action you took to receive them, e.g., muting the headset. But I am also planning to write a device tester, which would make this process easier.

mediocretwo commented 4 months ago

That sounds cool. I did not receive any other status codes, only these two when the headset is turned on or off. I didnt receive any status codes on muting and unmuting the mic.