linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sysfs & udev & multi-BUS device driver
@ 2006-08-07 20:51 Klaus Hitschler
  2006-08-07 21:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Klaus Hitschler @ 2006-08-07 20:51 UTC (permalink / raw)
  To: linux-hotplug

Hi,

I'm maintaining a device driver for CAN-BUS interfaces since kernel version 
2.2.x (Controller Area Network - a BUS for automotive use) .  Since that time 
I implemented all that nice kernel features which were coming and going. 
(http://www.peak-system.com/linux)

The driver now comprises support for ISA/PCI/USB/PCMCIA/Parallelport devices. 
All support is done inside the same driver (I know It would be better to 
partion it :-))

Now I plan to add support for udev and sysfs. 

There's one feature I'd like to retain. The current users do know PCI devices 
as /dev/pcan0 to /dev/pcan7, ISA devices as /dev/pcan8 to /dev/pcan15, ..., 
USB devices as /dev/pcan32 to /dev/pcan39, and from /dev/pcan40 start PCMCIA 
based devices.

With udev rules it should be easy to create device nodes with the same 
numbering scheme. But how can I influence the 'kernel name' inside the driver 
so I know that my internal  'minor' 32 matches to /dev/pcan32 ?

Can you link me to some infos that I can fill this mind gap between udev in 
user space and device registration inside a driver.

Do you detect problems if I register the driver multilpe times for each BUS 
ist is associated to?

Regards, Klaus

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
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] 2+ messages in thread

* Re: sysfs & udev & multi-BUS device driver
  2006-08-07 20:51 sysfs & udev & multi-BUS device driver Klaus Hitschler
@ 2006-08-07 21:32 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2006-08-07 21:32 UTC (permalink / raw)
  To: linux-hotplug

On Mon, Aug 07, 2006 at 10:51:10PM +0200, Klaus Hitschler wrote:
> Hi,
> 
> I'm maintaining a device driver for CAN-BUS interfaces since kernel version 
> 2.2.x (Controller Area Network - a BUS for automotive use) .  Since that time 
> I implemented all that nice kernel features which were coming and going. 
> (http://www.peak-system.com/linux)
> 
> The driver now comprises support for ISA/PCI/USB/PCMCIA/Parallelport devices. 
> All support is done inside the same driver (I know It would be better to 
> partion it :-))

Hm, you do realize that your USB driver isn't going to work in the near
future due to the closed license of your code?  That's not very nice :(

Any reasons you can't release all of it under the GPL?  It only looks to
be a very small amount of code, which should be pretty trivial to
reverse engineer (and it looks like you might have a bug in it...)

> Now I plan to add support for udev and sysfs. 

You can't use sysfs support in non-GPL code, so you're probably going to
have to figure out how to fix your USB driver code first.

> There's one feature I'd like to retain. The current users do know PCI devices 
> as /dev/pcan0 to /dev/pcan7, ISA devices as /dev/pcan8 to /dev/pcan15, ..., 
> USB devices as /dev/pcan32 to /dev/pcan39, and from /dev/pcan40 start PCMCIA 
> based devices.
> 
> With udev rules it should be easy to create device nodes with the same 
> numbering scheme. But how can I influence the 'kernel name' inside the driver 
> so I know that my internal  'minor' 32 matches to /dev/pcan32 ?

That's up to your code, it's the one that is going to generate the minor
numbers and the names that udev gets from the kernel.  Just make sure to
match them up properly.

> Can you link me to some infos that I can fill this mind gap between udev in 
> user space and device registration inside a driver.

Use the device_register() code (or class_device_register() on older
kernels).  It will create the proper sysfs stuff, and udev will pick up
on it automatically (as long as you provide the dev_t to those
functions.)

> Do you detect problems if I register the driver multilpe times for each BUS 
> ist is associated to?

I don't know, it depends on how your code interacts with this.  There is
no default ISA or PCI major number to mess with, and as long as you
don't use the USB major number, it's all up to you to create these
things.

good luck,

greg k-h

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2006-08-07 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-07 20:51 sysfs & udev & multi-BUS device driver Klaus Hitschler
2006-08-07 21:32 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).