From: Josua Dietze <digidietze@draisberghof.de>
To: linux-hotplug@vger.kernel.org
Subject: Environment woes
Date: Mon, 09 Aug 2010 22:37:23 +0000 [thread overview]
Message-ID: <4C608323.5010502@draisberghof.de> (raw)
Hi everyone,
I am in need of a friendly hint regarding a delicate matter ...
I maintain a Linux tool to put USB devices from one mode (or state) to
the other. Many wireless sticks support that "feature", showing up as
a storage device and providing their Windows drivers onboard. To be
used as modems they are switched by these drivers (once they are
installed) to their second mode.
This can be handled in Linux and is properly tested.
Usually there is more than one interface exposed after the mode
switch, but only one is suitable for a wireless connection; binding
the GSM driver ("option") or the generic serial driver will add
multiple ports though (ttyUSB).
Up to now I have used a rule to add a symlink to the "right" port; the
check is done by a script via "PROGRAM". If the port is not right, the
result of the script is empty, thus no symlink:
ACTION="add", KERNEL="ttyUSB*", PROGRAM="<script> %p", SYMLINK="%c"
To handle *only* the device that was switched by my other rules, I
stored the bus and device number during the switching process in a
temporary file which is then used by the <script>. I had tried to work
with ENV first but failed.
You might already guess what I'm going to ask ...
I was reprimanded - and rightly so - for using the temp file, which is
said to be insecure and not working at boot time.
But I am at a loss how I should signal from one enumeration event to
annother without using a file; neither ENV nor IMPORT are working,
probably because the different modes behave like two unrelated
devices, storage and serial. Quite often the USB ID changes with the
mode switch.
Is there really no environment that can be accessed from both
scripts/events?
Or is there a third way maybe?
The order of events is guaranteed in my case ...
Thanks,
Josua Dietze
next reply other threads:[~2010-08-09 22:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-09 22:37 Josua Dietze [this message]
2010-08-10 4:37 ` Environment woes Kay Sievers
2010-08-10 6:28 ` Josua Dietze
2010-08-10 19:30 ` Greg KH
2010-08-10 20:02 ` Josua Dietze
2010-08-10 20:14 ` Greg KH
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=4C608323.5010502@draisberghof.de \
--to=digidietze@draisberghof.de \
--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).