Failed to configure device ttyUSB0 (Arduino) on Ubuntu, C++ Failed to configure device ttyUSB0 (Arduino) on Ubuntu, C++ unix unix

Failed to configure device ttyUSB0 (Arduino) on Ubuntu, C++


Thanks to all. I found the solution on their own:

  1. As autoreset on serial connection is activated by default on most boards, you need to disable this feature if you want to communicate directly with your board with the last command instead of a terminal emulator (arduino IDE, screen, picocom...). If you have a Leonardo board, you are not concerned by this, because it does not autoreset. If you have a Uno board, connect a 10 µF capacitor between the RESET and GND pins. If you have another board, connect a 120 ohms resistor between the RESET and 5V pins. See http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection for more details.
  2. Сhanged code

    memset( &terminalOptions, 0, sizeof( struct termios ) );tcgetattr(fd, &terminalOptions);        //changecfmakeraw(&terminalOptions);cfsetspeed(&terminalOptions, baudRate);terminalOptions.c_cflag = CLOCAL;                                            terminalOptions.c_cflag |= CS8;        terminalOptions.c_cc[VMIN] = 0;         terminalOptions.c_cc[VTIME] = 10;      terminalOptions.c_cflag = CLOCAL;                                             terminalOptions.c_cflag &= ~HUPCL;       //change (disable hang-up-on-close to avoid reset)ret = tcsetattr(fd, TCSANOW, &terminalOptions);  //changeif (ret == -1){        this->setFail();        this->setErrorStr( "Failed to configure device: " + (std::string)devicePath + ". " + (std::string)strerror(errno) );        return -1;}return fd;


I also have arduino UNO and when I plug it via usb port it connects to /dev/ttyACM0 not ttyUSB0 you should also check ttyACM0 when you plug and unplug your arduino UNO.

It is also the case If you haven't installed arduino port driver