Skip to contentSkip to conversation

implementing hotplug event

DISCUSSION Jon Smirl 2 participants 4 messages Dec 29, 2003 – Dec 30, 2003

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

My driver can catch $ACTION now. I also added the code to my class driver to make it send out the same info as a PCI hotplug event. Now my userspace app needs to open the newly loaded device driver, how do I reliably find it? I know that it is at /dev/dri/cardX but what if the user is replacing /dev with /udev or /devfs? I know the major/minor I could just mknode in my program too.

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
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 1 line · Jon Smirl

My driver can catch $ACTION now.

You mean your userspace program, right?

Quoted 2 lines

I also added the code to my class driver to make it send out the same info as a PCI hotplug event.

That's good.

Quoted 4 lines

Now my userspace app needs to open the newly loaded device driver, how do I reliably find it? I know that it is at /dev/dri/cardX but what if the user is replacing /dev with /udev or /devfs? I know the major/minor I could just mknode in my program too.

To be safe, you can always just read the sysfs "dev" file, and do a mknod with that information. Otherwise you could query udev as to what it has named your device, but we don't have those hooks in udev just yet... someday soon...

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#2 lore raw
In reply to Jon Smirl
Quoted 9 lines · --- Greg KH
Quoted 4 lines

Now my userspace app needs to open the newly loaded device driver, how do I reliably find it? I know that it is at /dev/dri/cardX but what if the user is replacing /dev with /udev or /devfs? I know the major/minor I could just mknode in my program too.

To be safe, you can always just read the sysfs "dev" file, and do a mknod with that information. Otherwise you could query udev as to what it has named your device, but we don't have those hooks in udev just yet... someday soon...

I just sent the major/minor to the hotplug event in the environment variables, it seemed easier than sending out the slot id and finding "dev" in sysfs. Doing mknod from the user space app seems to be the most reliable scheme.

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
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 Jon Smirl
Quoted 6 lines · Jon Smirl
Quoted 5 lines · --- Greg KH
Quoted 4 lines

Now my userspace app needs to open the newly loaded device driver, how do I reliably find it? I know that it is at /dev/dri/cardX but what if the user is replacing /dev with /udev or /devfs? I know the major/minor I could just mknode in my program too.

Quoted 8 lines
Quoted 4 lines

To be safe, you can always just read the sysfs "dev" file, and do a mknod with that information. Otherwise you could query udev as to what it has named your device, but we don't have those hooks in udev just yet... someday soon...

I just sent the major/minor to the hotplug event in the environment variables, it seemed easier than sending out the slot id and finding "dev" in sysfs. Doing mknod from the user space app seems to be the most reliable scheme.

True, as long as your userapp is running as root :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel