SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Linux Discussion related to the SageTV Media Center for Linux. Questions, issues, problems, suggestions, etc. relating to the SageTV Linux should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-05-2007, 04:07 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
DVB Udev rules

I have a couple of HD cards in my linux server. One does OTA, the other QAM. Load order seems to be inconsistent on reboot and I need to do a udev rule for device name. I have tried a couple of things, but nothing seems to work. Does anyone have a working udev rule for pci hd cards that is used to name the DVB devices?

Thanks

B
Reply With Quote
  #2  
Old 10-05-2007, 04:51 AM
ntisdale ntisdale is offline
Sage User
 
Join Date: Dec 2006
Posts: 40
I have the same problem: two DVB-T cards, udev numbering of them is arbitrary at startup. I have not so far tried to fix it (as my linux box hasn't been down for ages) but your post got me thinking and googling. This article seems very helpful http://reactivated.net/writing_udev_rules.html - I'm not at home so I can't try it yet - but it would appear you need to create a udev rule to create symlinks to each card using persistant names and not to try rewriting the default udev rules.

So, for example:

KERNEL=="dvb0", SYMLINK+="MyFirstDigitalCard"

Would look for a device named dvb0 in the kernel and create a symlink to it called MyFirstDigitalCard. The /dev/dvb/adapter* structure would be maintained but a new symlink would exist which always points to dvb0. Now, obviously matching against the kernel name doesn't solve the problem but you can match against a whole host of other device specific things like ID or PLACE (see http://linux.die.net/man/8/udev) which should physically distinguish each card. As I said I'm not at home to play with this but I would guess something like this would work:

KERNEL=="dvb[0-9]*", ID=="devices_id", SYMLINK+="MyFirstDigitalCard"

Placed in a seperate udev file like 10-myudev.rules should ensure it doesn't interfere with the normal rules. I'll give this a go over the weekend and let you know how it goes.

Neil
Reply With Quote
  #3  
Old 10-05-2007, 08:55 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
I was hoping to catch one of the cards before it was named, but that has not worked out. However, I did find this last night:

http://ubuntuforums.org/showpost.php...31&postcount=3

Which is what I will try to do and create symlinks to them called QAM and OTA. Hopefully not an issue for SageTV. I am assuming anything which shows up in /dev/dvb is assumed to be an adapter.

NOTE: This does not work! (Manually created symlinks. They do not show up in source selection screens.) I guess I have to move the devices to somewhere else and link back with adapter1 and adapter0 as described in the post above.

B
Reply With Quote
  #4  
Old 10-05-2007, 11:07 AM
ntisdale ntisdale is offline
Sage User
 
Join Date: Dec 2006
Posts: 40
Right I've had a go and got something working.

First off Sage will only display directories named 'adapterX', where X is a number under the /dev/dvb/ directory.

So the generally approach is to get udev to create a set of symlinks for each adapter named frontend0, dvr0, net0 and demux0 in a directory called 'adapter1X'. So the persistant adapter names will start at adapter10. This has the downside of each adapter appearing twice in sage's source list but it can't be helped without editing 50-udev.rules which is probably best left alone.

Firstly we need some unique identifiers for each adapter. run udevinfo -a -p /sys/class/dvb/dvbX.frontend0 where X is the adapter number. The first part of the output is the important bit:

Code:
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/class/dvb/dvb1.frontend0':
    KERNEL=="dvb1.frontend0"
    SUBSYSTEM=="dvb"
    DRIVER==""
    ATTR{dev}=="212:67"

  looking at parent device '/devices/pci0000:00/0000:00:08.0/0000:01:07.2/usb2/2-1':
    KERNELS=="2-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="4028818714"
    ATTRS{product}=="WinTV Nova-DT"
    ATTRS{manufacturer}=="Hauppauge"
    ATTRS{maxchild}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="2"
    ATTRS{speed}=="480"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="0100"
    ATTRS{idProduct}=="9950"
    ATTRS{idVendor}=="2040"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{bmAttributes}=="80"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
In particular make a note of things that could uniquely describe each card in your setup. In my example I used ATTRS{product} and ATTRS{serial}. Make a note of their values. Note: if your output has SYSFS instead of ATTRS that's fine just substitute SYSFS where ever I use ATTRS.

Next create a file called 57-persistant-misc.rules in /etc/udev/rules.d/ this will be used by udev after the main bulk of the /dev/ dirctory has been populated to create the symlinks.

In this we'll create four rules per adapter, do for the first adapter:

Code:
KERNEL=="dvb[0-9].frontend0", ATTRS{product}=="WinTV Nova-DT", ATTRS{serial}=="4028818714", symlink+="dvb/adapter10/frontend0", GROUP="video"
KERNEL=="dvb[0-9].demux0", ATTRS{product}=="WinTV Nova-DT", ATTRS{serial}=="4028818714", symlink+="dvb/adapter10/demux0", GROUP="video"
KERNEL=="dvb[0-9].net0", ATTRS{product}=="WinTV Nova-DT", ATTRS{serial}=="4028818714", symlink+="dvb/adapter10/net0", GROUP="video"
KERNEL=="dvb[0-9].dvr0", ATTRS{product}=="WinTV Nova-DT", ATTRS{serial}=="4028818714", symlink+="dvb/adapter10/dvr0", GROUP="video"
Repeat this line for each adapter and it's unique information. Save the file. Restart your PC and hopefully you should see a set of new directories called '/dev/dvb/adapter1X' for each adapter with the 4 symlinks pointing to the files in '/dev/dvb/adapterX' directories.

Remember to reconfigure your sources in sage to use the '/dev/dvb/adapter1X'!

Let me know how you get on - I wrote this in rather a rush!
Neil
Reply With Quote
  #5  
Old 10-05-2007, 12:33 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
I'll have to iron this out later, but based on what you said I should target the ATTRS{modalias} as it will be unique to each card even if I put more in later?

B

Code:
bcjenkins@sagetv-server:/dev/dvb$ udevinfo -a -p /class/dvb/dvb0.frontend0

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/class/dvb/dvb0.frontend0':
    KERNEL=="dvb0.frontend0"
    SUBSYSTEM=="dvb"
    DRIVER==""
    ATTR{dev}=="212:3"
    ATTR{uevent}==""

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:05:01.1':
    KERNELS=="0000:05:01.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="bt878"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{modalias}=="pci:v0000109Ed00000878sv000018ACsd0000D500bc04sc80i00"
    ATTRS{local_cpus}=="ff"
    ATTRS{irq}=="22"
    ATTRS{class}=="0x048000"
    ATTRS{subsystem_device}=="0xd500"
    ATTRS{subsystem_vendor}=="0x18ac"
    ATTRS{device}=="0x0878"
    ATTRS{vendor}=="0x109e"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{msi_bus}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{modalias}=="pci:v00008086d0000244Esv00000000sd00000000bc06sc04i01"
    ATTRS{local_cpus}=="ff"
    ATTRS{irq}=="0"
    ATTRS{class}=="0x060401"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{device}=="0x244e"
    ATTRS{vendor}=="0x8086"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{uevent}==""

bcjenkins@sagetv-server:/dev/dvb$ udevinfo -a -p /class/dvb/dvb1.frontend0

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/class/dvb/dvb1.frontend0':
    KERNEL=="dvb1.frontend0"
    SUBSYSTEM=="dvb"
    DRIVER==""
    ATTR{dev}=="212:67"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:05:02.2':
    KERNELS=="0000:05:02.2"
    SUBSYSTEMS=="pci"
    DRIVERS=="cx88-mpeg driver manager"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{modalias}=="pci:v000014F1d00008802sv000018ACsd0000D500bc04sc80i00"
    ATTRS{local_cpus}=="ff"
    ATTRS{irq}=="18"
    ATTRS{class}=="0x048000"
    ATTRS{subsystem_device}=="0xd500"
    ATTRS{subsystem_vendor}=="0x18ac"
    ATTRS{device}=="0x8802"
    ATTRS{vendor}=="0x14f1"

  looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{msi_bus}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{modalias}=="pci:v00008086d0000244Esv00000000sd00000000bc06sc04i01"
    ATTRS{local_cpus}=="ff"
    ATTRS{irq}=="0"
    ATTRS{class}=="0x060401"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{device}=="0x244e"
    ATTRS{vendor}=="0x8086"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{uevent}==""
Reply With Quote
  #6  
Old 10-05-2007, 08:34 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
For posterity and my sanity..

Here's what worked:

Code:
KERNEL=="dvb[0-9].frontend0", ATTRS{modalias}=="pci:v0000109Ed00000878sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter10/frontend0", GROUP="video"
KERNEL=="dvb[0-9].demux0", ATTRS{modalias}=="pci:v0000109Ed00000878sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter10/demux0", GROUP="video"
KERNEL=="dvb[0-9].net0", ATTRS{modalias}=="pci:v0000109Ed00000878sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter10/net0", GROUP="video"
KERNEL=="dvb[0-9].dvr0", ATTRS{modalias}=="pci:v0000109Ed00000878sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter10/dvr0", GROUP="video"

KERNEL=="dvb[0-9].frontend0", ATTRS{modalias}=="pci:v000014F1d00008802sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter11/frontend0", GROUP="video"
KERNEL=="dvb[0-9].demux0", ATTRS{modalias}=="pci:v000014F1d00008802sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter11/demux0", GROUP="video"
KERNEL=="dvb[0-9].net0", ATTRS{modalias}=="pci:v000014F1d00008802sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter11/net0", GROUP="video"
KERNEL=="dvb[0-9].dvr0", ATTRS{modalias}=="pci:v000014F1d00008802sv000018ACsd0000D500bc04sc80i00" , symlink+="dvb/adapter11/dvr0", GROUP="video"
Thanks for the help.

B
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DVB versus U.S.? mohanman General Discussion 9 06-13-2007 09:09 PM
Best DVB for UK? jcoyne Hardware Support 2 04-08-2007 06:12 PM
New DST Rules hmca General Discussion 3 02-27-2007 09:02 PM
Media Extender and Anders' DVB plugin Mahoney SageTV Media Extender 4 03-21-2006 01:19 AM
2 Non-Conflicting Freeview DVB Boxes rickgillyon Hardware Support 0 11-17-2005 08:04 AM


All times are GMT -6. The time now is 02:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.