|
Edited by jmanjulian at 2016-3-26 23:21
As we all know the Orange PI PC has an ir reciever but no official guide on how to use it. There is already a tutorial in the forum on how to setup ir using lirc HERE:Forum_link_second_post But that is more complicated and is not necessary because all that is needed is already inside the Beelink and Zido images of Android. In order to setup Ir you must use an android rom that is rooted or find a way to root it youreself. Luckily Beelink and Ziddo images come prerooted and i am using this one ROM
To get started download an terminal emulator app like Android terminal. I also recommend installing Total commander as a file manager to do all file modiffications because it has an automatic remount feature wich will take kare of all the read-only filesystem problems when you edit the config files in the system partition. Or you can use the command:
- mount -o remount,rw /system
Copy code Now open terminal emulator and enter the command:
This will grant superuser privilages to the terminal. In order to setup the remote you need to remove the old config first. Open total commander and go to root filesystem /system/usr/keylayout and rename the sunxi-ir.kl to something else i reccomend sunxi-ir.kl.bak. You can do this in the terminal also with the command:- mount -o remount,rw /system
- mv /system/usr/keylayout/sunxi-ir.kl /system/usr/keylayout/sunxi-ir.kl.bak
Copy code Once we have a backup of the original config file we make a new one:
- mount -o remount,rw /system
- echo new > /system/usr/keylayout/sunxi-ir.kl
Copy code There seams to be some bug in the sunxi ir driver or maybe the android image itself that prevents the driver from working correctly because it starts with an invalid config. To fix this we must just stop the driver module and reload it. Do the following command in the terminal:
- rmmod sunxi_ir_rx
- insmod /vendor/modules/sunxi-ir-rx.ko
Copy code Now the ir reciever should be readi and working but the config is not valid for youre remote because the config file we made is still empty.
To make a valid config we must get the key codes our remotes sends to android. This is done with the command:
The output will be something like this:- root@dolphin-fvd-p1:/ # getevent
- add device 1: /dev/input/event6
- name: "sunxi-ir"
- add device 2: /dev/input/event7
- name: "Virtual.Acc"
- could not get driver version for /dev/input/js0, Invalid argument
- add device 3: /dev/input/event5
- name: "Logitech USB Optical Mouse"
- could not get driver version for /dev/input/mouse1, Not a typewriter
- add device 4: /dev/input/event4
- name: "USB USB Keykoard"
- add device 5: /dev/input/event3
- name: "USB USB Keykoard"
- add device 6: /dev/input/event2
- name: "sunxi-ths"
- add device 7: /dev/input/event1
- name: "sunxi-gpiokey"
- could not get driver version for /dev/input/mouse0, Not a typewriter
- add device 8: /dev/input/event0
- name: "vmouse"
- could not get driver version for /dev/input/mice, Not a typewriter
- /dev/input/event3: 0004 0004 00070028
- /dev/input/event3: 0001 001c 00000000
- /dev/input/event3: 0000 0000 00000000
- /dev/input/event6: 0001 0012 00000001
- /dev/input/event6: 0000 0000 00000000
- ^@/dev/input/event6: 0001 0012 00000000
- /dev/input/event6: 0000 0000 00000000
- /dev/input/event6: 0001 000b 00000001
Copy code Notice the first two lines "add device 1: /dev/input/event6" and "name: "sunxi-ir"". This tels us the IR reciever is event6. Now dont press anything on the keyboard or mouse because that will be shown as an event as you can see the event3 lines are from the mouse. Point the remote at the OrangePI and press any button. If youre remote is using a compatible portocol the button press will appear as a new event6 line (usually 2 lines one on button press and one on button release) example:
- /dev/input/event6: 0001 0012 00000001
- /dev/input/event6: 0000 0000 00000000
Copy code The code that we need is the second number from the first line in this case it is 0012. The problem is this is in hex and the config file needs it in decimal so we have to cenvert it with a calculator. I used this online one HEX to DEC convertor. 0012 converted is 18 so this is our button kode. Now you must repeat this for all the buttons on youre remote that you want to use. After you gathere all the button codes of youre remote you can stop getevent by pressing ctrl+c.
In total commander open the new config file that we made in the first step (/system/usr/keylayout/sunxi-ir.kl) and add all the key codes each on a new line like this: key "keycode" android command
- key 18 POWER WAKE
- key 19 MUTE
- key 14 MEDIA_STOP
- key 31 MEDIA_PLAY
- key 30 MEDIA_PAUSE
- key 15 MEDIA_PREVIOUS
- key 26 MEDIA_NEXT
- key 11 DPAD_UP
- key 21 DPAD_DOWN
- key 24 DPAD_LEFT
- key 12 DPAD_RIGHT
- key 22 ENTER
- key 13 BACK
- key 25 VOLUME_UP
- key 29 VOLUME_DOWN
Copy code This is my config and it only uses some basic buttons. You can open the original config file that we made a backup of (/system/usr/keylayout/sunxi-ir.kl.bak) and look at all the available android commands. There may be more command but i dont know where to get a full list. After we have the ready config file with our chosen commands linked to our remote keycodes we need to just reload the ir driver again so it can load the new config and we are done.
- rmmod sunxi_ir_rx
- insmod /vendor/modules/sunxi-ir-rx.ko
Copy code If nothing has gone wrong youre remote should work.
|
|