All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: When does udev info (/sys/...) become available?
Date: Fri, 02 Nov 2007 05:17:41 +0000	[thread overview]
Message-ID: <20071102051741.GA18429@kroah.com> (raw)
In-Reply-To: <200711011814.lA1IEOSO004819@deneb.dwf.com>

On Thu, Nov 01, 2007 at 12:53:28PM -0600, clemens@dwf.com wrote:
> > On 11/1/07, clemens@dwf.com <clemens@dwf.com> wrote:
> > > When does udev populate the /sys file system?
> > > I tried using some info that is there later (when the user has control) during
> > > an init.d startup scripts and the info is not there yet
> > > (and Im not sure how to write the script w/o the information).
> > > I tried a delay (sleep) in the script but that didnt help...
> > 
> > Whenever you mount sysfs to /sys. You need to do this before udev runs
> > since it relies heavily on the information in /sys. You may need to
> > use 'mount -n' if root is read-only at that point and record the mount
> > information later. For example, see the LFS bootscripts:
> > 
> > http://downloads.linuxfromscratch.org/lfs-bootscripts-20070813.tar.bz2
> > 
> > First, /sys and /proc are mounted. Then the /dev tmpfs is mounted and
> > udev* is run. Then /etc/mtab is rewritten to record the /, /proc and
> > /sys mount points and the rest of the mounts are done. The three
> > scripts are mountkernfs, udev and mountfs.
> > 
> > That's not the only way to do it, but it should get you pointed in
> > right direction.
> > 
> OK, let me be more specific.
> I am using the standard Linux boot.
> During the execution of a script in the init.d directory, I try to cat
> information from a file in the /sys directory.  
> I get error messages.
> Here is what I see:
>     ls /sys/class/pps		[ this file exists and I get the ls, which is empty ]

So your class is created now.

>     ls /sys/class/pps/pps0		[ this fails, tho the dir is there at 'user' time ]
>     cat /sys/class/pps/pps0/path	[ this obviously also fails ]

you need to wait until your device shows up.

So don't try to do this in an init script, but do it in a script that
runs when udev sees this device show up.  That's the only way you are
going to properly syncronize something like this.

thanks,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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

      parent reply	other threads:[~2007-11-02  5:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
2007-11-01 18:28 ` Kay Sievers
2007-11-01 18:32 ` Dan Nicholson
2007-11-01 18:47 ` Greg KH
2007-11-01 18:53 ` clemens
2007-11-02  5:17 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071102051741.GA18429@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.