Skip to content

Conversation

csanchezdll
Copy link

Summary

There are cases where one might want to present a "bus" (on the socketcand protocol side) which is different from the kernel CAN interface name. For example, making a remote system talk to the socketcand port the same way regardless of the USB2Can adapter on the host.
We have found such a case in a test system we are developing so we have developed this and are contributing it in case it is iseful for someone else.

Usage

The -i parameter flag has been augmented, in a backwards compatible way, so now it can include a "bus name" after an equal sign, for every interface. If the "bus name" is not give, then it is equal the the interface name, to keep the current behavior.

Example

No renaming:

[Terminal 1, launch socketcand]
$ ./socketcand -l lo -i vcan0
[Terminal 2, check the beacon]
$ nc -u -l 127.255.255.255 42000
<CANBeacon name="CSANC01-DEV-05" type="SocketCAN" description="socketcand">
<URL>can://127.0.0.1:29536</URL><Bus name="vcan0"/></CANBeacon>
[Terminal 3, socketcand protocol]
$ telnet localhost 29536
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
< hi >< open vcan0 >
< ok >

Renaming:

[Terminal 1, launch socketcand]
$ ./socketcand -l lo -i vcan0=mybus
[Terminal 2, check the beacon]
$ nc -u -l 127.255.255.255 42000
$ nc -u -l 127.255.255.255 42000
<CANBeacon name="CSANC01-DEV-05" type="SocketCAN" description="socketcand">
<URL>can://127.0.0.1:29536</URL><Bus name="mybus"/></CANBeacon>
[Terminal 3, socketcand protocol]
$ telnet localhost 29536
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
< hi >< open mybus >
< ok >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant