Re: [Owfs-developers] Problem starting owserver on a LinkUSB with option ftdi addressing without sudo

2017-08-10 Thread Eloy Paris
Hi Martin,

On Thu, Aug 10, 2017 at 03:22:19PM +0200, Martin Patzak (GMX) wrote:

[...]

> Only so much, the working rule now looks like (at the moment, might change
> soon ;-) ):
> 
> SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="FTDI",
> ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A800bXHr", GROUP="owsrv",
> MODE="0664"
> 
> This rule results in a node residing in /dev/bus/usb// which is read
> and writeable by the group owsrv , in my case it looks at the moment like
> 
> /ls -al /dev/bus/usb/003///
> //...//
> //crw-rw-r-- 1 root owsrv 189, 261 Aug 10 15:07 006/
> 
> owserver then accessess this node without sudo, in ftdi addressing scheme to
> use direct communication.
> 
> 
> BUT more good news, and contrary to my previous statement: "One 'S' too
> little can make or brake the rule...", it DOES work without all the S's too!
> 
> SUBSYSTEM=="usb", DRIVER=="usb", ATTR{manufacturer}=="FTDI",
> ATTR{product}=="FT232R USB UART", ATTR{serial}=="A800bXHr", GROUP="owsrv",
> MODE="0664"

A small enhancement that you can add and use is to have udevd create
a predictable symlink for the device. This way if you plug in more
USB devices, or plug things in a different order so they get assigned
the same /dev/ node that your LinkUSB currently has, your owserver or
whatever programs use your LinkUSB will still be able to find it.

As an example, here's what I have on my
/etc/udev/rules.d/50-local-usb-serial.rules file:

--
#
# From 
http://marc.merlins.org/perso/linuxha/2010-06.html#Dealing-with-many-USB-to-Serial-Port-Converters-on-linux-and-device-naming
#
# After making a change 'udevadm trigger' will update symlinks.
#

# http://www.reactivated.net/writing_udev_rules.html#udevinfo
# was udevinfo -a -p /class/tty/ttyUSB0
# now udevadm info --attribute-walk -p /class/tty/ttyUSB0
# (used to determine product ID, serial number, etc. to be used
# in the declarations below)

SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", 
ATTRS{serial}=="A5008b6u", SYMLINK+="plm"
SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", 
ATTRS{serial}=="A400bXjP", SYMLINK+="1wire-master0"
SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", 
ATTRS{serial}=="A800eIPR", SYMLINK+="1wire-master1"
SUBSYSTEMS=="usb", ATTRS{product}=="FT231X USB UART", 
ATTRS{serial}=="DC00HJ03", SYMLINK+="moteino-usb"
--

These rules will create the symlinks /dev/plm, /dev/1wire-master0,
/dev/1wire-master1, and /dev/moteino-usb for the FTDI serial-to-USB
chips with those serial numbers. Applications (like owserver) then
use the symlinks instead of the actual /dev/bus/usb// path. For
example, my /etc/owfs.conf contains this:

server: device = /dev/1wire-master0

Cheers,

Eloy Paris.-


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Problem starting owserver on a LinkUSB with option ftdi addressing without sudo

2017-08-10 Thread Martin Patzak (GMX)



On 09.08.2017 22:14, Matthias Urlichs via Owfs-developers wrote:

Hello,

(b) with an additional DRIVER=="USB" condition.


This is nonsense; the "USB" needs to be lowercase and the field is named
DRIVERS. Sorry about that.


Good news everyone, it works! Marvelous, special thanks to Matthias and 
to Johan to solve this issue :-)


Only so much, the working rule now looks like (at the moment, might 
change soon ;-) ):


SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="FTDI", 
ATTRS{product}=="FT232R USB UART", ATTRS{serial}=="A800bXHr", 
GROUP="owsrv", MODE="0664"


This rule results in a node residing in /dev/bus/usb// which is 
read and writeable by the group owsrv , in my case it looks at the 
moment like


/ls -al /dev/bus/usb/003///
//...//
//crw-rw-r-- 1 root owsrv 189, 261 Aug 10 15:07 006/

owserver then accessess this node without sudo, in ftdi addressing 
scheme to use direct communication.



BUT more good news, and contrary to my previous statement: "One 'S' too 
little can make or brake the rule...", it DOES work without all the S's too!


SUBSYSTEM=="usb", DRIVER=="usb", ATTR{manufacturer}=="FTDI", 
ATTR{product}=="FT232R USB UART", ATTR{serial}=="A800bXHr", 
GROUP="owsrv", MODE="0664"


The answer for the confusion (on the net) is, that parent devices share 
attributes, that get the key ATTRS  - I will show this in a different 
post in the future.


Again thanks guys, for your help! But, this isn't over ;-)

Martin


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers