[ltp] Re: can not open /dev/thinkpad

Thomas Hood linux-thinkpad@linux-thinkpad.org
17 Oct 2002 23:42:02 +0200


On Thu, 2002-10-17 at 19:25, Michael Hagemann wrote:
> No, it really tries to open /dev/thinkpad.  It shouldn't.  The whole
> problem is a little tricky...  A program that wants to access a device
> needs to know whether devfs is configured in the kernel, mounted (and
> mounted at the right place).  Unfortunately there are inbetweens, that
> make things difficult.   We, for example, have it configured, but not
> mounted under /dev.
> 
> Now tpctl looks for a file "/dev/.devfs" as a sign for a properly
> installed devfs.

This is just how tpctl decides where to look  
*by default*.  If you have your devfs mounted elsewhere,
you can direct tpctl to it by giving it the --device option.

> thinkpad.o (the module) just checks for devfs to be configured in the 
> kernel.  If it is, thinkpad.o registers a devfs device file 
> "$(devfs_root)/thinkpad/thinkpad".
> 
> This doesn't work, obviously.

It works, so long as either (1) devfs is mounted on /dev, or
(2) tpctl is invoked with --device=/actualdevfsmntpt/thinkpad/thinkpad

What doesn't work (presently) is the case where devfs is
compiled in but not mounted anywhere.

> So at least in this utility suite, we need a consistent setup.  I'm not
> sure yet how this done in the best way.  I'll try to make thinkpad.o
> complain if devfs is configured but not mounted under "/dev".  This
> would have given the both of us the right clue...

That doesn't sound necessary.

The problem is with kernels that have devfs compiled in but
not mounted.
    devfs compiled in + devfs device nodes used  --> works
    devfs not compiled in + traditional nodes used --> works
    devfs compiled in + traditional nodes used --> fails

The solution, I believe, is to cut the devfs-specific code
out of thinkpad.c and just use misc_register().  I didn't
do this before because I didn't want the thinkpad device
files to appear under /dev/misc; however it is now possible
(since devfs 199.13) to specify a different directory.

Thanks to all for their investigative work!
--
Thomas

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com