Closed ambrosa closed 9 years ago
Maybe, you need to load kernel module first and then change /dev/input/event0 to /dev/input/event1 (event 1 for me, you can find event id in dmesg)? It works for me, tested with evtest and two LG remotes.
First:
cubie@Cubian:~$ sudo modprobe sun4i-ir
Second:
cubie@Cubian:~$ sudo dmesg
...(other events here)...
[ 8314.510000] input: sun4i-ir as /devices/virtual/input/input1
[ 8314.510000] IR Initial OK
evtest:
cubie@Cubian:~$ sudo evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "sun4i-ir"
Supported events:
...many values...
Properties:
Testing ... (interrupt to exit)
Event: time 1377546102.027891, type 1 (EV_KEY), code 167 (KEY_RECORD), value 1
Event: time 1377546102.027900, -------------- SYN_REPORT ------------
Event: time 1377546102.219470, type 1 (EV_KEY), code 167 (KEY_RECORD), value 0
Event: time 1377546102.219474, -------------- SYN_REPORT ------------
Event: time 1377546105.234701, type 1 (EV_KEY), code 166 (KEY_STOPCD), value 1
Event: time 1377546105.234718, -------------- SYN_REPORT ------------
Event: time 1377546105.429508, type 1 (EV_KEY), code 166 (KEY_STOPCD), value 0
Event: time 1377546105.429519, -------------- SYN_REPORT ------------
Event: time 1377546105.966820, type 1 (EV_KEY), code 169 (KEY_PHONE), value 1
Event: time 1377546105.966836, -------------- SYN_REPORT ------------
Event: time 1377546106.159517, type 1 (EV_KEY), code 169 (KEY_PHONE), value 0
Event: time 1377546106.159528, -------------- SYN_REPORT ------------
Event: time 1377546106.620525, type 1 (EV_KEY), code 168 (KEY_REWIND), value 1
Event: time 1377546106.620544, -------------- SYN_REPORT ------------
Event: time 1377546106.819521, type 1 (EV_KEY), code 168 (KEY_REWIND), value 0
Event: time 1377546106.819533, -------------- SYN_REPORT ------------
Event: time 1377546107.957278, type 1 (EV_KEY), code 7 (KEY_6), value 1
Event: time 1377546107.957294, -------------- SYN_REPORT ------------
Event: time 1377546108.149513, type 1 (EV_KEY), code 7 (KEY_6), value 0
Event: time 1377546108.149523, -------------- SYN_REPORT ------------
Event: time 1377546108.706309, type 1 (EV_KEY), code 6 (KEY_5), value 1
Event: time 1377546108.706323, -------------- SYN_REPORT ------------
Event: time 1377546108.899513, type 1 (EV_KEY), code 6 (KEY_5), value 0
Event: time 1377546108.899525, -------------- SYN_REPORT ------------
It was an hard work but now LIRC works :-) So I've written a simple newbie HOWTO for Cubian and LIRC. Cubieplayer, if you wish you can add it to your Cubian docs.
HOWTO LIRC and Cubian.
It's hard to find a remote control that works with Cubieboard. I've tried 9 remotes and only 2 are working :-(
1) Load IR kernel module:
# modprobe sun4i_ir
or with newer kernel
# modprobe sunxi_ir
(you can add it in /etc/modules)
Check if you have the correct device (should be event1 )
# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="axp20-supplyer"
P: Phys=m1kbd/input2
S: Sysfs=/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.41/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=7
B: KEY=100000 0 0 0
B: REL=0
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sun4i-ir"
P: Phys=RemoteIR/input1
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=sysrq rfkill kbd event1
B: PROP=0
B: EV=3
B: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe
and/or check with dmesg (but no evidence about event* )
# dmesg
[ 31.720000] input: sun4i-ir as /devices/virtual/input/input1
[ 31.740000] IR Initial OK
Device is /dev/input/event1
2) Find a working remote
# apt-get install evtest
Run evtest and press button on your remote facing the Cubieboard IR receiver and if you see some output ... bingo !
You have found a working remote !
Remember: only few remotes work.
# evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "sun4i-ir"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 1 (KEY_ESC)
Event code 2 (KEY_1)
(..omissis..)
Event code 254 (?)
Event code 255 (?)
Properties:
Testing ... (interrupt to exit)
Event: time 1377625557.653259, type 1 (EV_KEY), code 195 (?), value 1
Event: time 1377625557.653273, -------------- SYN_REPORT ------------
Event: time 1377625557.903558, type 1 (EV_KEY), code 195 (?), value 0
Event: time 1377625557.903568, -------------- SYN_REPORT ------------
Event: time 1377625561.975462, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1
Event: time 1377625561.975475, -------------- SYN_REPORT ------------
Event: time 1377625562.173566, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 0
Event: time 1377625562.173577, -------------- SYN_REPORT ------------
3) Now install and configure LIRC
# apt-get install lirc
edit /etc/lirc/hardware.conf as below:
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Don't start irexec, even if a good config file seems to exist.
#START_IREXEC=false
#Try to load appropriate kernel modules
# if LOAD_MODULES=false , modules must be preloaded, i.e. during boot (/etc/modules)
LOAD_MODULES=true
MODULES="sun4i_ir"
# newer kernel
#MODULES="sunxi_ir"
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="devinput"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/input/event1"
# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
Now you must configure LIRC with your remote
Take a look at http://lirc.sourceforge.net/remotes/generic/ and download a generic configuration file.
i.e. NEC.conf
# wget http://lirc.sourceforge.net/remotes/generic/NEC.conf
Run irrecord
# irrecord -H devinput -d /dev/input/event1 NEC.conf
and record your keys. Start trying with 2 or 3 keys.
It's sound strange but sometime you need to press shortly twice the same button or sometimes you need hold down it for long time (5 sec. ?). Try !
You can see key names allowed with
# irrecord -l
New file will be saved as NEC.conf.conf with new hardware parameters and key codes.
If your key codes are doubled like
begin codes
KEY_0 0x0100FF00000001 0x00000000000000
KEY_1 0x01000100000001 0x00000000000000
end codes
edit NEC.conf.conf and manually remove the second code 0x00000000000000 Result
begin codes
KEY_0 0x0100FF00000001
KEY_1 0x01000100000001
end codes
Edit NEC.conf.conf and change the 'name' from NEC.conf.conf to something better, i.e. myremote
begin remote
name myremote
Finally copy NEC.conf.conf to /etc/lirc/lircd.conf
Now test lircd. Start (or restart) it with
# /etc/init.d/lirc start
and run irw and press some keys on your remote:
root@Cubian:~# irw
000100c300000001 00 KEY_OK myremote
000100c500000001 00 KEY_DOWN myremote
000100a800000001 00 KEY_KPPLUS myremote
000100a000000001 00 KEY_POWER myremote
0001000800000001 00 KEY_8 myremote
0001000100000001 00 KEY_1 myremote
0001000600000001 00 KEY_6 myremote
SUCCESS : LIRC is working fine !
Provided as example, this is my full /etc/lirc/lircd.conf working with a remote used with an old satellite STB Linux based. And it works with Cubieboard too :-)
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(devinput) on Tue Aug 27 17:29:18 2013
#
# contributed by ambrosa
#
# brand: DUOLABS
# model no. of remote control: QBOXHD
# devices being controlled by this remote: QBOXHD
#
begin remote
name qboxhd
bits 56
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9000 4500
one 563 1687
zero 563 562
ptrail 563
pre_data_bits 8
pre_data 0x0
gap 108000
toggle_bit_mask 0x0
frequency 38000
duty_cycle 33
begin codes
KEY_MUTE 0x0100A100000001
KEY_POWER 0x0100A000000001
KEY_1 0x01000100000001
KEY_2 0x01000200000001
KEY_3 0x01000300000001
KEY_4 0x01000400000001
KEY_5 0x01000500000001
KEY_6 0x01000600000001
KEY_7 0x01000700000001
KEY_8 0x01000800000001
KEY_9 0x01000900000001
KEY_NEXT 0x0100A700000001
KEY_0 0x0100FF00000001
KEY_PREVIOUS 0x0100A600000001
KEY_KPPLUS 0x0100A800000001
KEY_KPMINUS 0x0100B100000001
KEY_INFO 0x0100AC00000001
KEY_UP 0x0100C100000001
KEY_MENU 0x0100AD00000001
KEY_LEFT 0x0100C200000001
KEY_OK 0x0100C300000001
KEY_RIGHT 0x0100C400000001
KEY_AUDIO 0x0100A200000001
KEY_DOWN 0x0100C500000001
KEY_VIDEO 0x0100A400000001
KEY_VOLUMEUP 0x0100A300000001
KEY_VOLUMEDOWN 0x0100A500000001
KEY_STOP 0x0100A900000001
KEY_EXIT 0x0100B600000001
KEY_RECORD 0x0100AB00000001
KEY_RED 0x0100B200000001
KEY_GREEN 0x0100B400000001
KEY_YELLOW 0x0100B500000001
KEY_BLUE 0x0100B300000001
KEY_TV 0x0100B700000001
KEY_RADIO 0x0100AE00000001
KEY_TEXT 0x0100B800000001
KEY_HELP 0x0100B900000001
KEY_FAVORITES 0x0100AA00000001
KEY_MEDIA 0x0100BA00000001
end codes
end remote
Good work, ambrosa! :)
Thanks to you VeryStrangeMan for 'evtest' idea.
I used 'ir-keytable' for testing remote but 'evtest' is more simple :-)
BTW: I've modified just now the small HOWTO above adding a full lircd.conf as example.
Happy to help ;)
Quick note: sun4i_ir is now sunxi_ir in the most recent kernel.
@ambrosa Nice tutorial, I'd like to put it to wiki.
@patrickhwood : today I will do a cubian_update and I will check module name :-)
I've compiled successfully XBMC and It's looks to work. But till now I cannot test it (no keyboard or mouse connected to Cubieboard). I use HDMI CEC (with my Raspberry PI connected to my Panasonic TV) but libcec doesn't support Allwinner chip :-( So I need LIRC ... and now LIRC is working :-)
Today or tomorrow I will test XBMC and I will compare to Cubieboard. I've already made an HOWTO about compile it. Stay tuned.
@cubieplayer I've changed my tutorial just now. I've added new kernel module name and correct some typos.
@cubieplayer : sorry to bother you. Your Cubian GitHub Wiki https://github.com/cubieplayer/Cubian/wiki is public editable. If you wish, I can add my LIRC tutorial into it. Let me know.
Regards.
@ambrosa Sure, it's open for everyone. You can add link to http://cubian.org if you want. Just fork https://github.com/cubieplayer/cubian.org send a pull request.
@cubieplayer and @ambrosa
can you help me to adding new module kernel for IR on Cubieboard2 ?? i'm not found this module on kernel.
What kernel version are you using and where did you get it? What's the config file look like (/proc/config.gz). Is there already a module in /lib/modules?
Try "find /lib/modules | grep sun.i-ir"
Pat
On 09/17/2013 06:53 AM, Supriyanto wrote:
@cubieplayer https://github.com/cubieplayer and @ambrosa https://github.com/ambrosa
can you help me to adding new module kernel for IR on Cubieboard2 ?? i'm not found this module on kernel.
— Reply to this email directly or view it on GitHub https://github.com/cubieplayer/Cubian/issues/75#issuecomment-24579095.
#
#
#
#
Infrared port device driver empty not set /proc/config.gz
@cubieplayer : please add driver Infrared port
I was looking at ir module code and it seems there is a code check feature that can be disabled to accept codes from more remotes. Cubieplayer, are you compiling the code with that feature enabled?
From https://github.com/mmplayer/sunxi-kernel-config/blob/master/config-cubian-base-sun4i, I know CONFIG_IR_SUNXI=m. Maybe you need apt-get install linux-image?
It's hard to find a remote control that works with Cubieboard. I've tried 9 remotes and only 2 are working :-(
Please, check https://github.com/wknightbor/CirSunxi/. It helps to use a little bit more remotes.
Hi ! Thanks for all your work. I got my Cubieboard 2 finally working with IR, but am limited by choice of IR remotes. I would love to follow wknightbor's instructions on CirSunxi, but it seems a bit out of my scope - plus my board has an A20 and I can't judge the implications on his instructions.
My Cubie is running Cubian (GNU/Linux 3.4.79-sun4i armv7l). I am using FHEM for home automation and the IR is supposed to provide a backchannel for a Logitech Harmony Hub.
Questions:
Thanks, DC
In my Cubieboard A10 I can see that IR (infrared) is enabled, compiled static into kernel
Then I've installed lirc (apt-get install lirc). This is my /etc/lirc/hardware.conf (taken from cubieboard forum):
My /etc/lirc/lircd.conf and lircmd.conf are empty.
For testing purpose in a terminal session I run:
In another terminal session I run:
The lircd session show some problems:
I've tried 5 different remote controle: none of them working.
This is the first time I try to use LIRC. I don't know if it's a LIRC configuration problem, Cubian problem or Cubieboard (hrdware) problem.
Any idea ?