Quanzhi A20 [android tutorial]-infrared remote control debugging

Source: Internet
Author: User

ZookeeperChapter 2 Preface
You need to implement the infrared remote control on Raspberry Pi 3 (A20) android system. Because super3 has an infrared receiver, you can directly support the infrared remote control and apply Raspberry Pi 3 to home control. Used as a network set-top box
Raspberry Pi 3's infrared remote control also has the mouse function, that is, some mouse functions that can be replaced by it, because some software does not support pure remote control, you must move the mouse and arrow to the button to use this function.

Just click the "Arrow" button in the lower right corner to control the mouse arrow with the arrow key.

Remote Control purchase Link

Http://item.taobao.com/item.htm? & Amp; id = 37686098339


Chapter 4 hardware
2.1 circuit schematic
The IO port corresponding to the infrared receiver of Raspberry Pi 3 is PB4, such


2.2 Physical Map
Position of the infrared receiver on the board
Remote control appearance and corresponding code Note: The above Customer Service Code, ff is high 8 bits, 00 is low 8 bits, so add_core = 0xff00;

Chapter 4 software modification3.1 modify fexConfiguration file (sys_config.fex)Modify superoid \ lichee \ tools \ pack \ chips \ sun7i \ configs \ android \ smfy-super3 \ sys_config.fex as follows

[ir_para]ir_used             = 1ir_rx               = port:PB04<2>
 
  
   
  
 
Configure PB04 as the infrared pad (matching our internal driver ).
3.2 modify kernel3.2.1 modify ADDR_CODEIn the file lichee \ linux-3.4 \ drivers \ input \ keyboard \ ir-keymap.h, modify the following code according to your remote control address code
# Define IR_ADDR_CODE (0xff00). For example, if the address code is 0x7f80, change it
# Define IR_ADDR_CODE (0x7f80)
If the result is invalid, the two bytes are exchanged and changed
# Define IR_ADDR_CODE (0x807f) the address code for this remote control in this tutorial is 0xff00
3.2.2 modify sun7i-ir.cModify lichee \ linux-3.4 \ drivers \ input \ keyboard \ sun7i-ir.c File

If (SCIRPT_ITEM_VALUE_TYPE_INT! = Script_get_item ("ir_para", "ir_wakeup", & ir_wakeup) {pr_err ("% s: ir_wakeup script_get_item error. \ n ",__ func _); ir_wakeup = 0;} if (SCIRPT_ITEM_VALUE_TYPE_INT! = Script_get_item ("ir_para", "power_key", & power_key) {pr_err ("% s: power_key script_get_item error. \ n ",__ func _); power_key = 0x4d;} if (SCIRPT_ITEM_VALUE_TYPE_INT! = Script_get_item ("ir_para", "ir_addr_code", & ir_addr_code) {pr_err ("% s: ir_addr_code script_get_item error. \ n ",__ func _); ir_addr_code = 0xff00; // ---- the code is re-specified here. Therefore, the above IR_ADDR_CODE has been modified to take effect}

3.2.3 compile kernelRun #./build. sh-p sun7i_android to compile the kernel in the lichee directory and then copy the sun7i-ir.ko to the module directory under the android42 directory # extract-bsp
3.2.4 manual debugging (skipped for beginners)Step 1: Raspberry Pi 3 into the android system, Connect USB to the PC, through the adb command into the PC # adb shellStep2: In adbshell, # rmmod sun7i-ir.ko uninstall the original drive Step3: copy the newly compiled sun7i-ir.ko to the super3 root directory PC # adb pushC: // sun7i-ir.ko/Step4: Again adbshell into the super3 device command line, # insmod sun7i-ir.ko manually loaded Driver Module # getevent and then to super3 press the remote control, if the address code in front of the correct, it should be seen here by the remote control will have key event printed out, this indicates that the remote control has been identified at the underlying android layer, and an event has been sent up. You can proceed to the next step with confidence.
3.3 modify the kl File 3.3.1 Modify sun7i-ir.kl FileSuperoid \ android42 \ device \ softwinner \ smfy-super3 \ sun7i-ir.kl files against Figure 2.3 infrared remote control code table in Chapter 2.3
key 64   BACK               WAKE_DROPPEDkey 4    MENU               WAKE_DROPPEDkey 85    DPAD_CENTER        WAKE_DROPPEDkey 22   DPAD_DOWN          WAKE_DROPPEDkey 70   DPAD_UP            WAKE_DROPPEDkey 6   HOME               WAKEkey 71    DPAD_LEFT          WAKE_DROPPEDkey 21   DPAD_RIGHT         WAKE_DROPPEDkey 16   VOLUME_UP          WAKEkey 20   VOLUME_DOWN        WAKEkey 24   POWER              WAKEkey 12   0                  WAKEkey 84   1                  WAKEkey 72   2                  WAKEkey 7   3                  WAKEkey 80   4                  WAKEkey 18   5                  WAKEkey 17   6                  WAKEkey 76   7                  WAKEkey 14   8                  WAKEkey 13   9                  WAKEkey 8   MUTE               WAKEkey 86   PROG_RED           WAKEkey 91   PROG_BLUE          WAKEkey 87   PROG_GREEN         WAKEkey 31   PROG_YELLOW        WAKEkey 23   MOUSE              WAKEkey 75   DEL                WAKE

3.3.2 debugging (skipped for beginners)If you are an android veteran, You can manually debug it to ensure that the address code is correct. You can immediately see the modified effect. Step 1: connect Raspberry Pi 3 through USB, PC cmd into the command line, PC # adb push C: // sun7i-ir.kl/system/usr/keylayout/the above command Prefix: we have placed the sun7i-ir.kl file under the C drive root directory of the PC. The above command is to copy the sun7i-ir.kl file to the/system/usr/keylayout/directory of super3 to replace the original file Step2: restart Raspberry Pi 3 and enter the android system. The remote control is ready for use now. You can use the upper and lower keys to select.
3.4 support for Mouse
Modify the build. prop file to go to the terminal command line of super3 and modify the following items:
ro.softmouse.left.code=71ro.softmouse.right.code=21ro.softmouse.top.code=70ro.softmouse.bottom.code=22ro.softmouse.leftbtn.code=85

Chapter 2 Compilation and packaging
# Make-j4 compile to system # pack img
Success
Http://item.taobao.com/item.htm? & Amp; id = 15301429836


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.