User Tools

Site Tools


doc:appunti:android:osmand_remote_controller

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doc:appunti:android:osmand_remote_controller [2020/02/04 10:38] – created niccolodoc:appunti:android:osmand_remote_controller [2020/02/24 16:35] (current) – [Remapping the controller keys (root required)] niccolo
Line 1: Line 1:
 ====== Using OsmAnd with a Remote Controller ====== ====== Using OsmAnd with a Remote Controller ======
  
-[{{.:osmadn:osmand-remote-controller.jpg?380 |OsmAnd paierd with a Bluetooth remote controller}}]+{{.:osmand:osmand-remote-controller.jpg?380 |OsmAnd paierd with a Bluetooth remote controller}}
 I'm an early joiner of the **[[https://www.openstreetmap.org|OpenStreetMap]]** project, so I'm a big fan of the **[[https://play.google.com/store/apps/details?id=net.osmand|OsmAnd]]** app. It is my preferred choice for **motorbike on-board navigation**. I'm an early joiner of the **[[https://www.openstreetmap.org|OpenStreetMap]]** project, so I'm a big fan of the **[[https://play.google.com/store/apps/details?id=net.osmand|OsmAnd]]** app. It is my preferred choice for **motorbike on-board navigation**.
  
Line 8: Line 8:
 ===== The Mocute Universal Wireless Remote Controller ===== ===== The Mocute Universal Wireless Remote Controller =====
  
-[{{ .:osmadn:mocute-remote-controller.jpg?280|The Mocute Remote Controller}}]+[{{ .:osmand:mocute-remote-controller.jpg?280|The Mocute Remote Controller}}]
 It is a low-cost (5-10 euros) **Bluetooth** device, sold under different brands. At present (Jan 2020) you can find it on **Amazon** or **Aliexpress.com** under the generic terms //Android gamepad Bluetooth controller//. It has an internal **rechargeable battery** which should last about 10 hours. The small size is quite convenient for using it on the **handlebar** of a motorbike, the biggest problem being to be **not water-proof**. It is a low-cost (5-10 euros) **Bluetooth** device, sold under different brands. At present (Jan 2020) you can find it on **Amazon** or **Aliexpress.com** under the generic terms //Android gamepad Bluetooth controller//. It has an internal **rechargeable battery** which should last about 10 hours. The small size is quite convenient for using it on the **handlebar** of a motorbike, the biggest problem being to be **not water-proof**.
  
Line 62: Line 62:
 The Mocute-032 controller has a little slide switch with two positions: **GAME** and **KEY**. Each mode generates different **ScanCodes** for the four buttons. **The joystick operates differently**: in KEY mode it emulates four digital switches (keyboard keys which generate the ScanCode), while in GAME mode it operates as an **analog joystick** with **two axis** (without generating a ScanCode). The Mocute-032 controller has a little slide switch with two positions: **GAME** and **KEY**. Each mode generates different **ScanCodes** for the four buttons. **The joystick operates differently**: in KEY mode it emulates four digital switches (keyboard keys which generate the ScanCode), while in GAME mode it operates as an **analog joystick** with **two axis** (without generating a ScanCode).
  
-[{{.:osmadn:mocute-gamepad-keys.jpg?360|Key mapping in GAME mode}}]+[{{.:osmand:mocute-gamepad-keys.jpg?360|Key mapping in GAME mode}}]
  
 ==== The joystick in GAME mode ==== ==== The joystick in GAME mode ====
Line 104: Line 104:
 In theory - to remap the functions of our controller - it should be possible to provide a **specific keylayout file** for just this controller: Android's instructions say to simply create a file with the name **Vendor_ffff_Product_0000.kl** (see the vendor and product read from the ''/proc/bus/input/devices'' pseudofile). Unfortunately this does not work, may be because ffff and 0000 are not valid ID values. In theory - to remap the functions of our controller - it should be possible to provide a **specific keylayout file** for just this controller: Android's instructions say to simply create a file with the name **Vendor_ffff_Product_0000.kl** (see the vendor and product read from the ''/proc/bus/input/devices'' pseudofile). Unfortunately this does not work, may be because ffff and 0000 are not valid ID values.
  
-So we have to change the **Generic.kl** file, redefining some ScanCodes and axis (the rest of the file must remain untouched):+So we have to change the **/system/usr/keylayout/Generic.kl** file, redefining some ScanCodes and axis (the rest of the file must remain untouched):
  
 <file> <file>
-key 305 MINUS +key 304   MINUS 
-key 307 PLUS+key 305   MINUS 
 +key 307   PLUS 
 +key 308   PLUS
 axis 0x00 Y axis 0x00 Y
 axis 0x01 invert X axis 0x01 invert X
 </file> </file>
  
-This change have the side effect to remap all the external keyboards that we will connect to our Android device!+**NOTICE**: I have redefined scancodes **304** and **308** as **duplicates** of 305 and 307. This is because the default action for scancode 304 was **BUTTON_A**, which opens the **Actions menu** in OsmAnd 3.5.5; opening this menu by accident is very annoying because you can close it only using the touchscreen! 
 + 
 +This change - unfortunately - have the side effect to remap all the external gamepads that we will connect to our Android device!
 ===== Key Mapping Test ===== ===== Key Mapping Test =====
  
Line 124: Line 128:
 ===== Other remote controllers ===== ===== Other remote controllers =====
  
-  * **[[https://daytona-global.com/products/?page=Products_Product&mfrID=13&categID=28&subcategID=80&productID=87352|Daytona Smartphone controller]]** - Sent keypresses to the Android device: Enter, Power, Escape, Home, Joystick.+  * **[[https://daytona-global.com/products/?page=Products_Product&mfrID=13&categID=28&subcategID=80&productID=87352|Daytona Smartphone controller]]** - Keypresses sent to the Android device: Enter, Power, Escape, Home, Joystick.
   * **[[https://carpe-iter.com/carpe-iter-control/|Carpe Iter Control]]** - Seven programmable keys, with two functions each.   * **[[https://carpe-iter.com/carpe-iter-control/|Carpe Iter Control]]** - Seven programmable keys, with two functions each.
  
doc/appunti/android/osmand_remote_controller.1580809086.txt.gz · Last modified: 2020/02/04 10:38 by niccolo