linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Breitegger <tuxstef@tuxstef.org>
To: linux-hotplug@vger.kernel.org
Subject: dvb and udev and mythtv
Date: Sun, 04 Nov 2007 09:17:01 +0000	[thread overview]
Message-ID: <472D8E0D.80109@tuxstef.org> (raw)

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

                 reply	other threads:[~2007-11-04  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472D8E0D.80109@tuxstef.org \
    --to=tuxstef@tuxstef.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).