* Re: udev rule for custom driver
2006-12-19 0:41 udev rule for custom driver Justin Clacherty
@ 2006-12-19 0:53 ` Alex Merry
2006-12-19 1:19 ` Justin Clacherty
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alex Merry @ 2006-12-19 0:53 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1: Type: text/plain, Size: 1526 bytes --]
On Tuesday 19 December 2006 00:41, Justin Clacherty wrote:
> Hi,
>
> I've been trying to get a udev rule to automatically create the /dev
> entries for the custom spi driver I've written for my board but am
> having no luck. I've created the file /etc/udev/rules.d/10-spi.rules
> which contains the following line:
>
> SUBSYSTEM=="spi", SYSFS{modalias}=="nexus_spi", NAME="nspi%n"
[snip]
> Running udevinfo on /devices/platform/pxa2xx-spi.1/spi1.0 gives:
>
> looking at device '/devices/platform/pxa2xx-spi.1/spi1.0':
> KERNEL=="spi1.0"
> SUBSYSTEM=="spi"
> SYSFS{modalias}=="nexus_spi"
The original kernel name is spi1.0. Do you get /dev/spi1.0 created
already (ie: even without the rule)? If not, I don't think your rule
will help at all - udev doesn't think there's device to create, so
simply renaming it to nspi won't do anything. In the absence of a
matching rule, udev will still create the device, but with the default
name and some default permissions.
I don't know much about registering devices in the kernel, but there's
some doc in the kernel, and no doubt Kay or Greg will be able to give
your more helpful advice if this is the problem. One other thing to
check, though, is whether /sys/devices/platform/pxa2xx-spi.1/spi1.0/dev
exists (it should have a major:minor pair to tell udev how to create
the device).
Alex :-)
--
Pippin
Computer Monkey to the Pelican
www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk
0870 120 0870, ext 26669
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
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] 5+ messages in thread* Re: udev rule for custom driver
2006-12-19 0:41 udev rule for custom driver Justin Clacherty
2006-12-19 0:53 ` Alex Merry
@ 2006-12-19 1:19 ` Justin Clacherty
2006-12-19 3:33 ` Justin Clacherty
2006-12-19 7:31 ` Kay Sievers
3 siblings, 0 replies; 5+ messages in thread
From: Justin Clacherty @ 2006-12-19 1:19 UTC (permalink / raw)
To: linux-hotplug
Thanks Alex.
Alex Merry wrote:
> The original kernel name is spi1.0. Do you get /dev/spi1.0 created already (ie: even without the rule)?
I thought it should automagically create /dev/spi1.0 but it doesn't.
> One other thing to check, though, is whether /sys/devices/platform/pxa2xx-spi.1/spi1.0/dev exists (it should have a major:minor pair to tell udev how to create the device).
>
No, this doesn't exist, I guess that's the problem. I can manually
create the node and it works fine but if the major number changes (it's
dynamic) then I'll have some problems - thus udev. Looks like it's time
to find out how to create the dev entry in /sys. If anyone can help by
pointing me to appropriate documents or code that'd be great.
Justin.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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] 5+ messages in thread
* Re: udev rule for custom driver
2006-12-19 0:41 udev rule for custom driver Justin Clacherty
2006-12-19 0:53 ` Alex Merry
2006-12-19 1:19 ` Justin Clacherty
@ 2006-12-19 3:33 ` Justin Clacherty
2006-12-19 7:31 ` Kay Sievers
3 siblings, 0 replies; 5+ messages in thread
From: Justin Clacherty @ 2006-12-19 3:33 UTC (permalink / raw)
To: linux-hotplug
Justin Clacherty wrote:
>
>
> No, this doesn't exist, I guess that's the problem. I can manually
> create the node and it works fine but if the major number changes (it's
> dynamic) then I'll have some problems - thus udev. Looks like it's time
> to find out how to create the dev entry in /sys. If anyone can help by
> pointing me to appropriate documents or code that'd be great.
>
It looks like all you need to do is create a new class in the module
initialisation, then create new device classes for each device that is
probed. Once that is done the sys entries are created and udev is happy.
Justin.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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] 5+ messages in thread
* Re: udev rule for custom driver
2006-12-19 0:41 udev rule for custom driver Justin Clacherty
` (2 preceding siblings ...)
2006-12-19 3:33 ` Justin Clacherty
@ 2006-12-19 7:31 ` Kay Sievers
3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2006-12-19 7:31 UTC (permalink / raw)
To: linux-hotplug
On 12/19/06, Justin Clacherty <justin@redfish-group.com> wrote:
> Alex Merry wrote:
> > The original kernel name is spi1.0. Do you get /dev/spi1.0 created already (ie: even without the rule)?
>
> I thought it should automagically create /dev/spi1.0 but it doesn't.
>
> > One other thing to check, though, is whether /sys/devices/platform/pxa2xx-spi.1/spi1.0/dev exists (it should have a major:minor pair to tell udev how to create the device).
> >
>
> No, this doesn't exist, I guess that's the problem. I can manually
> create the node and it works fine but if the major number changes (it's
> dynamic) then I'll have some problems - thus udev. Looks like it's time
> to find out how to create the dev entry in /sys. If anyone can help by
> pointing me to appropriate documents or code that'd be great.
Set the dev_t value in "struct device" in your driver's devices,
otherwise udev doesn't know the major/minor and can't create any
device file. Doing this will automatically add the needed
MAJOR=/MINOR= to the event-environment and create the "dev" file in
sysfs.
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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] 5+ messages in thread