daemon requires to be halted to not interfere
This commit is contained in:
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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user