Skip to contentSkip to conversation

Question on how to get custom kernel module to work with udev

DISCUSSION Terry Barnaby 3 participants 9 messages Jun 3, 2005 – Jun 4, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I have a custom kernel device driver module for a PCI hardware device that I would like to integrate with UDEV to get UDEV to generate the /dev nodes.

I am using Fedora Core 3.
I have not been able to make this work so far, so any ideas ?

When the device is loaded /sbin/hotplug is called with the environment:

export SUBSYSTEM=drivers
export DEVPATH=/bus/pci/drivers/admxrc2
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export ACTION­d
export PWD=/
export SHLVL=1
export HOME=/
export SEQNUMx5
export _=/bin/env

I have added a file /etc/udev/rules.d/40-admxrc.rules with the contents:

KERNEL="admxrc2", NAME="admxrcii%k"
SYSFS{vendor}="0x4144", NAME="admxrciii%k"

The two line are alternate versions for testing.

I have tried setting the udev config parameter "udev_log" to "yes" and do get logs when other drivers are loaded. However when I do a "rmmod admxrc2; modprobe admxrc2" no log information is printed.

1. Is there a way to get more debug information out of udev ?
2. Is there some special thing I need to do in the device module ?
3. Is there something wround with the configuration ?

Cheers

Terry

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 41 lines · Terry Barnaby

Hi,

I have a custom kernel device driver module for a PCI hardware device that I would like
to integrate with UDEV to get UDEV to generate the /dev nodes.

I am using Fedora Core 3.
I have not been able to make this work so far, so any ideas ?

When the device is loaded /sbin/hotplug is called with the environment:

export SUBSYSTEM=drivers
export DEVPATH=/bus/pci/drivers/admxrc2
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export ACTION­d
export PWD=/
export SHLVL=1
export HOME=/
export SEQNUMx5
export _=/bin/env

I have added a file /etc/udev/rules.d/40-admxrc.rules with the contents:

KERNEL="admxrc2", NAME="admxrcii%k"
SYSFS{vendor}="0x4144", NAME="admxrciii%k"

The two line are alternate versions for testing.

I have tried setting the udev config parameter "udev_log" to "yes" and do get logs when other drivers are loaded. However when I do a "rmmod admxrc2; modprobe admxrc2" no log information is printed.

1. Is there a way to get more debug information out of udev ?
2. Is there some special thing I need to do in the device module ?
3. Is there something wround with the configuration ?

Cheers

Terry

Quoted 9 lines

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

Some more information on this:

I have enabled debugiing in the udev sources and now see an error displayed in the /var/log/messages file:

Jun  3 14:31:07 beam1 udev[15275]: main: looking at '/bus/pci/drivers/admxrc2'
Jun  3 14:31:07 beam1 udev[15275]: main: not a block or class device

This seems to sugest that I need to do something specific in the device driver module to get udev to work ???

Terry

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Terry Barnaby
Quoted 5 lines · Terry Barnaby

Hi,

I have a custom kernel device driver module for a PCI hardware device that I would like
to integrate with UDEV to get UDEV to generate the /dev nodes.

Is the source of the driver available?

Kay

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Terry Barnaby
Quoted 14 lines · Kay Sievers
Quoted 5 lines · Terry Barnaby

Hi,

I have a custom kernel device driver module for a PCI hardware device that I would like
to integrate with UDEV to get UDEV to generate the /dev nodes.

Is the source of the driver available?

Kay

Quoted 9 lines

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

Hi Kay,

Thanks for the response.
Yes, the source code is available, and I have expierience in writing Linux device drivers, but I have not been able to find any information on what a device driver needs to do to get udev to work.
Does it need to override the default set up of sysfs ?

Terry

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Terry Barnaby
Quoted 5 lines · Terry Barnaby

Yes, the source code is available, and I have expierience in writing Linux device drivers, but I have not been able to find any information on what a device driver needs to do to get udev to work.
Does it need to override the default set up of sysfs ?

No, you need to provide the major/minor of your device through sysfs. Examples of how to do this are in the Linux Device Drivers book, third edition, Chapter 14. It's online for free if you don't want to buy it at:

	http://lwn.net/Kernel/LDD3/

If you have further questions after reading that, let us know.

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Terry Barnaby
Quoted 10 lines · Greg KH
Quoted 5 lines · Terry Barnaby

Yes, the source code is available, and I have expierience in writing Linux device drivers, but I have not been able to find any information on what a device driver needs to do to get udev to work.
Does it need to override the default set up of sysfs ?

No, you need to provide the major/minor of your device through sysfs. Examples of how to do this are in the Linux Device Drivers book, third edition, Chapter 14.

Page 404 is what you want to look at, to be specific.

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Terry Barnaby

Hi Greg,

Thanks very much for this, this looks exactly the
information I need.

Maybe a link to this information for device driver writers would be useful on the main udev.html page ?

Cheers

Terry

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to Terry Barnaby
Quoted 3 lines · Terry Barnaby

Maybe a link to this information for device driver writers would be useful on the main udev.html page ?

What, don't all device driver writers already have a copy of this book? :)

Yeah, it's also been described in the archives of this list and lkml a few times too, but sure if you have a suggested change to the .html file, I'll consider it.

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to Terry Barnaby
Quoted 18 lines · Greg KH
Quoted 2 lines · Terry Barnaby

Maybe a link to this information for device driver writers would be useful on the main udev.html page ?

What, don't all device driver writers already have a copy of this book? :)

Yeah, it's also been described in the archives of this list and lkml a few times too, but sure if you have a suggested change to the .html file, I'll consider it.

thanks,

greg k-h

Quoted 9 lines

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

All my device driver info and that I could find on the net was out of date.
A suggested change to the udev.html file is:
In the "Documentation Section" a link to "http://lwn.net/Kernel/LDD3/" with text: "Udev information for kernel device driver writers is in the Linux Device Drivers, Third Edition book".

Terry

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel