Enable/disable mouse mode

I noticed that the Khadas remote has a “mouse mode” toggle button. Based on my understanding, mouse mode is not something supported by Android by default. Is there a way to enable/disable mouse mode programmatically?

I tried this piece of code to simulate various button on the dpad, but can’t find the right key value for mouse toggle.

Instrumentation instrumentation = new Instrumentation(); instrumentation.sendKeyDownUpSync(key);

Hi, Pan:
Following are the keycode and keyvalue mapout, which locate at device/khadas/kvim/files/remote.conf:

        key_begin
                0x14 116
                0x13 139
                0x03 103
                0x02 108
                0x0e 105
                0x1a 106
                0x07 232
                0x58 114
                0x5c 63
                0x0b 115
                0x01 158
                0x48 102
        key_end

0x5c is for mouse button.

Regarding your question, i’m not quite understand what do you mean of:

Kindly explain with more information.

Thanks!

1 Like

I don’t understand, seems like 0x5c maps to KEYCODE_PAGE_UP
https://developer.android.com/reference/android/view/KeyEvent.html

I need to enable and disable mouse mode (the mode where you can see the mouse pointer) via the apk (app) level during runtime. I can’t tell the users to modify the remote.conf file.

the 0x5c is the keyvalue read from linux, and the corresponding keycode for Android is 63

Regarding the instructions to enable/disable mouse mode, @Terry will reply you with the details. (It’s night here in Shenzhen China at the moment, you might should wait a few hours)

1 Like

The IR already can enable/disable the mouse mode .
Can you tell me why need to enable/disable the mouse mode via app ?

Hi there,

as i am using Libreelec i dont need the enable/disable mouse mode. Is it possible to deactivate this function, so i can use the key for another function within Libreelec?

Yes, can be remap any keycode/function by modifying the source code, and also can be work as 2nd mode:

  1. 1st mode: all buttons as normal key-codes/functions
  2. 2nd mode: all buttons as secondary key codes/functions

Can you explain what i have to do for that?