linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moshe Yudkowsky <msha5_17@bl.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: libgphoto2 calls hotplug script with wrong variables
Date: Tue, 06 Dec 2005 04:30:29 +0000	[thread overview]
Message-ID: <439513E5.9080902@bl.com> (raw)
In-Reply-To: <4394CDE7.1070008@bl.com>

Thanks to Marco for his replies. I have a couple of additional question, 
and a question that weren't answered.

>>(1a) I keep on reading on this list that /etc/hotplug is supposed to be 
>>deprecated, and yet here's /etc/hotplug that looks pretty official.
> 
> Blame the people who do not want to stop supporting old-style hotplug
> and 2.4 kernels in Debian. Anyway, this is not important.

/etc/hotplug was a convinient place to put scripts associated with 
hotplug events. Is there a "best practice" location for scripts (e.g., 
RUN scripts or PROGRAM scripts) when using udev?

>>(2) The script libgphoto2 doesn't work. The goal of libgphoto2 is to set 
>>the device created by hotplug (later udev) so that anyone in group 
>>$CAMERA can use it, but that doesn't happen, and here's why.
> 
> The script works fine, but updates the /prob/bus/usb/ file.
> You also need an udev rule to set GROUP for the SUBSYSTEM="usb_device"
> event which creates the /dev/bus/usb/ device.

Well, yes, the script modifies /proc -- which is the wrong file. I 
should have been more precise.

Thanks for the tip on SUBSYTEM  -- I was not aware that this was the 
entity that created the /dev/bus/usb device. That makes it very easy to 
create the correct permissions using group with no need for a script.

For the sake of clarity, I always like to include the complete text of 
the fix if possible, so here it is. The solution is to modify the 
"libgphoto2.rules" file. For the Canon S110, to pick an example, the 
entry should read:

SUBSYSTEM="usb_device", SYSFS{idVendor}="04a9", 
SYSFS{idProduct}="3051",  GROUP="camera"

Note that there's no need for any RUN script to set the group.

Here's the unanswered question and a new question:

* Is there a current list of what's available to the environment of 
scripts? I see that libgphoto2 used $DEVICE, and $DEVICE doesn't seem to 
be mentioned on the udev man page as being in the environment spawned by 
RUN.

* Where can I find, other than by asking on this list or reading through 
the code, information about how other subsystems work with udev and what 
they do? /dev/hotplug.log, for example, contains a lot of nice info, and 
I see that one stanza has the information:

> HOTPLUG_TIME='Mon Dec  5 17:36:47 CST 2005'
> PHYSDEVPATH=/devices/pci0000:00/0000:00:10.1/usb2/2-1
> SUBSYSTEM=usb_device
> OLDPWD=/
> DEVPATH=/class/usb_device/usbdev2.20
> MINOR\x147
> ACTION=remove
> UDEV_LOG=7
> MAJOR\x189
> UDEVD_EVENT=1
> DEVNAME=/dev/bus/usb/002/020
> PHYSDEVDRIVER=usb
> PHYSDEVBUS=usb
> SEQNUM\x1033

Is this the best way to find out which SUBSYSTEM to look for -- by 
finding the SUBSYSTEM stanza that has the DEVNAME attached to it? Yes, I 
realize if I were a guru I'd know this stuff, but it's sure not obvious 
to me. Yet.

Regards,
  Moshe


-- 
  Moshe Yudkowsky
  work: http://www.Disaggregate.com
  book: http://www.PebbleAndAvalanche.com


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&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

  parent reply	other threads:[~2005-12-06  4:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 23:31 libgphoto2 calls hotplug script with wrong variables Moshe Yudkowsky
2005-12-06  0:06 ` Marco d'Itri
2005-12-06  4:30 ` Moshe Yudkowsky [this message]
2005-12-06  8:18 ` Marco d'Itri

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=439513E5.9080902@bl.com \
    --to=msha5_17@bl.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 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).