daemon requires to be halted to not interfere
parent
231e9a238d
commit
13611fadb3
23
icsbaudset.c
23
icsbaudset.c
|
|
@ -68,24 +68,35 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if(strcmp(devices[i].serial,argv[1]) == 0)
|
||||
{
|
||||
if(icsneo_openDevice(&devices[i])) {
|
||||
int result = icsneo_openDevice(&devices[i]);
|
||||
if(result) {
|
||||
printf("%s successfully opened!\n", devices[i].serial);
|
||||
} else {
|
||||
printf("%s failed to open!\n", devices[i].serial);
|
||||
printf("%s failed to open! %d\n", devices[i].serial, result);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(icsneo_setBaudrate(&devices[i], netid, baudrate) && icsneo_settingsApply(&devices[i])) {
|
||||
result = icsneo_setBaudrate(&devices[i], netid, baudrate);
|
||||
if (result) {
|
||||
printf("Successfully set %s baudrate for %s to %d!\n", argv[2], devices[i].serial, baudrate);
|
||||
} else {
|
||||
printf("FAILED to set %s baudrate for %s to %d!\n", argv[2], devices[i].serial, baudrate);
|
||||
printf("FAILED to set %s baudrate for %s to %d! %d\n", argv[2], devices[i].serial, baudrate, result);
|
||||
closeonfail(&devices[i]);
|
||||
}
|
||||
|
||||
if(icsneo_setFDBaudrate(&devices[i], netid, fdbaudrate) && icsneo_settingsApply(&devices[i])) {
|
||||
result = icsneo_setFDBaudrate(&devices[i], netid, fdbaudrate);
|
||||
if (result) {
|
||||
printf("Successfully set %s FD baudrate for %s to %d!\n", argv[2], devices[i].serial, fdbaudrate);
|
||||
} else {
|
||||
printf("FAILED to set %s FD baudrate for %s to %d!\n", argv[2], devices[i].serial, fdbaudrate);
|
||||
printf("FAILED to set %s FD baudrate for %s to %d! %d\n", argv[2], devices[i].serial, fdbaudrate, result);
|
||||
closeonfail(&devices[i]);
|
||||
}
|
||||
|
||||
result = icsneo_settingsApply(&devices[i]);
|
||||
if (result) {
|
||||
printf("Successfully applied settings!\n");
|
||||
} else {
|
||||
printf("FAILED apply settings! %d\n", result);
|
||||
closeonfail(&devices[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@ sudo ip link set $1 down
|
|||
|
||||
ARGS=$(ip link | awk 'BEGIN{ORS=" "};/can.*/{ if(/can.*:/){print $2};if(/alias/){print $2,"\n"} }' | grep $1: | awk '{print $1,$2}' | awk 'BEGIN{FS="_"}{print $1,$2}' | awk '{print $3,$2}')
|
||||
|
||||
echo $1 $ARGS $2 $3
|
||||
sudo systemctl stop icsscand.service
|
||||
sleep 3
|
||||
|
||||
sudo libicsneo-setbaud $ARGS $2 $3
|
||||
|
||||
sudo systemctl start icsscand.service
|
||||
sleep 3
|
||||
|
||||
sudo ip link set $1 up
|
||||
|
||||
echo $ARGS
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue