Skip to contentSkip to conversation

dvb and udev and mythtv

DISCUSSION Stefan Breitegger 1 participant 1 message Nov 4, 2007

lore
Share & tools
lore
#0 lore raw

Hi.

I've seen some post about the random load order of udev and dvb drivers. I'm using mythtv on debian. Has anybody some working udev rules for me?

I've tried to blacklist the modules and then load them with /etc/modules but if they are blacklisted, they aren't loaded if they're in /etc/modules.

For some quick hacking I've written a script:

/usr/local/bin/mythcard.pl

This one is looking into dmesg and sets the capturecard table and sascg-ng correct. Once again: It's a dirty hack.

#!/usr/bin/perl -w

use DBI;

my $database = "mythconverg";
my $hostname = "gw";
my $dsn = "DBI:mysql:database=$database;host=$hostname"; my $user = "mythtv"; my $pass = "mythtv";
my $config_file="/usr/local/bin/runsasc";

my $cardlist=(/bin/dmesg | /bin/grep frontend); my $cardlist_video=(/bin/dmesg | /bin/grep video);

open(CFG, "<$config_file") || die "file not found"; my @cfg_rows = <CFG>;
close(CFG);

sub write_file {
my $cards = shift;
my @new_rows;
foreach(@cfg_rows) {
$_ =~ s/OPTIONS="-j [0-9]:[0-9] --cam-dir "/OPTIONS="-j $cards
--cam-dir "/g;
push(@new_rows,$_);
}
open(CFG, ">$config_file") || die "file not found"; print CFG @new_rows;
close(CFG);
}

my $dbh = DBI::->connect( $dsn, $user, $pass,

         { 'RaiseError' => 1, 'AutoCommit' => 1 } )
         or die DBI::errstr;

my $sql = qq/ UPDATE capturecard SET videodevice = ? WHERE cardid = ? /;

if (index($cardlist,"frontend 0 (DiBcom 3000MC/P)") > 0) {
$cardid=1;
$videodevice=0;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
}
if (index($cardlist,"frontend 0 (Conexant CX24123/CX24109)") > 0) {
$cardid=2;
$videodevice=3;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
write_file("0:3");
}
if (index($cardlist,"frontend 1 (Conexant CX24123/CX24109)") > 0) {
$cardid=2;
$videodevice=3;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
write_file("1:3");
}
if (index($cardlist,"frontend 1 (DiBcom 3000MC/P)") > 0) {
$cardid=1;
$videodevice=1;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
}
if (index($cardlist,"frontend 2 (Conexant CX24123/CX24109)") > 0) {
$cardid=2;
$videodevice=3;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
write_file("2:3");
}
if (index($cardlist,"frontend 2 (DiBcom 3000MC/P)") > 0) {
$cardid=3;
$videodevice=2;
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
}
if (index($cardlist_video,"ivtv0: Registered device video0 for encoder MPG (4096 kB)") > 0) {
$cardid=4;
$videodevice="/dev/video0";
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
}
if (index($cardlist_video,"ivtv0: Registered device video1 for encoder MPG (4096 kB)") > 0) {
$cardid=4;
$videodevice="/dev/video1";
my $sth=$dbh->prepare($sql);
my $out=$sth->execute($videodevice,$cardid);
}

$dbh->disconnect;

begin:vcard
fn:Stefan Breitegger
n:Breitegger;Stefan
email;internet:[email protected]
tel;home:0676 315 39 44
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel