linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dvb and udev and mythtv
@ 2007-11-04  9:17 Stefan Breitegger
  0 siblings, 0 replies; only message in thread
From: Stefan Breitegger @ 2007-11-04  9:17 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2962 bytes --]

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;

[-- Attachment #2: tuxstef.vcf --]
[-- Type: text/x-vcard, Size: 135 bytes --]

begin:vcard
fn:Stefan Breitegger
n:Breitegger;Stefan
email;internet:tuxstef@tuxstef.org
tel;home:0676 315 39 44
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #4: Type: text/plain, Size: 226 bytes --]

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-04  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-04  9:17 dvb and udev and mythtv Stefan Breitegger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).