User Tools

Site Tools


doc:howto:lirc-audio_alsa

Differences

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

Link to this comparison view

Next revision
Previous revision
doc:howto:lirc-audio_alsa [2012/11/08 18:15]
danitool created: LIRC audio_alsa howto
doc:howto:lirc-audio_alsa [2015/05/05 20:06] (current)
danitool
Line 10: Line 10:
 {{:​inbox:​howto:​lirc-audio_alsa.jpg?​500|}} \\ {{:​inbox:​howto:​lirc-audio_alsa.jpg?​500|}} \\
 A TSOP1736 IR module also works. The +5V should be as stable as possible to avoid power supply disturbances. A TSOP1736 IR module also works. The +5V should be as stable as possible to avoid power supply disturbances.
 +
 +  * **Improved circuit**: With a low band pass filter to minimize power supply disturbances. Also we put the 100 nF capacitor before the voltage divider, not after, Also we put a 10kohm pullup ressitor in the IR module out to boost the signal.\\ {{:​media:​doc:​howtos:​lirc-audio_alsa-v3.png?​direct&​500|}}\\ One drawback for keeping it simple is the power supply. We can just modify our USB audiostick **isolating one minijack contact** and bridging it to the +5V usb power supply.\\ {{:​media:​doc:​howtos:​lirc_alsa-audiostick.jpg?​400|}}\\ The circuit then can be wired with a minijack cable. We need a little case for the circuit with the IR module receiver, an ADSL microfilter case is perfect for this purpose (you have for sure tons of them from ISPs).\\ {{:​media:​doc:​howtos:​lirc_alsa-case1.jpg?​400|}}
 +
 +
  
 ===== Prepare your your software ===== ===== Prepare your your software =====
Line 16: Line 20:
 ./​scripts/​feeds install lirc alsa-utils ./​scripts/​feeds install lirc alsa-utils
 </​code>​ </​code>​
-| {{:​meta:​icons:​tango:​package-x-generic.png|}} | The lirc package is not built as default with //​audio_alsa//,​ and it seems partially broken. As a result of this you must modify the Makefile for lirc. Or just download this fixed one: \\ [[https://files.myopera.com/danitool/​livebox/​wifiradio/​lirc-audio_alsa-AA.zip|lirc-audio_alsa-AA.zip]] \\ Prepared to work with OpenWrt Attitude Adjustment, but it may also work with Backfire. Replace the lirc directory under feeds with this new one. |+ 
 +<WRAP center round download 60%> 
 +The lirc package is not built as default with //​audio_alsa//,​ and it seems partially broken. As a result of this you must modify the Makefile for lirc. Or just download this fixed one: \\ Mirror: ​[[https://github.com/probonopd/​lirc-audio_alsa-for-openwrt|lirc-audio_alsa-for-openwrt]] \\ Tested ​with OpenWrt Attitude Adjustment, but it may also work with Backfire. Replace the lirc directory under feeds with this new one. 
 +</​WRAP>​
  
 As usually build your custom firmware but select alsa-utils, lirc: As usually build your custom firmware but select alsa-utils, lirc:
Line 83: Line 90:
  
 | {{:​meta:​icons:​tango:​dialog-information.png|}} | Note the file **/​etc/​lircd.conf** is specific for your remote. You'll may need to use [[http://​www.lirc.org/​html/​irrecord.html|irrecord]] to get one for your own remote if you don't find any in the [[http://​lirc.sourceforge.net/​remotes/​|lirc database]]. | | {{:​meta:​icons:​tango:​dialog-information.png|}} | Note the file **/​etc/​lircd.conf** is specific for your remote. You'll may need to use [[http://​www.lirc.org/​html/​irrecord.html|irrecord]] to get one for your own remote if you don't find any in the [[http://​lirc.sourceforge.net/​remotes/​|lirc database]]. |
 +
 +==== Build with a transmitter ====
 +You may want to use the [[doc/​howto/​lirc-gpioblaster|LIRC GPIO blaster]] kernel module together with audio_alsa receiver. We can use two lirc instances connected via TCP/IP or rather to patch lirc for having only one daemon running, this way it's more compact and saves some bytes. Link with the LIRC package and the patch, and also the lirc_gpioblaster module
 +<WRAP center round download 60%>
 +LIRC audio_alsa patched to work with lirc_gpioblaster kernel module\\
 +[[https://​drive.google.com/​uc?​export=download&​id=0B-EMoBe-_OdBTTROQ3hpYUV3S0k|lirc_0.9.0-audio_alsa-plus_gpioblaster.zip]]
 +
 +(Tested under Openwrt Attitude Adjustment)
 +</​WRAP>​
  
 ===== Make it work ===== ===== Make it work =====
Line 90: Line 106:
 lircd --driver=audio_alsa -d plughw@24000 lircd --driver=audio_alsa -d plughw@24000
 </​code>​ </​code>​
 +<WRAP center round important 60%>
 +LIRC sometimes is affected by an alsa bug, see -> [[#​alsa_bug]]
 +</​WRAP>​
  
 Now execute irw, to test your remote, the codes are shown when you press any button. Now execute irw, to test your remote, the codes are shown when you press any button.
Line 167: Line 186:
 irexec --daemon /​etc/​wifiradio/​lircrc irexec --daemon /​etc/​wifiradio/​lircrc
 </​code>​ </​code>​
 +
 +===== alsa bug =====
 +Sometimes lirc is unable to open correctly the recording device. The cause is still unknown. But fortunatelly when opening several times the alsa recording device we can see it fails with a defined pattern.
 +
 +''​arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test01.wav ​ <-- good
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test02.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test03.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test04.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test05.wav ​ <-- good
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test06.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test07.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test08.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test09.wav ​ <-- good
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test10.wav ​ <-- bad
 +arecord -q -d 1 -r44100 -f S16_LE -c1 -t wav test11.wav ​ <-- bad
 +......
 +''​
 +
 +{{:​media:​doc:​howtos:​lirc_alsa-arecord-bcm63xx.png?​direct&​600|}}
 +
 +This happens in bcm63xx, the pattern is 3 good recordings, 1 bad. In bcm47xx the pattern is 1 good recording, 1 bad recording. ​
 +
 +Considering this known predictable bug, we can solve the problem with an ugly workaround: m**ake dummy recordings before running lirc**.
 +
 +Put this command before the line that executes the lirc daemon
 +<​code>/​usr/​bin/​arecord -q -d 1 -r44100 -f S16_LE -c1 -t raw > /​dev/​null</​code>​
 +
 +You may need to put 1, 2 or 3 lines depending on the state of the recording device. Just test it adding more lines with a router reboot in every added recording line until lirc starts working ok.
 +
  
 ===== Notes ===== ===== Notes =====
 Successfully tested with a [[toh:​inventel:​DV4210|Livebox 1]] router under Backfire, using a CSOUNDU Conceptronic usb audio card, and TSOP1736 ​ --- //danitool 2012/11/04 15:02// Successfully tested with a [[toh:​inventel:​DV4210|Livebox 1]] router under Backfire, using a CSOUNDU Conceptronic usb audio card, and TSOP1736 ​ --- //danitool 2012/11/04 15:02//
 +
  
 ===== Tags ===== ===== Tags =====
 {{tag>​wip lirc}} {{tag>​wip lirc}}
doc/howto/lirc-audio_alsa.1352394934.txt.bz2 · Last modified: 2012/11/08 18:15 by danitool