Using new imon devinput with lirc

I don’t know exacly untile when but the imon lcd support has been merged  into the linux kernel using devinput.

This means that if you want to use the lirc_imon driver you need to blacklist the imon driver shipped with the kernel. You just need to add the following lines in the /etc/modprobe.d/blacklist.conf file:

blacklist rc_imon_pad

blacklist imon

After this you can proceed followingone of the lirc guides related to imon you find on the web.

But if you want to use the new devinput module, which in fact make thinks easier, you just leave the modules as they are and just edit the Hardware.conf file (/etc/lirc/hardware.conf):

# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE=”Linux input layer (/dev/input/eventX)”
REMOTE_MODULES=””
REMOTE_DRIVER=”devinput”
REMOTE_DEVICE=”/dev/input/by-id/usb-15c2_0038-event-if00″
REMOTE_SOCKET=””
REMOTE_LIRCD_CONF=”devinput/lircd.conf.devinput”
REMOTE_LIRCD_ARGS=””

#Enable lircd
START_LIRCD=”true”

And in the lirc configuration file /etc/lirc/lircd.conf you should put this line:

#Configuration for the Linux input layer (/dev/input/eventX) remote:
include “/usr/share/lirc/remotes/devinput/lircd.conf.devinput”

This work good on my ubutu 11.10, perhaps you need to adjust some paths if your distro is different.

PLS NOTE Done this way the knob on my antec fusion doesn’t work neigther the blue key on the remote. The kno generates events on a different device: /dev/input/by-id/usb-15c2_0038-event-mouse

So you have to chain two distinct lirc servers togethere:

/usr/sbin/lircd –pidfile=/var/run/lirc/lircd1.pid –output=/var/run/lirc/lircd1 –driver=devinput –device=/dev/input/by-id/usb-15c2_0038-event-mouse –listen/usr/sbin/lircd –output=/var/run/lirc/lircd –driver=devinput –device=/dev/input/by-id/usb-15c2_0038-event-if00 –connect=localhost 8765

This way you find events of both devices on the socket /var/run/lirc/lircd.

Due to a driver bug, which i will investigate, the knob gets temporarly disabled if you press some particular key. For example if you press the yellow tv button the kno will not work anymore, until you press a number button of the remote.

To make the two instances of lirc to startup at boot time i added an upstart script /etc/init/htpc-lirc.conf:

description    “HTPC lirc daemon”

start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]

script
mkdir /var/run/lirc -p
/usr/sbin/lircd –pidfile=/var/run/lirc/lircd1.pid –output=/var/run/lirc/lircd1 –driver=devinput –device=/dev/input/by-id/usb-15c2_0038-event-mouse –listen
/usr/sbin/lircd –output=/var/run/lirc/lircd –driver=devinput –device=/dev/input/by-id/usb-15c2_0038-event-if00 –connect=localhost:8765
end script

Finally link it init.d

ln -s /lib/init/upstart-job /etc/init.d/htpc-lirc

 

 

 

SSD journaling and ro remount

I recently upgraded my laptop with a brand new SSD, my first two impressions are: much much faster, much much instable.
Yes that’s right, instable. My first try with SSD is was with a HANA SSD 8G (model: HLSM008G), does’t work on linux. I bought this drive on ebay just to make some tries with an economic disk, and eventually install it for use with mythtv as boot disk. Never do this, never buy HANA if you plan to use it on linux. It simply doesn’t even install you get a kernel panic. As I see now the product has been removed from ebay.

My second try is a OCZ Agility II, installed on my htpc with mythtv. On the same pc i had two 500GB HDD and an optical drive. One of the two HDD’s randomly freezes at boot time with the OCZ installed. That means 2 boot every 3 this HDD could not be mounted. I had to remove it. The second issue with the same OCD Agility where some occasionally errors syncing the journal with consequent remount in ro exactly while watching the clue scene of a film. Googling around i found somebody saying that the journal does not have sense in a SSD. In fact if the system crashes the check time on an SSD is ridiculous, so the benefits are irrelevant. So i removed the journal and the issue seem to be gone.

Meanwhile I bought a second OCZ Vertex II for my laptop, work grate, but for performance reasons I decided to remove the journal from ext4. To do so I needed to mount the disk in ro mode.
Easy:

sodo mount -o remount,ro /dev/sda1

No way!! Even booting the system in maintanace mode mount cannot remount in ro if disk is busy.

So it is some more complicate, this is what I had to do:

  • nano /etc/fstab
  • UUID=… / ext4 ro,errors=remount-ro 0 1
  • reboot
  • After reboot:

  • tune2fs -O ^has_journal /dev/sda1
  • mount -o remount,rw /dev/sda1
  • nano /etc/fstab
  • remove ro option

Linux is always a step behind.

Mysql bug parade

Ok, just to tell the truth this is not a real bug parade, but today I’m struggling with many different bugs. The worst thing is that each time you spend a lot of time trying to figure out what is wrong in your code. So when there is a bug in something like mysql the first step is a review of your own code. After loosing time in trying to find the bug you reach the point where the assertion “my code is correct” is true.

What next? Google and spend some hours googling. Finally in a remote ranked page at position 232 of the google result you find a response of an anonymous developer who answers in the year 2009 to  question posted in year 2005. The solution proposed seems very silly. Absurd. But you are desperate. So you try the solution and…IT WORKS!!!

 

  • Alter table errno:150 [solved]

alter table failure add index FKBF3C318AB88FBECE (idsent),add constraint FKBF3C318AB88FBECE foreign key (idsent) references sent_mail (idsent);

raises an error:  Can’t create table ‘mercurius.#sql-61c_4a’ (errno: 150)
solution:
set foreign_key_checks = 0 ;
alter table failure add index FKBF3C318AB88FBECE (idsent),add constraint FKBF3C318AB88FBECE foreign key (idsent) references sent_mail (idsent);
set foreign_key_checks = 1;
Works!
  • Alter table errno:150 [unsolved]
Same issue as above: alter table QRTZ_JOB_LISTENERS add index FK2E3C7E25EC364202 (JOB_GROUP, JOB_NAME),
add constraint FK2E3C7E25EC364202 foreign key (JOB_GROUP, JOB_NAME) references QRTZ_JOB_DETAILS (JOB_GROUP, JOB_NAME);
raises an error:  Can’t create table ‘mercurius.#sql-61c_4a’ (errno: 150)
same solution as above doesn’t work!
  • Insert and incorrect mysqld_stmt_execute
A standard prepared statement
insert into … values(?,?,?)… raises an exception.
java.lang.RuntimeException: Unable to continue: Error while commiting the transaction
which is caused by a
Caused by: java.sql.BatchUpdateException: Incorrect arguments to mysqld_stmt_execute
adding the parameter useServerPrepStmts=false to the connection works:
jdbc:mysql://localhost:3306/mercurius?useServerPrepStmts=false

Strange locale things happen under Tomcat/Jasper

I recently installed a webapp which uses tomcat and jasper on one of my server. Everything worked well until a template used some special chars, I got the ‘?’ chars which indicate the typical encoding issue.

Everything seemed correct, DB in UTF-8, virtual machine started with -Dfile.encoding=UTF-8, application in UTF-8, data files in UTF-8.

After an hour spend in all these checks I tried an “export LANG=it_IT.utf8” in my linux environment. Everything worked well.

Where is the point? Very simple, some jar don’t look in the JVM system properties but look for the native locale in the linux enviroment. This causes portability issues and lost of time in solving stupid problems.

WP to LinkedIn Auto Publish Powered By : XYZScripts.com