Maybe something like this could help in libobd's obd-chan-elm.c after ATAT2 command and its response test and before sending "0101" Code: if(obdchanelm_ssendcmd(chan, "ATSP0", 6)) { /* Set protocol to Automatic */ ret = OBDCHANERR_SETUP_ERROR; goto error; } if(!strstr(pelm->buffer, "OK")) LOG_WARNING("Unable to set ELM to use Automatic protocol"); The third parameter of obdchanelm_ssendcmd is a timeout, so a suitable value might have to be tested.
if(obdchanelm_ssendcmd(chan, "ATSP0", 6)) { /* Set protocol to Automatic */ ret = OBDCHANERR_SETUP_ERROR; goto error; } if(!strstr(pelm->buffer, "OK")) LOG_WARNING("Unable to set ELM to use Automatic protocol");