- if ((fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK)) <= 0)
- {
- DEBUG ("No device at fd %d", fd);
- close (fd);
- continue;
- }
- struct termios options;
- /* Get the current options for the port... */
- tcgetattr(fd, &options);
- options.c_cflag = B19200 | CS8 | CSTOPB | CREAD | CLOCAL;
- options.c_iflag = IGNBRK | IGNPAR;
- options.c_oflag = 0;
- options.c_lflag = 0;
- options.c_cc[VTIME] = 20;
- options.c_cc[VMIN] = 250;
-
- /* Set the new options for the port... */
- tcflush(fd, TCIFLUSH);
- tcsetattr(fd, TCSANOW, &options);
-
- if (ted_read_value (&kw,&voltage) != 0)
- {
- DEBUG ("No device at fd %d", fd);
- close (fd);
- continue;
- }
-
- INFO ("ted plugin: Device found at %s", device);
- return (0);
- }
+ /* Set the new options for the port... */
+ tcflush(fd, TCIFLUSH);
+ tcsetattr(fd, TCSANOW, &options);