-
Notifications
You must be signed in to change notification settings - Fork 46
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
mouse example #5
Comments
but i shouldn't have to make any changes to the code itself to at least get data. |
I can't really tell since I haven't fully tested a mouse myself, but this library is quite close to the esp-idf example so it should at least work as in the example and report the mouse events after it is detected. @zbx-sadman did you have to modify the code to get the mouse events ? |
so i did some testing; i cut the wires, replaced it with a high quality one, soldered it directly to the pins and pcb, length was 6cm. No joy.... |
A few changes had to be done in order to get the original library to work with esp-idf 3.3, and it may have created more failure opportunities indeed. If you're positive it works fine with the original library, then I can look into it, but I don't have a fully working example for myself (most mouses I tried failed too) so I'm not sure where to begin. |
No, @tobozo , I do not maked any changes with code, only enable debug in the sdima's sources. When i was connect USB data wires to the ESP directly, i saw data. |
So strange. I tried just now my setup again with yhe same code and Logitech K120 keyboard & B100 mouse and see mouse detection report only (keyboard is OK - report & data present): Screenshoot from issue #4 maked when this mouse was connected: ASUS Optical USB Black #M-UV55A . It's like that: I will take back this short-cabled mouse ~ May 11 and re-test connection. |
honestly i dont think a noise is the issue; if it was the mouse also wouldn't work on a pc. at least not with any accuracy as it would be skipping beats where the data is corrupted. also using a 6cm (thats like 2 inches if you're state side) high quality shielded cable would definitly do the trick; especially considering it's clean power going in already. |
some ideas for the software side:
|
A few more information... Just now i has some play with oscilloscope and level shifter (have no luck again). But i catched my Logitech B100 when it being works. Mouse is powered from the ESP32 board with 5V. I also noticed that on "live connection" mouse's LED is on constantly, and on "dead connection" just blinks on connection and turned off. May be it's power problem? Who knows... Sketch "config":
Below is dumps with uncomments some driver's debug lines. Case N1, "dead mouse connection":
Case N2, "live mouse connection":
Case N3, "live keyboard connection":
Mouse connected: P.S. I've add big capacitor on mouse power line - no any changes. It detects in 10-25% of all connection tries. |
if the ESP32 cannot provide enough power, you can add another 5v power source to your mouse/keyboard, then disconnect the VCC between between the ESP and the USB HID devices (only keep GND, Din, Dout) you can eventually use an external battery + regulator, but I prefer picking 5v from another port of the same PC using a DIY cable |
@tobozo i downloaded latest sources, trying fork task on Core 0, increase memory and maximize priority: No changes. I've powered ESP32 from USB-port (500mA), mouse must take 100mA, and i connected capacitor 2200uF. I think this must be enough... May be perepheral device sometime take more time for init and internal process do not take it in account? P.S. I used connected mouse periodically within 4 hours. HID reports received w/o errors, ESP no hanged. Seems that problem is happens on init stage... |
i did some research on the different all in one optical mouse packages and went over several data sheets, it can take up to 10ms for the init to complete. |
thanks for this research I seem to have missed some changes from usb_soft_host repository. So I did some integration+testing, somehow hoping that a better calibration at init would solve the mouse events detection problem, but I can't observe any improvement. Since it doesn't seem to break anything either, I've pushed those changes on the main branch. @ivo1981 this kind of change could eventually impact the software side your were mentioning earlier, but my guess is it probably won't. |
Yes, I just a number times pressed reset button on ESP board, and do not re-plug mouse, which always was powered. Sometime mouse fired up led (init completed) and works, sometimes blinking and did not work later. |
so the reset trick doesn't seem to work for me (tested on the older default firmware) i set up the mouse supplying power separately now: |
i uploaded the latest code, enabled debug. I gathered all the wired usb mouses I had laying around. |
@ivo1981 , short video for you: https://disk.yandex.ru/i/Qg1eQxovXJYzZA Tomorrow i'll can test this setup with other mouses of various brands. |
Found a mouse that gets detected every time and fires all events 🥳, it's a LogiLink, looks like that mouse you get for free when you buy a new computer, very lightweight and gives a feeling it won't have a long lifetime, still beats all Microsof, Logitech and SteelSeries I've tried before :-) |
@zbx-sadman all the hp's I tried also always work. The problem is the ones that don't (from which I bought 10 to use with esp's :) I installed the esp-idf toolchain and ran the 'official' version, has the same issue, so it's not an arduino porting issue. |
Every mouse tested 10 times (via ESP32 board reset). All items checked on PC preliminarily. Success rate marked as X/10.
Oklick-305m & Exegate SH-9018 mouses connection report sometime stopped on desc.bNumConfigurations = 0x01 message, sometime gave more connection info, but i saw no moving/clicking report on the terminal window. Trying to find another vendors mouses... Report will be updated. |
thanks @zbx-sadman thanks for this list 👍 I'll be adding it to the readme. Could you also collect the idVendor/idProduct too for completeness? |
@tobozo, i had updated post and add IDs from Serial Monitor. Unfortunately some mouses i returned to it owners, and can't get it's IDs. |
@zbx-sadman thanks! I'm currently playing with a Markdown editor to make a nice table in the readme, will update soon [edit] that's the ticket
|
Hi, Can you provide an example on how i can catch data from a connected mouse?
the mouse gets detected, but nothing more then that. if I plug in a keyboard i at least get raw data
The text was updated successfully, but these errors were encountered: