lirc – gentoo – devinput

October 6, 2011

I’ve been using linux infrared remote control (lirc) for a while in Gentax, i.e. I have a remote control and I use that to change channels in mythtv.  When I first started using it, it was  a pain to configure. For the last 2 years or so it has for the most part just worked.  Recently there have been a number of changes to put it into the kernel and make things better going forward. The biggest change is that the most popular drivers were moved into the kernel so in order to get a device working it can be as easy as selecting it in the kernel config and compiling it. The kernel actually does 2 things now it supports the device and it can use the device using its built in event subsystem. If you have a really simple setup with a popular remote you shouldn’t actually need any additional packages at least in Gentoo like inputlircd or lircd since the kernel can handle it all. However as I recently found out if you have any complexity then it can be a pain to figure out whats going on.

My problem is that I wanted to use the ir blaster as well since I am now using a digital cable box and I needed mythtv to control it. First, devinput / event / input subsystem does not support the ir blaster functionality so you shouldn’t use that if you want things to work. Secondly the kernel is now building the device driver, so in gentoo compiling lirc with mceusb does nothing. Thirdly the order that the kernel loads the drivers determines whether it works or not.

The way to get gentoo lirc to support the device with ir blaster is to build it with the “userspace” device. I was getting key-map not recognized errors in dmesg, to fix that I built into the kernel the following and built my device as a module to ensure it loads after correctly. I also saw another site that makes you blacklist it at load and then force load it in the correct order but this is simpler and more likely to work going forward.

Compile Remote Controller Keymap modules,

Enable IR raw decoder for RC6 protocol – for my vista mceusb remote,

Enable IR to lirc bridge – to allow lirc to use the device and create the /dev/lirc0 device

It is working perfectly now and I was finally able to get it working after a couple days and multiple sources of information. I will post my setup and config below. These sites were helpful for me.

http://www.mythtv.org/wiki/MCE_Remote

http://www.mythtv.org/wiki/LIRC#Gentoo

http://en.gentoo-wiki.com/wiki/LIRC

 

My current setup as of Oct 2011 is vista mceusb remote that came with a HVR1600 in Gentoo 2.6.39 and lirc-0.9.0.

 

make.conf

INPUT_DEVICES="keyboard mouse lirc evdev"
LIRC_DEVICES="userspace"

.config - Kernel config
# Multimedia drivers
#
CONFIG_RC_CORE=y
CONFIG_LIRC=y
CONFIG_RC_MAP=y
# CONFIG_IR_NEC_DECODER is not set
# CONFIG_IR_RC5_DECODER is not set
CONFIG_IR_RC6_DECODER=y
# CONFIG_IR_JVC_DECODER is not set
# CONFIG_IR_SONY_DECODER is not set
# CONFIG_IR_RC5_SZ_DECODER is not set
CONFIG_IR_LIRC_CODEC=y
# CONFIG_IR_ENE is not set
CONFIG_IR_IMON=m
CONFIG_IR_MCEUSB=m
# CONFIG_IR_ITE_CIR is not set
# CONFIG_IR_NUVOTON is not set
# CONFIG_IR_STREAMZAP is not set
# CONFIG_IR_WINBOND_CIR is not set
CONFIG_RC_LOOPBACK=m

conf.d lircd
LIRCD_OPTS="-d /dev/lirc0"
0

Linux is cool or how to grow your mirror on the fly.

June 17, 2011

Occasionally linux impresses me to no end. I use Gentoo for a myth tv box which in the winter runs boinc to also keep the house warm. It had a single 280gb harddrive which got upgraded to 2 x 320gb hard drives when my main box got upgraded. I run the two drives mirrored but I set them up using the same setup as the 280gb drive. A couple nights ago I decided I should make available the extra 40gb that weren’t being used. In order to do that I would have to grow the raid 1 mirror.

Based on this http://www.linuxquestions.org/questions/linux-software-2/growing-really-grow-a-raid1-mdadm-grow-853683/ and a couple hours of random reading I was able to successfully do it and understand it.

My setup was 2 sata drives sda and sdb. Boot partition of md125 (sda1 + sdb1), swap md126 ( sda2 + sdb2) and data md127 ( sda3 + sdb3). The data drives were formatted as ext3. In the end it took a couple hours only because I had to take each drive down individually and then re-mirror but it was all online. Obviously take backups first.

  1. fail mirror, (mdadm –fail /dev/md127
  2. remove sdb3, mdadm -r /dev/md127 /dev/sdb3
  3. fdisk to extend partition - make sure to start on same sector and keep raid filesystem type
  4. add disk back, mdadm –add /dev/md127 /dev/sdb3, and wait for re-mirror (make sure not much else is using the disk otherwise its much much slower i.e. 60mb/s to 4 mb/s)
  5. partprobe to inform kernel of partition size change
  6. fail mirror, mdadm –fail /dev/md127
  7. remove sda3, mdadm –remove /dev/md127 /dev/sda3
  8. fdisk to extend partition – make sure to start on same sector and keep raid filesystem type
  9. add disk back, mdadm –add /dev/md127 /dev/sda3, and wait for re-mirror (make sure not much else is using the disk otherwise its much much slower i.e. 60mb/s to 4 mb/s)
  10. partprobe to inform kernel of partition size change
  11. grow raid partition mdadm –grow /dev/md127 -size=max
  12. non-destructively add space at end of partition – resize2fs /dev/md127

I was amazed that everything just worked. Some of the research suggested it needed to be a modern kernel 2.6.10+ and online resize of a mounted raid partition had to use an ext3 filesystem.

0