On 10.11.2010 21:06, Oliver Hartkopp wrote:
> On 10.11.2010 20:20, Stephen Hellriegel wrote:
>
>> Our hardware uses the "serial" number field of the USB stack to map to a
>> device position on the board.
>
> (..)
>
>> we have the TTYUSB# and the "Serial" number which allows us to map the
>> serial number to the can# we want the device to show up on.
>
> Ok - got that.
>
>> We run a script that in essence does the following:
>> NUM = can number we want (ie can0...can7)
>> stty swtch $NUM -F /dev/$TTY
>> slcand $TTY
>> sleep 0.5
>> ifconfig can${NUM} up
>>
>> and then our requests can interface is up, and bound to the $TTY port.
Hi Stephen, Robert,
as you can see in the SVN commit for slcan_attach.c
http://svn.berlios.de/wsvn/socketcan?op=comp&compare[]=...@1203&compare[]=...@1204
the rename of the netdevice was indeed *pretty* easy.
To perform your presented use-case you can now run ...
hostname # slcan_attach /dev/ttyS0 -w -n can42
attached tty /dev/ttyS0 to netdevice slcan0
rename netdevice slcan0 to can42 ... ok.
Press any key to detach /dev/ttyS0 ...
with the latest slcan_attach from the BerliOS SVN.
Your script with an /extended/ slcand would look like this then:
slcand $TTY $NUM
sleep 0.5
ifconfig can${NUM} up
:-)
This proves the stty swtch hack to be really superfluous and therefore i'm
going to revert it. For the mainlining i also tend to use 'slcan%d'
netdevice names for the slcan driver that avoids name clashes with already
assigned 'can%d' interfaces and makes renaming easy.
Best regards,
Oliver
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users