slcan_attach: 'close' the slcan adapter before setting a bitrate

As investigated by Thorsten Godau the bitrate can only be set after the
slcan adapter is in 'close' state.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Thorsten Godau <dl9sec@gmx.net>
pull/7/head
Oliver Hartkopp 2011-01-09 11:35:03 +00:00
parent c9cdc9d069
commit eb1a99f8c7
1 changed files with 2 additions and 2 deletions

View File

@ -150,12 +150,12 @@ int main(int argc, char **argv)
if (waitkey || !detach) { if (waitkey || !detach) {
if (speed) { if (speed) {
sprintf(buf, "S%s\r", speed); sprintf(buf, "C\rS%s\r", speed);
write(fd, buf, strlen(buf)); write(fd, buf, strlen(buf));
} }
if (btr) { if (btr) {
sprintf(buf, "s%s\r", btr); sprintf(buf, "C\rs%s\r", btr);
write(fd, buf, strlen(buf)); write(fd, buf, strlen(buf));
} }