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

Is this lib suitable for optical mouse configuration ? #23

Open
pooyamotorhead opened this issue May 19, 2024 · 4 comments
Open

Is this lib suitable for optical mouse configuration ? #23

pooyamotorhead opened this issue May 19, 2024 · 4 comments

Comments

@pooyamotorhead
Copy link

Hello , Good day
Im gonna write a program for read/write optical mouse configurations like turning off RGB lights and so on.
Is this library suitable for this kind of programming in JAVA ?
Is there any example for mouse configuration by using this lib ?
Thank You

@manuelbl
Copy link
Owner

I‘m not familiar with what protocol the mouse uses for configuration. If the protocol is on a separate USB interface from the standardized HID interface, then this library can likely be used. If it is implemented on top of HID, then no because the HID interface is exclusively claimed by the operating system.

If you have more information about the protocol then I can likely provide more information.

@pooyamotorhead
Copy link
Author

Hi
I tried to send some commands to my device (an Optical Mouse)

Im getting this error :

INFO: Child device USB\VID_4E53&PID_5406&MI_01\6&3b5a55ec&0&0001 has no device path / interface GUID
Exception in thread "AWT-EventQueue-0" net.codecrete.usb.UsbException: claiming interface failed (function has no device path / interface GUID, might be missing WinUSB driver)

Here's my code :

var testDevice = Usb.findDevice(0x4e53,0x5406).orElseThrow();
testDevice.open();
testDevice.claimInterface(1);
var transfer = new UsbControlTransfer(UsbRequestType.VENDOR, UsbRecipient.INTERFACE, 9, 775, 1);
testDevice.controlTransferOut(transfer, null);
testDevice.close();

What's wrong with it ?

@manuelbl
Copy link
Owner

You are using Windows and the WinUSB driver is not installed for interface 1. As described on the project's home page, the WinUSB driver is required to communicate with the device (other than enumerating it).

Most devices designed for WinUSB can instruct Windows to automatically install the driver. But this doesn't seem to be the case here.

You can use Zadig to install the WinUSB driver. Be careful. If another driver is installed for USB interface 1, replacing the driver will likely break some software. If the HID driver is installed on interface 1, the mouse will no longer work as a mouse. It can be restored (see Zadig documentation). But you will need another mouse to actually do it.

You can also run the enumerate example and then post the part of the output of the optical mouse here. That would help me better understand the USB device.

@pooyamotorhead
Copy link
Author

Thank You for your support dear Manuel .

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

2 participants