Archive

Posts Tagged ‘linux’

Fedora 18 pulseaudio/ALSA and nvidia hdmi audio

June 18, 2013 Leave a comment

Fedora 18 replaced my ALSA audio setup with pulseaudio. I managed to get the nvidia hdmi audio disabled, but I still had some issues when I used MythTV’s timestretch feature. The audio would start cracking and the video would also freeze every few frames.

So I decided to revert back to ALSA:
yum erase pulseaudio

This removed the following modules:
pulseaudio pulseaudio-module-gconf pulseaudio-module-bluetooth pulseaudio-esound-compat paprefs gnome-bluetooth bluez

The next problem was that my system was confused whether I wanted audio played through nvidia hdmi or my motherboard. In this case the motherboard is my option.

To fix this, I did “aplay -l” and took note of the card and device ids through which I wanted my audio. Then I put the audio device in /etc/asound.conf (make sure there are no overrides of this file in the user’s home directory):

pcm.!default {
type hw
card 0
device 0
}

Then I just set mythtv to use the correct ALSA device. After a restart, MythTV is now back to using ALSA audio again.

Advertisements

IRMan serial infrared receiver in Fedora 18

June 18, 2013 Leave a comment

Fedora 18 broke my IRMan serial infrared receiver. It no longer seems to use the configuration defined in /etc/sysconfig/lirc.

Instead, you apparently need to specify the configuration directly in the daemon script /usr/lib/systemd/system/lirc.service:

So I set the correct driver and device parameters in that script:
ExecStart=/usr/sbin/lircd –driver=irman –device=/dev/ttyS0

Also, I found that Fedora 18 no longer automatically started the lirc service after the upgrade. So you need to enable it:
systemctl enable lirc

This should work after a reboot…

If it doesn’t you can try to kill all lircd instances and run:
/usr/sbin/lircd –driver=irman –device=/dev/ttyS0

followed by:
irw

This should produce output whenever you press a button on your remote.

MythTV failing recordings and device mappings

August 3, 2012 1 comment

After upgrading from FC12 to FC16, I began having some issues with failing recordings. After boot, recordings from certain channels would always fail (in this case channels using DVB CAM).

My setup is this:

  • “ST STV0297 DVB-C” -> Free channels
  • “ST STV0297 DVB-C” + CAM -> Pay channels
  • “Philips TDA10023 DVB-C” -> Free channels

I had mythtv configured that my CAM card is on /dev/dvb/adapter2/frontend0.

What I eventually figured out was that after the upgrade from FC12->FC16, my DVB CAM card was no longer always being assigned the above adapter2 mapping. Instead, the hardware used for “adapter2” kept on changing each boot:

Jul 21 14:38:13 localhost kernel: [    7.187973] DVB: registering adapter 2 frontend 0 (ST STV0297 DVB-C)…
Jul 21 19:47:43 localhost kernel: [    8.625730] DVB: registering adapter 2 frontend 0 (ST STV0297 DVB-C)…
Jul 21 19:52:49 localhost kernel: [    8.572348] DVB: registering adapter 2 frontend 0 (Philips TDA10023 DVB-C)…
Jul 21 21:03:04 localhost kernel: [    7.606219] DVB: registering adapter 2 frontend 0 (Philips TDA10023 DVB-C)…

Still, mythtv assumed that adapter 2 had the CAM. This of course led to a situation where mythtv couldn’t record, because it didn’t have the hardware to decode the channel on the specified adapter. This was evident when watching live TV, the “LMSc” never changed to “LMSC”. The capital C means it’s successfully decoding.

So, basically, you need to fix this by manually assigning the device mappings. After doing that, I now have symlinks like these:

/dev/dvb/adapter-ttfree/frontend0 -> ../adapter0/frontend0
/dev/dvb/adapter-ttcam/frontend0 -> ../adapter2/frontend0

The instructions for setting up permanent device mappings can be found here: http://www.mythtv.org/wiki/Device_Filenames_and_udev

This is basically the file I ended up with:

/etc/udev/rules.d/55-dvb.rules
SUBSYSTEM==”dvb”, ATTRS{product}==”anysee*”, PROGRAM=”/bin/sh -c ‘K=%k; K=$${K#dvb}; printf dvb/adapter-anysee/%%s $${K#*.}'”, SYMLINK+=”%c”
SUBSYSTEM==”dvb”, ATTRS{vendor}==”0x1131″, KERNELS==”0000:07:01.0″, PROGRAM=”/bin/sh -c ‘K=%k; K=$${K#dvb}; printf dvb/adapter-ttfree/%%s $${K#*.}'”, SYMLINK+=”%c”
SUBSYSTEM==”dvb”, ATTRS{vendor}==”0x1131″, KERNELS==”0000:08:01.0″, PROGRAM=”/bin/sh -c ‘K=%k; K=$${K#dvb}; printf dvb/adapter-ttcam/%%s $${K#*.}'”, SYMLINK+=”%c”

Note, the file is hardware specified, so you need to create your own according to the instructions on the above page. Next reboot, you should have the device mapping symlinks setup correctly.

Now you just need to configure mythtv to use these symlinks instead of referring to adapterX directly. Personally, I deleted all mythtv capture card configuration and re-did it. I don’t think that’s strictly needed, but I just wanted to clean up my configuration a bit at the same time.

cifs mount error(12): Cannot allocate memory

July 23, 2012 Leave a comment

I had some issues when I started to use autofs to mount windows shared from linux. The shares would go missing from linux and result in this kind of error:

mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

To fix this, I used the advice from here:

Set the following registry key to ’1′:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache

and set the following registry key to ’3′:

HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size

Then just restart.

Linux backup/restore and grub2 reinstall

July 23, 2012 Leave a comment

Not exactly related to MythTV, but very useful because MythTV often breaks when upgrading, so you want to be able to easily restore an old version.

In order to backup linux, I use dump and restore.

You can backup your system drive by booting into rescue mode and running the following:

/sbin/dump -0 -v -a -y -f- -L “Linux root partition” /dev/sda1 1>filename.dump 2>filename.log

To restore, use the rescue mode of the installation DVD and mount the drive you want to restore to. Then go to the root directory of that drive and type:

/sbin/restore -r -f /location-of-dump-file/filename.dump

I’ve used this approach successfully for a long time. Now with the switch to grub2, I had to figure out how to reinstall grub2 on the disk after doing the restore.

After a lot of googling, I finally figured it out and wrote the following script:

#!/bin/bash
read -p “Press ENTER to restore grub2…”

echo
echo Mounting /dev/sda1 to /mnt/sda1 – these may already be mounted
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1

echo
echo Mounting bindings
mount –bind /dev /mnt/sda1/dev
mount –bind /proc /mnt/sda1/proc
mount –bind /sys /mnt/sda1/sys

echo
read -p “Press ENTER to install grub”;
echo Installing grub and configuring it for local drive
chroot /mnt/sda1/ /bin/sh -c “/sbin/grub2-install /dev/sda; /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg”

WARNING 1: You will want to change your drives/partitions listed in these scripts.

WARNING 2: Always do regular test runs of backup and restore – you want to be 100% sure they work when you need them! This is easy if you get an extra harddrive that you can test with.

WARNING 3: I’m not responsible for your data or the correctness of the scripts above. Use the above scripts/commands at your own risk!