usb serial: pl2303 driver TxD "break" stays after close() bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tested on 3.10.67 and 3.18.5 kernels with ATEN UC-232A usb-serial adapter.
No patch, sorry. To actually see the stuck "break" signal on TxD line, you
need either some sort of LED or voltmeter connected to the data transmit
line. Other RS-232 serial ports that I have access to (normal PC hardware
serial ports and FTDI usb-serial adapters) do not have this bug.


/* pl2303 TxD "break" stays after close() demo */

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <fcntl.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    struct termios tt;
    int fd;

    if(argc < 2) {
        fprintf(stderr, "usage: %s /dev/ttyUSB0\n", argv[0]);
        exit(1);
    }
    if((fd = open(argv[1], O_RDWR | O_NOCTTY, 0)) == -1) {
        perror("serial port open failed");
        exit(1);
    }
    tcgetattr(fd, &tt);
    cfmakeraw(&tt);
    tcsetattr(fd, TCSANOW, &tt);
    if(ioctl(fd, TIOCSBRK, 0) == -1) {
        perror("set BRK failed");
        exit(1);
    }
    close(fd);
    exit(0);
}

-- 
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux