-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

udev rules need to be made, but there are more than 3 ways to tackle
this. udev can create rules from certain device strings so there could
be rules made for the manufacturer of the device, but they are all the
same. The next choice is to make a rule the devices themselves ignoring
the ports, which would allow you to plug the little boogers in anywhere
and get the correct symlink. This is by a serial number that the device
reports, but not all devices report serials.

Next is your idea of choosing to assign links to ports, which is not a
bad idea, but what if you plug a device other than your phone into a
port that is setup just for your phones...things won't work as they
should. I think its best to get a serial from each phone.

With all 3 devices plugged in do this:
lsusb -v | grep iSerial

It might show something like this:
iSerial                 1 ABCDEFG123
iSerial                 1 BCDEFG1234
iSerial                 1 CDEFG12345

If so then put the lines below in a file named
/etc/udev/rules.d/10-local.rules

# /dev/ttyACM0,
SUBSYSTEMS=="usb", ATTRS{serial}=="ABCDEFG123", KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA0"

# /dev/ttyACM1,
SUBSYSTEMS=="usb", ATTRS{serial}=="BCDEFG1234", KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA1"

# /dev/ttyACM2
SUBSYSTEMS=="usb", ATTRS{serial}=="CDEFG12345", KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA2"


The examples above match 3 conditions, though you could easily get away
with just this :

SUBSYSTEMS=="usb", ATTRS{serial}=="ABCDEFG123", SYMLINK+="ttyNOKIA0"

Next:
/etc/init.d/udev restart

YOU MUST UNPLUG THE DEVICES THEN REINSERT THEM FOR THIS TO WORK

Now go into your program and set it for ttyNOKIA0-2 and you should never
have to worry about this again. Use the custom symlink because it is
bound to the phones serial, whereas udev will still create the
incremented ttyACM* device. You can plug the device in the front, back,
side,usb hub or what ever. There will never be an issue with just those
3 phones.

If you get no iSerials:

Unplug the phones
Run udevmonitor IF it's still available on your Ubuntu system...it
disappeared on Debian so if you don't have it run udevadm --monitor
Now plug them in...one at a time noting the dev file path fore each port.

My laptop port 1 and 2 on Debian look like this:
/devices/pci0000:00/0000:00:1f.2/usb1/1-1/1-1:1.0
/devices/pci0000:00/0000:00:1f.2/usb1/1-2/1-2:1.0

You want the last bit, such as 1-1:1.0
Here are the rules to use if the iSerials don't show:

# /dev/ttyACM0,
SUBSYSTEMS=="usb", ID=="1-1:1.0" KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA0"

# /dev/ttyACM1,
SUBSYSTEMS=="usb", ID=="1-2:1.0", KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA1"

# /dev/ttyACM2
SUBSYSTEMS=="usb", ID=="1-3:1.0", KERNEL=="ttyACM[0123]",
SYMLINK+="ttyNOKIA2"

Replace those ID's with the correct ones on your server, restart udev,
reinsert your devices and you're cooking with grease.


Additional reading:
http://www.reactivated.net/writing_udev_rules.html

man udev...its actually not a bad man page


Bryan

hard wyrd wrote:
| --0016e644d53ce308f70462b73145
| Content-Type: text/plain; charset=ISO-8859-1
|
| http://www.linuxjournal.com/article/7316
|
| Down near the bottom they describe linking a mouse at a particular
location
| on the usb bus to a specific name in the /dev hierarchy. This sounds like
| what you'd like, right?
|
| On Wed, Feb 11, 2009 at 8:23 PM, hard wyrd <[email protected]> wrote:
|
|> After much time wading through the quagmire of web info without much
|> success, I'm now compelled to post a question (how long has it been?)
|>
|> Background:
|>
|> I got a Kannel SMS gateway running on Ubuntu 8.10. Works well (not like a
|> charm, but it works). SMS messages get sent perfectly.
|>
|> Ubuntu 8.10 (Kannel) uses three Nokia 6230 mobile phones, working as
|> virtual SMSCs for Kannel, connected via USB cable. Each phone was
|> dynamically assigned a device file namely /dev/ttyACM0, /dev/ttyACM1,
|> /dev/ttyACM2 respectively.
|>
|> Issue:
|>
|> If a phone (using /dev/ttyACM1) gets turned off, and then back on again,
|> Ubuntu creates another device file for that phone -- /dev/ttyACM3 --
thusly,
|> Kannel will not be able to use that phone.
|>
|> Question:
|>
|> How can I permanently associate a device file (/dev/ttyACM1) to a
specific
|> USB port?
|>
|>
|>
|>
|> Best regards.
|>
|> --
|> Part-time SysAd, full-time Dad, part-time netNinja
|> CNS, ACFE, FOSS Advocate and Consultant
|> Registered Linux User #400165
|> http://baudizm.blogsome.com
|> http://linuxblazon.wordpress.com
|> http://3x-comic.blogspot.com  (NEW!)
|>
|
|

- --
A healthy diet includes Linux, Linux and more Linux.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmUEaMACgkQh+MLjl5SKYQoCwCfcbkvKRRVamcVWeNgSJKRwWfx
8TwAniHmJt4ii4of9mMKB5mhUwB9RNBT
=yYlR
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---

Reply via email to