# Android: No Mouse Input Events detected/send in SDL 2.30.9

**URL:** <https://discourse.libsdl.org/t/android-no-mouse-input-events-detected-send-in-sdl-2-30-9/60101>\
**Category:** Game Development\
**Created:** [June 18, 2025, 1:55pm UTC](https://discourse.libsdl.org/t/android-no-mouse-input-events-detected-send-in-sdl-2-30-9/60101 "2025-06-18T13:55:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaFaL](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@RaFaL](https://discourse.libsdl.org/u/RaFaL)\
**Post date:** [June 18, 2025, 1:55pm UTC](https://discourse.libsdl.org/t/android-no-mouse-input-events-detected-send-in-sdl-2-30-9/60101/1 "2025-06-18T13:55:32Z")

</div>

As subject topic suggest I have no events from USB Mouse connected to my Smartphone it is uisng custom LineageOS Andoid 15 ROM.  
Mouse is connected via OTG cable and its working fine in Android Home Screen no other apps are affected because its propably game code/SDL issue.

I have tried to check for SDL\_FINGERMOTION and SDL\_MOUSEMOTION events with enabling/disabling hints

> SDL\_SetHint(SDL\_HINT\_MOUSE\_TOUCH\_EVENTS, “1”);  
> SDL\_SetHint(SDL\_HINT\_TOUCH\_MOUSE\_EVENTS, “0”);

0 Events are generated by mouse with enabled or disabled SDL\_HINT\_MOUSE\_TOUCH\_EVENTS

Android SDL Java code seems to find my mouse connected in InputDevices list but not visible in UsbManager list

> Device ID: 20, Name: Logitech USB Optical Mouse, Sources: 0x20004

From browsing SDL Java code it seems like 0x20004 is ignored because it expecting diffrent one

> // 12290 = Samsung DeX mode desktop mouse  
> // 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE\_MOUSE | SOURCE\_TOUCHSCREEN  
> // 0x2 = SOURCE\_CLASS\_POINTER

What has been tried so far:  
A lot of debug logs (no logs on important functions that should handle SOURCE\_MOUSE Input)  
Wriitng some ongenericmotionlisteners on mLayout (without success)

> mLayout.setOnGenericMotionListener

Checking if SOURCE\_MOUSE input is detected in my Java code(without success)

> public boolean onGenericMotionEvent(MotionEvent event)

Full Source Code for My entry Class:

> <https://github.com/etlegacy/etlegacy/blob/master/app/src/main/java/com/etlegacy/app/ETLActivity.java>

Important Notes:  
When I launch App System Cursor is visible till mSurface is added/created or Native code is lauched then cursor disapear  
Native Code has function that grabs mouse:

> <https://github.com/etlegacy/etlegacy/blob/6ac69c5c7a233a1bd69cff7394543c0892c5944a/src/sdl/sdl_input.c#L638>

It includes call for SDL\_SetWindowGrab(mainScreen, (SDL\_bool)grab);

Looking forward for fast replies.  
Best Regards

---

<div class="post-metadata">

**Author:** ![RaFaL](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@RaFaL](https://discourse.libsdl.org/u/RaFaL)\
**Post date:** [June 25, 2025, 10:16pm UTC](https://discourse.libsdl.org/t/android-no-mouse-input-events-detected-send-in-sdl-2-30-9/60101/2 "2025-06-25T22:16:48Z")

</div>

Ok after diging more it turns out in order to make my mouse work inside app I need to call  
IN\_GrabMouse with relative being false no matter what setRelativeMode being true

> <https://github.com/etlegacy/etlegacy/blob/57ab1b3d6594711264c12f479c8cc299710c245c/src/sdl/sdl_input.c#L692>

PS: Also I added some additional checks for usb mouse detection regarding relative mode in which prints my mouse not having none of this or it is specific to hardware of my phone(Original Android 7 in which should support relative mode).  
Issue is partially fixed since rest of the issue is hardware one and it cannot be fixed without buying other mouse.
