* Another UDEV question.
@ 2004-03-03 23:28 reg
2004-03-03 23:43 ` Greg KH
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
0 siblings, 2 replies; 7+ messages in thread
From: reg @ 2004-03-03 23:28 UTC (permalink / raw)
To: linux-hotplug
Ive been trying to get several devices working (again) with
udev. Greg pointed me in the right direction on the first,
and I was able to get the second working,- but there is something
here that I dont understand.
On the first, a usb key, the udevinfo showed the device twice,
once as a scsi device, once as a usb. Trying to specify the device
with the 'model' string and the scsi info didnt work, with the
'model' and the 'usb' did. I have no idea WHY the one worked and
not the other.
On the second, a 2-1/2" drive in a small usb 'box' the udevinfo
shows the device again twice, once as
looking at the device chain at '/sys/devices/pci0000:00/0000:00:0d.0/usb3/3-1
/3-1:2.0/host3/3:0:0:0':
BUS="scsi"
ID="3:0:0:0"
SYSFS{detach_state}="0"
SYSFS{type}="0"
SYSFS{max_sectors}="240"
SYSFS{device_blocked}="0"
SYSFS{queue_depth}="1"
SYSFS{scsi_level}="3"
SYSFS{vendor}="IC25N020"
SYSFS{model}="ATCS04-0 "
SYSFS{rev}="CA2O"
SYSFS{online}="1"
and then again as
looking at the device chain at '/sys/devices/pci0000:00/0000:00:0d.0/usb3/3-1
':
BUS="usb"
ID="3-1"
SYSFS{detach_state}="0"
SYSFS{bNumInterfaces}=" 1"
SYSFS{bConfigurationValue}="2"
SYSFS{bmAttributes}="c0"
SYSFS{bMaxPower}=" 98mA"
SYSFS{idVendor}="0c0b"
SYSFS{idProduct}="b001"
SYSFS{bcdDevice}="1110"
SYSFS{bDeviceClass}="00"
SYSFS{bDeviceSubClass}="00"
SYSFS{bDeviceProtocol}="00"
SYSFS{bNumConfigurations}="1"
SYSFS{speed}="12"
SYSFS{manufacturer}="DMI"
SYSFS{product}="USB 2.0 Storage Adaptor"
SYSFS{serial}="0B0201420527B284"
and using the vendor or product fields I can get udev to see EITHER
of these.
Is this just hit or miss?
Is there someone behind the curtain that Im not seeing?
Just trying to understand whats going on.
--
Reg.Clemens
reg@dwf.com
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Another UDEV question.
2004-03-03 23:28 Another UDEV question reg
@ 2004-03-03 23:43 ` Greg KH
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-03-03 23:43 UTC (permalink / raw)
To: linux-hotplug
On Wed, Mar 03, 2004 at 02:16:05PM -0700, reg@dwf.com wrote:
> Ive been trying to get several devices working (again) with
> udev. Greg pointed me in the right direction on the first,
> and I was able to get the second working,- but there is something
> here that I dont understand.
>
> On the first, a usb key, the udevinfo showed the device twice,
> once as a scsi device, once as a usb. Trying to specify the device
> with the 'model' string and the scsi info didnt work, with the
> 'model' and the 'usb' did. I have no idea WHY the one worked and
> not the other.
Hm, I wonder if we are racing the kernel again :(
Can you build udev with:
make clean
make USE_LOG=true DEBUG=true
Then, with the device plugged in, can you run:
./udevtest /block/sda
And send us the output. If that works, and shows us the proper name
(based on the model) then I think our race is here again :(
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
2004-03-03 23:28 Another UDEV question reg
2004-03-03 23:43 ` Greg KH
@ 2004-03-04 1:03 ` Hanna Linder
2004-03-04 3:55 ` Chris Wright
2004-03-04 5:16 ` Jeff Garzik
1 sibling, 2 replies; 7+ messages in thread
From: Hanna Linder @ 2004-03-04 1:03 UTC (permalink / raw)
To: linux-kernel; +Cc: greg, hannal
Here is a small patch to add PPP support to /sys/class.
Please consider for inclusion.
Thanks.
Hanna
----
diff -Nrup -Xdontdiff linux-2.6.3/drivers/net/ppp_generic.c linux-2.6.3p/drivers/net/ppp_generic.c
--- linux-2.6.3/drivers/net/ppp_generic.c 2004-02-17 19:59:31.000000000 -0800
+++ linux-2.6.3p/drivers/net/ppp_generic.c 2004-03-03 15:14:07.000000000 -0800
@@ -45,6 +45,7 @@
#include <linux/smp_lock.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
+#include <linux/device.h>
#include <net/slhc_vj.h>
#include <asm/atomic.h>
@@ -271,6 +272,8 @@ static int ppp_connect_channel(struct ch
static int ppp_disconnect_channel(struct channel *pch);
static void ppp_destroy_channel(struct channel *pch);
+static struct class_simple *ppp_class;
+
/* Translates a PPP protocol number to a NP index (NP == network protocol) */
static inline int proto_to_npindex(int proto)
{
@@ -799,10 +802,14 @@ static int __init ppp_init(void)
printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
if (!err) {
+ ppp_class = class_simple_create(THIS_MODULE, "ppp");
+ class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
- if (err)
+ if (err) {
unregister_chrdev(PPP_MAJOR, "ppp");
+ class_simple_device_remove(MKDEV(PPP_MAJOR,0));
+ }
}
if (err)
@@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void)
if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
printk(KERN_ERR "PPP: failed to unregister PPP device\n");
devfs_remove("ppp");
+ class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
}
/*
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
@ 2004-03-04 3:55 ` Chris Wright
2004-03-05 2:05 ` Hanna Linder
2004-03-11 1:29 ` Greg KH
2004-03-04 5:16 ` Jeff Garzik
1 sibling, 2 replies; 7+ messages in thread
From: Chris Wright @ 2004-03-04 3:55 UTC (permalink / raw)
To: Hanna Linder; +Cc: linux-kernel, greg
* Hanna Linder (hannal@us.ibm.com) wrote:
> + ppp_class = class_simple_create(THIS_MODULE, "ppp");
> + class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
What happens if that class_simple_create() fails? Actually,
class_simple_device_add could fail too, but doesn't seem anybody is
checking for that.
> err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
> S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> - if (err)
> + if (err) {
> unregister_chrdev(PPP_MAJOR, "ppp");
> + class_simple_device_remove(MKDEV(PPP_MAJOR,0));
> + }
need to destroy the class on error path to avoid leak.
> @@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void)
> if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
> printk(KERN_ERR "PPP: failed to unregister PPP device\n");
> devfs_remove("ppp");
> + class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
ditto. this will leak and would cause oops on reload of module.
something like below.
thanks,
-chris
===== drivers/net/ppp_generic.c 1.43 vs edited =====
--- 1.43/drivers/net/ppp_generic.c Wed Feb 18 19:42:37 2004
+++ edited/drivers/net/ppp_generic.c Wed Mar 3 19:08:24 2004
@@ -45,6 +45,7 @@
#include <linux/smp_lock.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
+#include <linux/device.h>
#include <net/slhc_vj.h>
#include <asm/atomic.h>
@@ -271,6 +272,8 @@
static int ppp_disconnect_channel(struct channel *pch);
static void ppp_destroy_channel(struct channel *pch);
+static struct class_simple *ppp_class;
+
/* Translates a PPP protocol number to a NP index (NP == network protocol) */
static inline int proto_to_npindex(int proto)
{
@@ -804,15 +807,29 @@
printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
if (!err) {
+ ppp_class = class_simple_create(THIS_MODULE, "ppp");
+ if (IS_ERR(ppp_class)) {
+ err = PTR_ERR(ppp_class);
+ goto out_chrdev;
+ }
+ class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
if (err)
- unregister_chrdev(PPP_MAJOR, "ppp");
+ goto out_class;
}
+out:
if (err)
printk(KERN_ERR "failed to register PPP device (%d)\n", err);
return err;
+
+out_class:
+ class_simple_device_remove(MKDEV(PPP_MAJOR,0));
+ class_simple_destroy(ppp_class);
+out_chrdev:
+ unregister_chrdev(PPP_MAJOR, "ppp");
+ goto out;
}
/*
@@ -2545,6 +2562,8 @@
if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
printk(KERN_ERR "PPP: failed to unregister PPP device\n");
devfs_remove("ppp");
+ class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
+ class_simple_destroy(ppp_class);
}
/*
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
2004-03-04 3:55 ` Chris Wright
@ 2004-03-04 5:16 ` Jeff Garzik
1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2004-03-04 5:16 UTC (permalink / raw)
To: Hanna Linder; +Cc: linux-kernel, greg
On Wed, Mar 03, 2004 at 05:03:26PM -0800, Hanna Linder wrote:
>
> Here is a small patch to add PPP support to /sys/class.
>
> Please consider for inclusion.
>
> Thanks.
>
> Hanna
> ----
>
> diff -Nrup -Xdontdiff linux-2.6.3/drivers/net/ppp_generic.c
> linux-2.6.3p/drivers/net/ppp_generic.c
> --- linux-2.6.3/drivers/net/ppp_generic.c 2004-02-17
> 19:59:31.000000000 -0800
> +++ linux-2.6.3p/drivers/net/ppp_generic.c 2004-03-03
Please CC the PPP maintainer (paulus) and the network developers
(netdev@oss.sgi.com) when modifying PPP.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
2004-03-04 3:55 ` Chris Wright
@ 2004-03-05 2:05 ` Hanna Linder
2004-03-11 1:29 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Hanna Linder @ 2004-03-05 2:05 UTC (permalink / raw)
To: Chris Wright; +Cc: Hanna Linder, linux-kernel, greg, paulus, netdev
Thanks Chris. Your changes fixed the reload oops I was seeing.
root@w-hlinder2 root]# modprobe ppp_generic
[root@w-hlinder2 root]# tree /sys/class/ppp
/sys/class/ppp
`-- ppp
`-- dev
1 directory, 1 file
[root@w-hlinder2 root]# rmmod ppp_generic
[root@w-hlinder2 root]# tree /sys/class/ppp
/sys/class/ppp [error opening dir]
0 directories, 0 files
[root@w-hlinder2 root]# modprobe ppp_generic
[root@w-hlinder2 root]# tree /sys/class/ppp
/sys/class/ppp
`-- ppp
`-- dev
1 directory, 1 file
Please consider the patch below for inclusion.
Thanks.
--On Wednesday, March 03, 2004 07:55:39 PM -0800 Chris Wright <chrisw@osdl.org> wrote:
>
> something like below.
>
> thanks,
> -chris
>
> ===== drivers/net/ppp_generic.c 1.43 vs edited =====
> --- 1.43/drivers/net/ppp_generic.c Wed Feb 18 19:42:37 2004
> +++ edited/drivers/net/ppp_generic.c Wed Mar 3 19:08:24 2004
> @@ -45,6 +45,7 @@
> #include <linux/smp_lock.h>
> #include <linux/rwsem.h>
> #include <linux/stddef.h>
> +#include <linux/device.h>
> #include <net/slhc_vj.h>
> #include <asm/atomic.h>
>
> @@ -271,6 +272,8 @@
> static int ppp_disconnect_channel(struct channel *pch);
> static void ppp_destroy_channel(struct channel *pch);
>
> +static struct class_simple *ppp_class;
> +
> /* Translates a PPP protocol number to a NP index (NP == network protocol) */
> static inline int proto_to_npindex(int proto)
> {
> @@ -804,15 +807,29 @@
> printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
> err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
> if (!err) {
> + ppp_class = class_simple_create(THIS_MODULE, "ppp");
> + if (IS_ERR(ppp_class)) {
> + err = PTR_ERR(ppp_class);
> + goto out_chrdev;
> + }
> + class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
> err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
> S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> if (err)
> - unregister_chrdev(PPP_MAJOR, "ppp");
> + goto out_class;
> }
>
> +out:
> if (err)
> printk(KERN_ERR "failed to register PPP device (%d)\n", err);
> return err;
> +
> +out_class:
> + class_simple_device_remove(MKDEV(PPP_MAJOR,0));
> + class_simple_destroy(ppp_class);
> +out_chrdev:
> + unregister_chrdev(PPP_MAJOR, "ppp");
> + goto out;
> }
>
> /*
> @@ -2545,6 +2562,8 @@
> if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
> printk(KERN_ERR "PPP: failed to unregister PPP device\n");
> devfs_remove("ppp");
> + class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
> + class_simple_destroy(ppp_class);
> }
>
> /*
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
2004-03-04 3:55 ` Chris Wright
2004-03-05 2:05 ` Hanna Linder
@ 2004-03-11 1:29 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-03-11 1:29 UTC (permalink / raw)
To: Chris Wright; +Cc: Hanna Linder, linux-kernel
On Wed, Mar 03, 2004 at 07:55:39PM -0800, Chris Wright wrote:
> * Hanna Linder (hannal@us.ibm.com) wrote:
> > + ppp_class = class_simple_create(THIS_MODULE, "ppp");
> > + class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
>
> What happens if that class_simple_create() fails? Actually,
> class_simple_device_add could fail too, but doesn't seem anybody is
> checking for that.
>
> > err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
> > S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> > - if (err)
> > + if (err) {
> > unregister_chrdev(PPP_MAJOR, "ppp");
> > + class_simple_device_remove(MKDEV(PPP_MAJOR,0));
> > + }
>
> need to destroy the class on error path to avoid leak.
>
> > @@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void)
> > if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
> > printk(KERN_ERR "PPP: failed to unregister PPP device\n");
> > devfs_remove("ppp");
> > + class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
>
> ditto. this will leak and would cause oops on reload of module.
>
> something like below.
Applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-03-11 1:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-03 23:28 Another UDEV question reg
2004-03-03 23:43 ` Greg KH
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
2004-03-04 3:55 ` Chris Wright
2004-03-05 2:05 ` Hanna Linder
2004-03-11 1:29 ` Greg KH
2004-03-04 5:16 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.