Firefly Open Source Community

Title: IR receiver setup - help needed [Print This Page]

Author: eldflugan    Time: 1/5/2015 23:52
Title: IR receiver setup - help needed

Hi,

I am a newbie with the RK3288 development board, but I have a fair amount of Linux experience (not a programmer though). I still cannot figure out how to setup the built-in IR receiver to work with e.g. a Microsoft MC remote. I have tried to locate the file and the directory discussed in the wiki (
http://wiki.t-firefly.com/index.php/Fir ... 3288/IR/en
), but I haven't gotten anywhere.




I gather that I have to do some low level hacking to enable the IR, and I am prepared to try if someone could help me out with a more thourough how-to description.




Thank you!

Tomas
Author: Andy    Time: 1/6/2015 15:16
What's your problem on IR driver. Is there any interrupts while you press the Remote key?
Author: eldflugan    Time: 1/6/2015 18:21
Problem is that nothing happens, Firefly with kodi doesn't react to any remote key presses (Microsoft MC remote) . I thought I had to activate the driver somehow, but I haven't been able to figure out how.
Author: zhansb    Time: 1/7/2015 20:31

open?DBG_CODE,then?the kernel log will show some useful message
Author: eldflugan    Time: 1/8/2015 00:32

Thanks for the help, but?I am not a software developer and still don't understand the instructions. I have fair knowledge of a Linux system, but not on the level of compiling my own kernel etc. Let me post some questions to indicate which level I am at:

1) Can I access the files referred to on the device through ADB on my PC? I tried to locate them from the Lubuntu boot, but no luck.

2) Do I need to compile a new linux kernel in order to enable IR reception on the RK3288? If so, why is IR not enabled in the kernel that ships with the board?

3) Once enabled, will the IR receiver work with the Microsoft MC remote, which works out of the box with Kodi (with a working IR receiver of course) or do I need to somehow remap the NEC encode format?






Author: leungtek    Time: 1/8/2015 15:53

connect usb OTG and your PC ,turn on the USB connect of Setting . On PC Terminal clint "adb shell"  .detail can see that webhttp://www.londatiga.net/it/how-to-use- ... line-tool/

under terminal

1.root@firefly:/ #adb shell         [be into board shell]

2.root@firefly:/ # echo 1 > /sys/module/rk_pwm_remotectl/parameters/dbg_level" [open IR Code debug]

3.then you use your IR remote . press random key one time. then ,

root@firefly:/ # dmesg | grep "USERCODE="

find the  "GET USERCODE=" and its tail is look like

"[  772.156403] GET USERCODE=0xFF00" this is your IR usercode, mark down

4.after you mark down your usercode , begin to modify your Source Code .

you can read WIKI about how to configure IR Firefly-WIKI/IR_Configuration

modify file kernel/drivers/input/remotectl/rk_pwm_remotectl.c

find out the location of this line  "static struct rkxx_remotectl_button remotectl_button[] ="

add your IR usercode .  look like under

Example:

  1. static struct rkxx_remotectl_button remotectl_button[] =
  2. {
  3. +   {
  4. +       .usercode = 0xff00, /* need to get the usercode in next step */
  5. +       .nbuttons = 12, /* number of buttons */
  6. +       .key_table = &remote_key_table_myIR[0],
  7. +   },
  8. #ifdef R66_REMOTE
Copy the code

5.when you done above step , save this code file and begin to make your SDK Kernel.img and burn kernel.img into your board.

repeat adb shell and open IR Code debug again.  then begin to mark your keycode one by one .

Example:

press KEY_up ,then

root@firefly:/ # dmesg | grep "RMC_GETDATA="

"[  772.156403] RMC_GETDATA="0xFCA2" /*this is your keycode , you can set this key function*/

one by one to press your key and mark down the keycode , and set function of the key below


  1. static struct rkxx_remote_key_table remote_key_table_myIR[12] = {
  2.     {0xeb, KEY_POWER},        // Power
  3.     // Control
  4.     {0xa3, 250},              // Settings
  5.     {0xec, KEY_MENU},         // Menu
  6.     {0xfc, KEY_UP},           // Up   --keycode above print
  7.     {0xfd, KEY_DOWN},         // Down
  8.     {0xf1, KEY_LEFT},         // Left
  9.     {0xe5, KEY_RIGHT},        // Right
  10.     {0xf8, KEY_REPLY},        // Ok
  11.     {0xb7, KEY_HOME},         // Home
  12.     {0xfe, KEY_BACK},         // Back
  13.     // Vol
  14.     {0xa7, KEY_VOLUMEDOWN},   // Vol-
  15.     {0xf4, KEY_VOLUMEUP},     // Vol+
  16. };
Copy the code

make your kernel.img and burn into your board.

after you done this job , you will complate your IR Configuration .


Firefly_WIKI many thing you can use on this web.


happy to use your own IR.


Author: eldflugan    Time: 1/9/2015 01:16

Thank you for the detailed input! I will try it out as soon I get the ADB tools working on any of my Ubuntu PCs. As it is now "adb devices" doesn't show anything (I have USB debugging on the RK3288 turned on) and adb shell gives me "error: device not found".




OK, several hours later I finally managed to adb into the board and I have come to step 3 in your description. Then I can't find the "DATA DBG and its tail"...?Could you please just give me a hint of the filenames and directories I am looking for? Or which grep command should I use to find the files you are referring to?




Thank you!
Author: leungtek    Time: 1/9/2015 09:02

sorry , I post wrong key work and fix the wrong above . you can see it again .
Author: eldflugan    Time: 1/9/2015 16:03

Thank you leungtek. Still a few questions:

In step 1. might there be a missing " in the line?root@firefly:/ # echo 1 > /sys/module/rk_pwm_remotectl/parameters/dbg_level" ?

In step 3. where (or how) do I find the file containing?"GET USERCODE=" ?

In step 4. when I try to cd into?kernel/drivers/input/remotectl/ I get error "no such file or directory". Do I have to download the source code from the firefly site?
Author: eldflugan    Time: 1/9/2015 17:36
Ok, maybe I understand now. The command in step 3. dmesg | grep "USERCODE=" is supposed to output that line of dmesg. Problem is it shows nothing. I guess that means that the IR receiver registered nothing, or?
Author: zhansb    Time: 1/9/2015 17:56
it will show the log when click the ir  remote.
Author: eldflugan    Time: 1/9/2015 18:53

Until I get a better understanding of the process, I went ahead and ordered a flirc usb IR receiver (
https://flirc.tv/product/flirc/
). It is supposed to work with Android, MCE remote and Kodi/XBMC.




Maybe there will be firmware with the IR enabled?available from Firefly in the future.
Author: eldflugan    Time: 1/9/2015 18:58

it will show the log when click the ir ?remote.

I don't know where to find the log.
Author: busybee    Time: 1/12/2015 18:18

Hi eldflugan , you can use adb.




To see the kernel log:

$ adb shell cat /proc/kmsg




To see the Android logcat:

$ adb logcat



Author: eldflugan    Time: 1/14/2015 05:16

$ adb shell cat /proc/kmsg

I get /proc/kms: No such file or directory




$ adb logcat

I get an endless list scrolling down the screen




I have installed my flirc-dongle and configured it to work with Kodi, so I am fine for now. It would, however be nice to just download and install an image where the IR receiver could be set up through some app in Android or Lubuntu.
Author: grant2258    Time: 1/19/2015 05:27

to see the data in dmesg type this




?echo 1 > /sys/module/rk_pwm_remotectl/parameters/code_print







Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1