Coding problem with sysfs
Hi Mailling list.
i have tried to wirte a sysfs patch for the dvb-driver. It seems very nice, but i am _not_ able
to access and work with the devices.
Now i have run some tests:
1. Only register the adapter, the other functions are commented out
vdr root # ls -R /sys/class/dvb/sys/class/dvb:
adapter0
/sys/class/dvb/adapter0:
frontend name
And i can access the infos:
vdr root # cat /sys/class/dvb/adapter0/frontend
STV0299/TSA5059/SL1935 based
vdr root # cat /sys/class/dvb/adapter0/name
KNC1 DVB-S
Looks nice....
2. Enabled full sysfs support
vdr root # ls -R /sys/class/dvb/sys/class/dvb:
adapter0
/sys/class/dvb/adapter0:
demux0 dvr0 frontend frontend0 name net0
/sys/class/dvb/adapter0/demux0:
adap dev
/sys/class/dvb/adapter0/dvr0:
adap dev
/sys/class/dvb/adapter0/frontend0:
adap dev
/sys/class/dvb/adapter0/net0:
adap dev
vdr root # ls -Rl /dev/dvb/dev/dvb:
total 0
drwxr-xr-x 2 root root 0 Jun 1 00:10 adapter0
/dev/dvb/adapter0:
total 0
crw-rw---- 1 root video 250, 7 Jun 1 00:10 adapter0 crw-rw---- 1 root video 250, 4 Jun 1 00:10 demux0 crw-rw---- 1 root video 250, 5 Jun 1 00:10 dvr0 crw-rw---- 1 root video 250, 3 Jun 1 00:10 frontend0 crw-rw---- 1 root video 250, 7 Jun 1 00:10 net0
Ok... /dev/dvb/adapter0/adapter0 shouldn't exist and i have an other problem
vdr root # ls /dev/dvb/adapter0/frontend0 /dev/dvb/adapter0/frontend0
vdr root # cat /dev/dvb/adapter0/frontend0
cat: /dev/dvb/adapter0/frontend0: No such device or address
If i am using devfs i get here:
vdr root # cat /dev/dvb/adapter0/frontend0
cat: /dev/dvb/adapter0/frontend0: invalid arguments
Maybe somebody can help me.
Atteched are the needed sysfs files.
Thanks,
Christian Gmeiner
Quoted 2 lines · Christian Gmeiner
/sys/class/dvb/adapter0:
demux0 dvr0 frontend frontend0 name net0
The 'dev' file needs to be here. That's the problem.
What happens if you run
udevtest /sys/class/dvb/adapter0
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Hi Greg,
Quoted 5 lines · Christian Gmeiner
Quoted 2 lines
/sys/class/dvb/adapter0:
demux0 dvr0 frontend frontend0 name net0The 'dev' file needs to be here. That's the problem.
Oh i forgot something - my fault:
vdr root # ls -Rl /sys/class/dvb/sys/class/dvb:
total 0
drwxr-xr-x 5 root root 0 Jun 5 02:22 adapter0
/sys/class/dvb/adapter0:
total 0
drwxr-xr-x 2 root root 0 Jun 5 02:22 demux0 drwxr-xr-x 2 root root 0 Jun 5 02:22 dvr0 -r--r--r-- 1 root root 4096 Jun 5 02:22 frontend -r--r--r-- 1 root root 4096 Jun 5 02:22 name drwxr-xr-x 2 root root 0 Jun 5 02:22 net0
/sys/class/dvb/adapter0/demux0:
total 0
-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
/sys/class/dvb/adapter0/dvr0:
total 0
-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
/sys/class/dvb/adapter0/net0:
total 0
-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
Frontend is missing, but thats, because i switched to new cvs, wicht seams to have some problems with
my frontend.
Quoted 3 lines
What happens if you run
udevtest/sys/class/dvb/adapter0
vdr root # udevtest /sys/class/dvb/adapter0
version 025
looking at '/class/dvb/adapter0'
configured rule in '/etc/udev/rules.d//10-myrule.rules' at line 2 applied,
'adapter0' becomes 'dvb/adapter%n/%k'
creating device node '/dev/dvb/adapter0/adapter0', major = '250', minor '7', mode = '020660', uid = '0', gid = '27'
Quoted 1 line
This is my udev rule:
# dvb devices
SYSFS{adap}="adapter[0-9]*", NAME="dvb/adapter%n/%k"And this is the result in /dev:
vdr root # ls -Rl /dev/dvb/dev/dvb:
total 0
drwxr-xr-x 2 root root 0 Jun 5 02:22 adapter0
/dev/dvb/adapter0:
total 0
crw-rw---- 1 root video 250, 7 Jun 5 02:22 adapter0 crw-rw---- 1 root video 250, 4 Jun 5 02:22 demux0 crw-rw---- 1 root video 250, 5 Jun 5 02:22 dvr0 crw-rw---- 1 root video 250, 7 Jun 5 02:22 net0
And here is the problem:
vdr root # ls /dev/dvb/adapter0/demux0 /dev/dvb/adapter0/demux0
vdr root # cat /dev/dvb/adapter0/demux0
cat: /dev/dvb/adapter0/demux0: No such device or address
with devfs:
cat /dev/dvb/adapter0/demux0 -> invaild argument
So i can not work/access the device via sysfs :(
Thanks,
Christian
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 35 lines · Christian Gmeiner
Hi Greg,
Quoted 5 lines · Christian Gmeiner
Quoted 2 lines
/sys/class/dvb/adapter0:
demux0 dvr0 frontend frontend0 name net0The 'dev' file needs to be here. That's the problem.
Oh i forgot something - my fault:
vdr root # ls -Rl
/sys/class/dvb/sys/class/dvb:
total 0
drwxr-xr-x 5 root root 0 Jun 5 02:22 adapter0
/sys/class/dvb/adapter0:
total 0drwxr-xr-x 2 root root 0 Jun 5 02:22 demux0 drwxr-xr-x 2 root root 0 Jun 5 02:22 dvr0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 frontend -r--r--r-- 1 root root 4096 Jun 5 02:22 namedrwxr-xr-x 2 root root 0 Jun 5 02:22 net0
/sys/class/dvb/adapter0/demux0:
total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
/sys/class/dvb/adapter0/dvr0:
total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
/sys/class/dvb/adapter0/net0:
total 0
Review
Quoted 2 lines
(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
Hm, how about using 'tree' instead, it's much easier to show the heirchey with it :)
Anyway, how are you putting struct class_device structures into such a tree? We don't currently allow parents of them in the kernel. Are you using basic kobjects here?
What hotplug events get generated when you create your "demux0" and others devices?
The solution is for you to put everything under the /sys/class/dvb/ directory, and not go one level deeper.
Care to post your code?
Quoted 9 lines
Quoted 2 lines
What happens if you run
udevtest/sys/class/dvb/adapter0vdr root # udevtest
/sys/class/dvb/adapter0
version 025
looking at '/class/dvb/adapter0'
configured rule in '/etc/udev/rules.d//10-myrule.rules' at line 2 applied,
'adapter0' becomes 'dvb/adapter%n/%k'
creating device node '/dev/dvb/adapter0/adapter0', major = '250', minor > '7', mode = '020660', uid = '0', gid = '27'
Ok, so that works :)
Quoted 21 lines
Quoted 1 line
This is my udev rule:
# dvb devices SYSFS{adap}="adapter[0-9]*", NAME="dvb/adapter%n/%k"And this is the result in /dev:
vdr root # ls -Rl
/dev/dvb/dev/dvb:
total 0
drwxr-xr-x 2 root root 0 Jun 5 02:22 adapter0
/dev/dvb/adapter0:
total 0crw-rw---- 1 root video 250, 7 Jun 5 02:22 adapter0 crw-rw---- 1 root video 250, 4 Jun 5 02:22 demux0 crw-rw---- 1 root video 250, 5 Jun 5 02:22 dvr0 crw-rw---- 1 root video 250, 7 Jun 5 02:22 net0
Quoted 5 lines
And here is the problem:
vdr root # ls/dev/dvb/adapter0/demux0/dev/dvb/adapter0/demux0
vdr root # cat/dev/dvb/adapter0/demux0
cat:/dev/dvb/adapter0/demux0: No such device or address
Ok, that's your kernel driver problem, not a udev issue :)
Are you sure 250:4 is the proper major:minor assigned to your kernel object?
Again, code would help here.
Good luck,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Christian Gmeiner
AppliedHi Greg,
Quoted 33 lines · Christian Gmeiner
Quoted 32 lines
Hi Greg,
Quoted 5 lines · Christian Gmeiner
Quoted 2 lines
/sys/class/dvb/adapter0:
demux0 dvr0 frontend frontend0 name net0The 'dev' file needs to be here. That's the problem.
Oh i forgot something - my fault:
vdr root # ls -Rl
/sys/class/dvb/sys/class/dvb:
total 0
drwxr-xr-x 5 root root 0 Jun 5 02:22 adapter0
/sys/class/dvb/adapter0:
total 0drwxr-xr-x 2 root root 0 Jun 5 02:22 demux0 drwxr-xr-x 2 root root 0 Jun 5 02:22 dvr0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 frontend -r--r--r-- 1 root root 4096 Jun 5 02:22 namedrwxr-xr-x 2 root root 0 Jun 5 02:22 net0
/sys/class/dvb/adapter0/demux0:
total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
/sys/class/dvb/adapter0/dvr0:
total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 dev
Quoted 8 lines
Review
Quoted 5 lines
/sys/class/dvb/adapter0/net0:
total 0(quoted diff) +0
-2-r--r--r-- 1 root root 4096 Jun 5 02:22 adap -r--r--r-- 1 root root 4096 Jun 5 02:22 devHm, how about using 'tree' instead, it's much easier to show the heirchey with it :)
Sure, but i also want to show as much as possible infos (owner, group,..).
Quoted 4 lines
Anyway, how are you putting struct
class_devicestructures into such a tree? We don't currently allow parents of them in the kernel. Are you using basic kobjects here?
Yep i am using kobjects to this. I need this structure, because there can be more than
one adapter.
At the moment i able to get some infos like:
vdr root # cat /sys/class/dvb/adapter0/name
KNC1 DVB-S
vdr root # cat /sys/class/dvb/adapter0/frontend STV0299/TSA5059/SL1935 based
Quoted 3 lines
What hotplug events get generated when you create your "demux0" and others devices?
How can i check the hotplug events? I have here an PCI-DVB card.
Quoted 4 lines
The solution is for you to put everything under the
/sys/class/dvb/directory, and not go one level deeper.Care to post your code?
I have postes some the whole source in my first mail for this topic, but i will send it again.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
What happens if you run
udevtest/sys/class/dvb/adapter0vdr root # udevtest
/sys/class/dvb/adapter0
version 025
looking at '/class/dvb/adapter0'
configured rule in '/etc/udev/rules.d//10-myrule.rules' at line 2
applied,
Quoted 2 lines
Quoted 2 lines
'adapter0' becomes 'dvb/adapter%n/%k'
creating device node '/dev/dvb/adapter0/adapter0', major = '250', minor
=
Quoted 25 lines
Quoted 1 line
'7', mode = '020660', uid = '0', gid = '27'
Ok, so that works :)
Quoted 21 lines
Quoted 1 line
This is my udev rule:
# dvb devices SYSFS{adap}="adapter[0-9]*", NAME="dvb/adapter%n/%k"And this is the result in /dev:
vdr root # ls -Rl
/dev/dvb/dev/dvb:
total 0
drwxr-xr-x 2 root root 0 Jun 5 02:22 adapter0
/dev/dvb/adapter0:
total 0crw-rw---- 1 root video 250, 7 Jun 5 02:22 adapter0 crw-rw---- 1 root video 250, 4 Jun 5 02:22 demux0 crw-rw---- 1 root video 250, 5 Jun 5 02:22 dvr0 crw-rw---- 1 root video 250, 7 Jun 5 02:22 net0
Quoted 7 lines
Quoted 5 lines
And here is the problem:
vdr root # ls/dev/dvb/adapter0/demux0/dev/dvb/adapter0/demux0
vdr root # cat/dev/dvb/adapter0/demux0
cat:/dev/dvb/adapter0/demux0: No such device or addressOk, that's your kernel driver problem, not a udev issue :)
Sure? I have taken the devfs code, wrote an abstract interface for it and added
sysfs support, based on the devfs code.
Quoted 3 lines
Are you sure 250:4 is the proper major:minor assigned to your kernel object?
I hope, i will ask the dvb maillinglist.
Quoted 2 lines
Again, code would help here.
Is attached!
Thanks,
Christian
Quoted 11 lines · Christian Gmeiner
Quoted 4 lines
Anyway, how are you putting struct
class_devicestructures into such a tree? We don't currently allow parents of them in the kernel. Are you using basic kobjects here?Yep i am using kobjects to this. I need this structure, because there can be more than one adapter.
At the moment i able to get some infos like:
vdr root # cat/sys/class/dvb/adapter0/name
KNC1 DVB-S
vdr root # cat/sys/class/dvb/adapter0/frontendSTV0299/TSA5059/SL1935 based
That's fine. It's the subdirectories underneath the /sys/class/dvb/adapter0/ directory that will not work.
You are attaching class_device structures by messing with the kobject parent pointer. Sorry, but we don't support that just yet in the driver model. Stick with a 1 level deep directory for device that have a "dev" file, or send in patches to the driver core :)
Quoted 3 lines
Quoted 2 lines
What hotplug events get generated when you create your "demux0" and others devices?
How can i check the hotplug events? I have here an PCI-DVB card.
Enable DEBUG for the lib/kobject.c file. That will spit out the hotplug events to the syslog debug file.
Make sure when your device is added (modprobed or whatever) the hotplug event is getting generated. If so, udev should pick it up if it is installed properly.
Good luck.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel