All of lore.kernel.org
 help / color / mirror / Atom feed
* Driver CH341 USB Adapter Serial Port not Works in Linux
@ 2014-04-14  0:49 Kijam López
  2014-04-14  1:20 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Kijam López @ 2014-04-14  0:49 UTC (permalink / raw)
  To: linux-usb, linux-serial

Hi!, I'm having trouble with this adapter, and lately I think it's the
driver. Here I leave a link where I report the problem:

http://stackoverflow.com/questions/23040820/driver-ch341-usb-adapter-serial-port-or-qserialport-not-works-in-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  0:49 Driver CH341 USB Adapter Serial Port not Works in Linux Kijam López
@ 2014-04-14  1:20 ` Greg KH
  2014-04-14  1:21   ` Kijam López
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2014-04-14  1:20 UTC (permalink / raw)
  To: Kijam López; +Cc: linux-usb, linux-serial

On Sun, Apr 13, 2014 at 08:19:11PM -0430, Kijam López wrote:
> Hi!, I'm having trouble with this adapter, and lately I think it's the
> driver. Here I leave a link where I report the problem:
> 
> http://stackoverflow.com/questions/23040820/driver-ch341-usb-adapter-serial-port-or-qserialport-not-works-in-linux

How about asking the question here, and not on some random web site,
where there's nothing we can do about it...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  1:20 ` Greg KH
@ 2014-04-14  1:21   ` Kijam López
  2014-04-14  1:44     ` Greg KH
       [not found]     ` <CAMkwOQa4Wm9vnyDce_tkf3J=h73A3NfX3oAwTaOUeEVduStC4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Kijam López @ 2014-04-14  1:21 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial

The following code works for me correctly in Windows, but Linux does
not work. I am using the same PC, both operating systems are installed
native. I do not use virtual machine. I need to work on Linux. I have
tried in different linux distributions and does not work anywhere.

    // In the main class:
      QSerialPortInfo info = XXXX; // Generally in Linux:
/dev/ttyUSB0, in win: COM1
      QSerialPort serial;
      QObject::connect(&serial, SIGNAL(readyRead()), this,
SLOT(onReadyRead()), Qt::DirectConnection);
      QObject::connect(&serial, SIGNAL(bytesWritten(qint64)), this,
SLOT(onBytesWritten(qint64)), Qt::DirectConnection);
      QObject::connect(&serial,
SIGNAL(error(QSerialPort::SerialPortError)), this,
SLOT(onError(QSerialPort::SerialPortError)), Qt::DirectConnection);

      // Slot
      void MyClass::onReadyRead()
      {
            qDebug()<<"Signal onReadyRead";
            buffer_mutex.lock();
            buffer += serial.readAll();
            qDebug()<<"Read: "<<qstr_to_hexstr(buffer);
            bufferNotEmpty.wakeAll();
            buffer_mutex.unlock();
      }

      void MyClass::onError(QSerialPort::SerialPortError error) {
            qCritical()<<"Serial Port Error: "<<(int)error;
      }

      void MyClass::onBytesWritten(qint64 size){
            qDebug()<<"onBytesWritten: "<<size;
      }


      // In another place I did:
      serial.setPort(info);
      if(!serial.open(QIODevice::ReadWrite))
            return false;

      qDebug()<<"Init Setting!...";

      if(!serial.setBaudRate(QSerialPort::Baud9600))
            qCritical()<<"Error in setBaudRate";
      if(!serial.setDataBits(QSerialPort::Data8))
            qCritical()<<"Error in setDataBits";
      if(!serial.setParity(QSerialPort::EvenParity))
            qCritical()<<"Error in setParity";
      if(!serial.setStopBits(QSerialPort::OneStop))
            qCritical()<<"Error in setStopBits";
      if(!serial.setFlowControl(QSerialPort::SoftwareControl))
            qCritical()<<"Error in setFlowControl";
      if(!serial.setDataTerminalReady(true))
            qCritical()<<"Error in setDataTerminalReady";

      qDebug()<<"Setting ready!...";

If sending 1 byte the device responds and sends the data correctly.

Example:

    // In the main class:
    const char enq[2] = {0x05, '\0'};
    serial.write (enq);

    // In onReadyRead:
    serial.readAll(); // Works on Win / Linux


If sent a more than 1 byte device does not respond the request in linux.

Example:

    // In the main class:
    const char command[6] = {0x02, 'S', '1', 0x03, 'a', '\0'};
    serial.write(command);

    // In onReadyRead
    serial.readAll(); // Works only in Win

This event is triggered only in windows. In linux it never works, not
received or arrives in bad format and never recognized the remote
device.

My log in Windows:

      {Debug}             Init Setting!...
      {Debug}             Setting ready!...
      {Debug}             Write:  " 0x05 "
      {Debug}             onBytesWritten:  1
      {Debug}             buffer wait!...
      {Debug}                  Signal onReadyRead
      {Debug}                  Read:  " 0x02 `@ 0x03 #"
      {Debug}                  buffer size:  5
      {Critical}            Serial Port Error:  0
      {Debug}             Write:  " 0x02 S1 0x03 a"
      {Debug}             onBytesWritten:  5
      {Debug}             buffer wait!...
      {Debug}             Signal onReadyRead
      {Debug}             Read:  " 0x02 S100 0x0A 00000000000000000
0x0A 00000479"
      {Debug}             buffer size:  32
      {Debug}             buffer wait!...
      {Debug}             Signal onReadyRead
      {Debug}             Read:  " 0x02 S100 0x0A 00000000000000000
0x0A 00000479 0x0A 00000 0x0A 00000330 0x0A 00000 0x0A 0061 0x0A 0000
0x0A "
      {Debug}             buffer size:  64
      {Debug}             Signal onReadyRead
      {Debug}             buffer wait!...
      {Debug}             Read:  " 0x02 S100 0x0A 00000000000000000
0x0A 00000479 0x0A 00000 0x0A 00000330 0x0A 00000 0x0A 0061 0x0A 0000
0x0A X-XXXXXXXX 0x0A XXXXXXXXX 0x0A 221715 0x0A 120414 0x0A  0x03
0x1B "
      {Debug}             buffer size:  103
      {Critical}            Serial Port Error:  0

(I replace the actual response of the device by the 'X' characters)

My log in Linux:

      {Debug}             Init Setting!...
      {Debug}             Setting ready!...
      {Debug}             Write:  " 0x05 "
      {Debug}             onBytesWritten:  1
      {Debug}             buffer wait!...
      {Debug}                  Signal onReadyRead
      {Debug}                  Read:  " 0x02 `@ 0x03 #"
      {Debug}                  buffer size:  5
      {Critical}            Serial Port Error:  0
      {Debug}                  Write:  " 0x02 S1 0x03 a"
      {Debug}                  onBytesWritten:  5
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             buffer wait!...
      {Debug}             timeout!... (15 sec for timeout)

USB Serial Adapter: CH340

      In Windows: USB\VID_1A86&PID_7523&REV_0254
      In Linux:
            Apr 13 01:16:58 kali kernel: [47844.260136] usb 2-1: new
full-speed USB device number 16 using uhci_hcd
            Apr 13 01:16:58 kali kernel: [47844.428098] usb 2-1: New
USB device found, idVendor=1a86, idProduct=7523
            Apr 13 01:16:58 kali kernel: [47844.428115] usb 2-1: New
USB device strings: Mfr=0, Product=2, SerialNumber=0
            Apr 13 01:16:58 kali kernel: [47844.428126] usb 2-1:
Product: USB2.0-Ser!
            Apr 13 01:16:58 kali kernel: [47844.431268] ch341 2-1:1.0:
ch341-uart converter detected
            Apr 13 01:16:58 kali kernel: [47844.445398] usb 2-1:
ch341-uart converter now attached to ttyUSB0
            Apr 13 01:16:58 kali mtp-probe: checking bus 2, device 16:
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1"
            Apr 13 01:16:58 kali mtp-probe: bus: 2, device: 16 was not
an MTP device


**More information 1:**

      Apr 13 04:10:55 kali kernel: [ 4872.627980] tty ttyUSB0:
serial_write - 1 byte(s)
      Apr 13 04:10:55 kali kernel: [ 4872.629763] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:55 kali kernel: [ 4872.629778] tty ttyUSB0:
serial_wait_until_sent
      Apr 13 04:10:55 kali kernel: [ 4872.638252] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:55 kali kernel: [ 4872.638267] tty ttyUSB0: serial_write_room
      Apr 13 04:10:55 kali kernel: [ 4872.638278] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:55 kali kernel: [ 4872.638287] tty ttyUSB0: serial_write_room
      Apr 13 04:10:55 kali kernel: [ 4872.639438] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:55 kali kernel: [ 4872.639458] tty ttyUSB0: serial_write_room
      Apr 13 04:10:55 kali kernel: [ 4872.639475] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:55 kali kernel: [ 4872.639488] tty ttyUSB0: serial_write_room
      Apr 13 04:10:56 kali kernel: [ 4873.641799] tty ttyUSB0:
serial_ioctl - cmd 0x540b
      Apr 13 04:10:56 kali kernel: [ 4873.646884] tty ttyUSB0:
serial_write - 5 byte(s)
      Apr 13 04:10:56 kali kernel: [ 4873.647152] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
      Apr 13 04:10:56 kali kernel: [ 4873.647176] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01
      Apr 13 04:10:56 kali kernel: [ 4873.647384] tty ttyUSB0:
serial_chars_in_buffer
      Apr 13 04:10:56 kali kernel: [ 4873.647401] tty ttyUSB0:
serial_wait_until_sent
      Apr 13 04:10:56 kali kernel: [ 4873.649144] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
      Apr 13 04:10:56 kali kernel: [ 4873.649166] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01
      Apr 13 04:10:56 kali kernel: [ 4873.692152] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
      Apr 13 04:10:56 kali kernel: [ 4873.692170] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01
      Apr 13 04:10:56 kali kernel: [ 4873.694133] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
      Apr 13 04:10:56 kali kernel: [ 4873.694148] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01

I rebuild ch341.c and add:

      if (!delta)
            return;

      dev_info(&port->dev, "%s - delta=0x%02X\n", __func__, delta); //
<---- New Line

      if (delta & CH341_BIT_CTS)
            port->icount.cts++;
      if (delta & CH341_BIT_DSR)
            port->icount.dsr++;
      if (delta & CH341_BIT_RI)
            port->icount.rng++;
      if (delta & CH341_BIT_DCD) {
            port->icount.dcd++;
            tty = tty_port_tty_get(&port->port);
            if (tty) {
                  usb_serial_handle_dcd_change(port, tty,
                                    status & CH341_BIT_DCD);
                  tty_kref_put(tty);
            }
      }

delta=0x01 in the log is flag:

    #define CH341_BIT_CTS 0x01

**More information 2:**

In the thread of write / read I hope for wakeAll, running on
onReadyRead. If you pass a second make a readAll before checking if
the buffer is empty. example:

      // In the main class:
      QWaitCondition bufferNotEmpty;

      // In my function write/read:
      serial.write(data, size);
      buffer_mutex.lock();
      while(time(NULL)-timeStart<timeoutWait && serial.isOpen()) {
            buffer += serial.readAll();
            if(buffer.count()>0){
                  qDebug()<<"buffer size: "<<buffer.count();
                  //Interprete the buffer here...

                  if(bufferComplete)
                        break;
            }
            qDebug()<<"buffer wait!...";
            bufferNotEmpty.wait(&buffer_mutex, 1000);
      }
      buffer.clear();
      buffer_mutex.unlock();

**More information 3:**

My Kernel is 3.12.6, but i updated from GitHub this file an rebuild
this drivers:

https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c
(commit d9a38a8741fdffabc32e6d0943b1cdcf22712bec)



PD: Sorry for my English, try to do my best with Google Translator :(...

_____________________________
Atentamente
Lic. Kijam López
Página Web
Curriculum Vitae


2014-04-13 20:50 GMT-04:30 Greg KH <gregkh@linuxfoundation.org>:
> On Sun, Apr 13, 2014 at 08:19:11PM -0430, Kijam López wrote:
>> Hi!, I'm having trouble with this adapter, and lately I think it's the
>> driver. Here I leave a link where I report the problem:
>>
>> http://stackoverflow.com/questions/23040820/driver-ch341-usb-adapter-serial-port-or-qserialport-not-works-in-linux
>
> How about asking the question here, and not on some random web site,
> where there's nothing we can do about it...
>
> thanks,
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  1:21   ` Kijam López
@ 2014-04-14  1:44     ` Greg KH
  2014-04-14  4:46       ` Kijam López
       [not found]     ` <CAMkwOQa4Wm9vnyDce_tkf3J=h73A3NfX3oAwTaOUeEVduStC4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Greg KH @ 2014-04-14  1:44 UTC (permalink / raw)
  To: Kijam López; +Cc: linux-usb, linux-serial

On Sun, Apr 13, 2014 at 08:51:56PM -0430, Kijam López wrote:
> The following code works for me correctly in Windows, but Linux does
> not work. I am using the same PC, both operating systems are installed
> native. I do not use virtual machine. I need to work on Linux. I have
> tried in different linux distributions and does not work anywhere.

<snip>

Sounds like a Qt issue, what is the status of the bug you filed with
those developers?

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  1:44     ` Greg KH
@ 2014-04-14  4:46       ` Kijam López
  2014-04-14  5:23         ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Kijam López @ 2014-04-14  4:46 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial

I reported here:

     https://bugreports.qt-project.org/browse/QTBUG-38305

But just migrate my APP to ANSI C and is exactly the same.

My code test in ANSI C:

     #include <sys/types.h>
     #include <sys/stat.h>
     #include <fcntl.h>
     #include <termios.h>
     #include <unistd.h>
     #include <errno.h>
     #include <stdio.h>
     #include <string.h>
     #include <ctype.h>
     #include <pthread.h>
     #include <stdlib.h>
     #include <time.h>

     #define STX (0x02)
     #define ETX (0x03)
     #define ENQ (0x05)
     #define ACK (0x06)
     #define NAK (0x15)
     #define SEP (0x0A)

     int serial = -1;
     int finnish = 0;

     char *buffer = NULL;
     size_t buffer_size = 0;
     size_t buffer_len = 0;

     const char enq[1] = {ENQ};
     const char ack[1] = {ACK};
     const char nak[1] = {NAK};

     pthread_cond_t buffer_no_empty = PTHREAD_COND_INITIALIZER;
     pthread_mutex_t buffer_mutex = PTHREAD_MUTEX_INITIALIZER;

     static void debug_str(const char *str, size_t size) {
          int i;
          for(i = 0; i < size; ++i)
               if(isprint(str[i]) && !iscntrl(str[i]))
                    printf("%c", (char)str[i]);
               else
                    printf(" 0x%02X ", (unsigned char) str[i]);
          printf("\n");
     }

     static void flush() {
          if(serial<0) return;
          tcflush(serial, TCIFLUSH);
          tcflush(serial, TCIOFLUSH);
          tcflush(serial, TCOFLUSH);
     }

     static void openPort(const char *port) {
          serial = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK);
          if(serial<0) {
               printf("Error %u from serial open: %s\n", errno,
strerror(errno));
               return ;
          }

          struct termios tty;
          memset(&tty, 0, sizeof(tty));

          // Set Baud Rate
          cfsetospeed (&tty, B9600);
          cfsetispeed (&tty, B9600);

          tty.c_cflag     |=   PARENB;
          tty.c_cflag     &=   ~(PARODD | CSTOPB | CSIZE);
          tty.c_cflag     |=   CS8;
          tty.c_cflag     |=   CLOCAL;
          tty.c_cflag     |=   CREAD;

          tty.c_iflag |= (IXON | IXOFF | IXANY);

          flush();

          if ( tcsetattr(serial, TCSANOW, &tty) != 0 )
               printf("Error %d from tcsetattr: %s\n", errno, strerror(errno));

          flush();
     }

     #define valid_buffer() (buffer_size>3 && buffer[0]==STX &&
buffer[buffer_size-2] == ETX)

     static void* thread_read(void* dummy) {
          unsigned char buf;
          while(!finnish) {
               int n = read(serial, &buf, 1);
               if(n>0) {
                    pthread_mutex_lock(&buffer_mutex);
                    if(buf == ENQ) {
                         printf("Recive ENQ, sending ACK\n");
                         write(serial, ack, 1);
                         pthread_mutex_unlock(&buffer_mutex);
                         continue;
                    }
                    if(buffer_size == buffer_len) {
                         buffer_len *= 2;
                         buffer = realloc(buffer, (size_t)buffer_len);
                    }
                    buffer[buffer_size] = buf;
                    buffer_size += 1;
                    printf("Buffer: ");
                    debug_str(buffer, buffer_size);
                    if(valid_buffer()) {
                         printf("Signal buffer_no_empty\n");
                         pthread_cond_signal(&buffer_no_empty);
                    }
                    pthread_mutex_unlock(&buffer_mutex);
               }else if(n<0 && errno!=11) {
                    printf("Error %d from serial read: %s\n", errno,
strerror(errno));
               }
          }
          return NULL;
     }

     static void send_and_read(const char *data, size_t size, int
timeout, char **recv, size_t *size_recv) {

          printf("Write: ");
          debug_str(data, size);

          write(serial, data, size);

          time_t startTime = time(NULL);
          struct timespec ts;
          clock_gettime(CLOCK_REALTIME, &ts);
          ts.tv_sec += timeout;

          printf("Wait response...\n");
          pthread_mutex_lock(&buffer_mutex);

          while(!valid_buffer() && time(NULL)-startTime<timeout-1)
               pthread_cond_timedwait(&buffer_no_empty, &buffer_mutex, &ts);

          if(valid_buffer()) {
               *recv = malloc(buffer_size+1);
               *size_recv = buffer_size;
               memcpy(*recv, buffer, buffer_size);
               (*recv)[buffer_size]='\0';
               printf("Read:");
               debug_str(*recv, buffer_size);
          }else{
               printf("Timeout...\n");
               *recv = NULL;
               *size_recv = 0;
          }
          buffer_size = 0;
          memset(buffer, 0, buffer_len);

          pthread_mutex_unlock(&buffer_mutex);
     }

     int main(){
          openPort("/dev/ttyUSB0");
          if(serial>0) {
               buffer = malloc(1024);
               buffer_len = 1024;
               pthread_t thread;
               pthread_create(&thread, NULL, thread_read, NULL);

               char *test = NULL;
               size_t s = 0;
               send_and_read(enq, 1, 15, &test, &s);
               if(s>0)
                    printf("Test status: OK\n");
               else
                    printf("Test status: Fail\n");

               sleep(3); //Pause...

               char command[5] = {STX, 'S', '1', ETX, 'a'};

               send_and_read(command, 5, 15, &test, &s);
               if(s>0)
                    printf("Test command: OK\n");
               else
                    printf("Test command: Fail\n");

               finnish = 1;

               void *dummy;
               pthread_join(thread, &dummy);

               close(serial);
               free(buffer);
          }
     }

My Log of APP:
     Write:  0x05
     Wait response...
     Buffer:  0x02
     Buffer:  0x02 `
     Buffer:  0x02 `@
     Buffer:  0x02 `@ 0x03
     Buffer:  0x02 `@ 0x03 #
     Signal buffer_no_empty
     Read: 0x02 `@ 0x03 #
     Test status: OK
     Write:  0x02 S1 0x03 a
     Wait response...
     Timeout...
     Test command: Fail


My syslog:

     Apr 14 00:09:44 kali kernel: [14827.112964] tty ttyUSB0: serial_open
     Apr 14 00:09:44 kali kernel: [14827.112981] usb 1-1:
ch341_control_in(c0,5f,0000,0000,ef484b00,8)
     Apr 14 00:09:44 kali kernel: [14827.114572] usb 1-1:
ch341_control_out(40,a1,0000,0000)
     Apr 14 00:09:44 kali kernel: [14827.115557] usb 1-1:
ch341_control_out(40,9a,1312,b202)
     Apr 14 00:09:44 kali kernel: [14827.116592] usb 1-1:
ch341_control_out(40,9a,0f2c,000c)
     Apr 14 00:09:44 kali kernel: [14827.117595] usb 1-1:
ch341_control_in(c0,95,2518,0000,ef484b00,8)
     Apr 14 00:09:44 kali kernel: [14827.118579] usb 1-1:
ch341_control_out(40,9a,2518,0050)
     Apr 14 00:09:44 kali kernel: [14827.119572] usb 1-1:
ch341_control_in(c0,95,0706,0000,ef484a40,8)
     Apr 14 00:09:44 kali kernel: [14827.120608] usb 1-1:
ch341_control_out(40,a1,501f,d90a)
     Apr 14 00:09:44 kali kernel: [14827.121572] usb 1-1:
ch341_control_out(40,9a,1312,b202)
     Apr 14 00:09:44 kali kernel: [14827.122569] usb 1-1:
ch341_control_out(40,9a,0f2c,000c)
     Apr 14 00:09:44 kali kernel: [14827.123566] usb 1-1:
ch341_control_out(40,a4,ff9f,0000)
     Apr 14 00:09:44 kali kernel: [14827.124602] usb 1-1:
ch341_control_in(c0,95,0706,0000,ef484a40,8)
     Apr 14 00:09:44 kali kernel: [14827.125572] usb 1-1:
ch341_control_out(40,a4,ff9f,0000)
     Apr 14 00:09:44 kali kernel: [14827.126567] usb 1-1:
ch341_control_out(40,9a,1312,b202)
     Apr 14 00:09:44 kali kernel: [14827.127566] usb 1-1:
ch341_control_out(40,9a,0f2c,000c)
     Apr 14 00:09:44 kali kernel: [14827.128597] ch341-uart ttyUSB0:
ch341_open - submitting interrupt urb
     Apr 14 00:09:44 kali kernel: [14827.128649] usb 1-1:
ch341_control_out(40,a4,ff9f,0000)
     Apr 14 00:09:44 kali kernel: [14827.129658] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.129678] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.129691] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.129706] tty ttyUSB0:
serial_ioctl - cmd 0x5401
     Apr 14 00:09:44 kali kernel: [14827.129720] tty ttyUSB0:
serial_ioctl - cmd 0x5402
     Apr 14 00:09:44 kali kernel: [14827.129733] tty ttyUSB0: serial_set_termios
     Apr 14 00:09:44 kali kernel: [14827.129746] usb 1-1:
ch341_control_out(40,9a,1312,b202)
     Apr 14 00:09:44 kali kernel: [14827.130559] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
     Apr 14 00:09:44 kali kernel: [14827.130570] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x02
     Apr 14 00:09:44 kali kernel: [14827.130612] usb 1-1:
ch341_control_out(40,9a,0f2c,000c)
     Apr 14 00:09:44 kali kernel: [14827.131589] usb 1-1:
ch341_control_out(40,a4,ff9f,0000)
     Apr 14 00:09:44 kali kernel: [14827.132553] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
     Apr 14 00:09:44 kali kernel: [14827.132571] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x02
     Apr 14 00:09:44 kali kernel: [14827.133388] tty ttyUSB0:
serial_ioctl - cmd 0x5401
     Apr 14 00:09:44 kali kernel: [14827.133411] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.133427] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.133440] tty ttyUSB0:
serial_ioctl - cmd 0x540b
     Apr 14 00:09:44 kali kernel: [14827.134087] tty ttyUSB0:
serial_write - 1 byte(s)
     Apr 14 00:09:47 kali kernel: [14830.144091] tty ttyUSB0:
serial_write - 5 byte(s)
     Apr 14 00:09:47 kali kernel: [14830.152441] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
     Apr 14 00:09:47 kali kernel: [14830.152452] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01
     Apr 14 00:09:47 kali kernel: [14830.154426] ch341-uart ttyUSB0:
ch341_update_line_status - multiple status change
     Apr 14 00:09:47 kali kernel: [14830.154433] ch341-uart ttyUSB0:
ch341_update_line_status - delta=0x01
     Apr 14 00:10:02 kali kernel: [14845.144415] tty ttyUSB0: serial_close
     Apr 14 00:10:02 kali kernel: [14845.144432] tty ttyUSB0:
serial_chars_in_buffer
     Apr 14 00:10:02 kali kernel: [14845.144442] tty ttyUSB0:
serial_wait_until_sent
     Apr 14 00:10:02 kali kernel: [14845.147914] usb 1-1:
ch341_read_int_callback - urb shutting down: -2
     Apr 14 00:10:02 kali kernel: [14845.149723] tty ttyUSB0: serial_cleanup


I think it's not the fault of QT ...


2014-04-13 21:14 GMT-04:30 Greg KH <gregkh@linuxfoundation.org>:
> On Sun, Apr 13, 2014 at 08:51:56PM -0430, Kijam López wrote:
>> The following code works for me correctly in Windows, but Linux does
>> not work. I am using the same PC, both operating systems are installed
>> native. I do not use virtual machine. I need to work on Linux. I have
>> tried in different linux distributions and does not work anywhere.
>
> <snip>
>
> Sounds like a Qt issue, what is the status of the bug you filed with
> those developers?
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  4:46       ` Kijam López
@ 2014-04-14  5:23         ` Greg KH
  2014-04-14  5:32           ` Kijam López
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2014-04-14  5:23 UTC (permalink / raw)
  To: Kijam López; +Cc: linux-usb, linux-serial

On Mon, Apr 14, 2014 at 12:16:40AM -0430, Kijam López wrote:
> I reported here:
> 
>      https://bugreports.qt-project.org/browse/QTBUG-38305
> 
> But just migrate my APP to ANSI C and is exactly the same.
> 
> My code test in ANSI C:
> 
>      #include <sys/types.h>
>      #include <sys/stat.h>
>      #include <fcntl.h>
>      #include <termios.h>
>      #include <unistd.h>
>      #include <errno.h>
>      #include <stdio.h>
>      #include <string.h>
>      #include <ctype.h>
>      #include <pthread.h>
>      #include <stdlib.h>
>      #include <time.h>
> 
>      #define STX (0x02)
>      #define ETX (0x03)
>      #define ENQ (0x05)
>      #define ACK (0x06)
>      #define NAK (0x15)
>      #define SEP (0x0A)
> 
>      int serial = -1;
>      int finnish = 0;
> 
>      char *buffer = NULL;
>      size_t buffer_size = 0;
>      size_t buffer_len = 0;
> 
>      const char enq[1] = {ENQ};
>      const char ack[1] = {ACK};
>      const char nak[1] = {NAK};
> 
>      pthread_cond_t buffer_no_empty = PTHREAD_COND_INITIALIZER;
>      pthread_mutex_t buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
> 
>      static void debug_str(const char *str, size_t size) {
>           int i;
>           for(i = 0; i < size; ++i)
>                if(isprint(str[i]) && !iscntrl(str[i]))
>                     printf("%c", (char)str[i]);
>                else
>                     printf(" 0x%02X ", (unsigned char) str[i]);
>           printf("\n");
>      }
> 
>      static void flush() {
>           if(serial<0) return;
>           tcflush(serial, TCIFLUSH);
>           tcflush(serial, TCIOFLUSH);
>           tcflush(serial, TCOFLUSH);
>      }
> 
>      static void openPort(const char *port) {
>           serial = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK);
>           if(serial<0) {
>                printf("Error %u from serial open: %s\n", errno,
> strerror(errno));
>                return ;
>           }
> 
>           struct termios tty;
>           memset(&tty, 0, sizeof(tty));
> 
>           // Set Baud Rate
>           cfsetospeed (&tty, B9600);
>           cfsetispeed (&tty, B9600);
> 
>           tty.c_cflag     |=   PARENB;
>           tty.c_cflag     &=   ~(PARODD | CSTOPB | CSIZE);
>           tty.c_cflag     |=   CS8;
>           tty.c_cflag     |=   CLOCAL;
>           tty.c_cflag     |=   CREAD;
> 
>           tty.c_iflag |= (IXON | IXOFF | IXANY);
> 
>           flush();
> 
>           if ( tcsetattr(serial, TCSANOW, &tty) != 0 )
>                printf("Error %d from tcsetattr: %s\n", errno, strerror(errno));
> 
>           flush();
>      }
> 
>      #define valid_buffer() (buffer_size>3 && buffer[0]==STX &&
> buffer[buffer_size-2] == ETX)
> 
>      static void* thread_read(void* dummy) {
>           unsigned char buf;
>           while(!finnish) {
>                int n = read(serial, &buf, 1);
>                if(n>0) {
>                     pthread_mutex_lock(&buffer_mutex);
>                     if(buf == ENQ) {
>                          printf("Recive ENQ, sending ACK\n");
>                          write(serial, ack, 1);
>                          pthread_mutex_unlock(&buffer_mutex);
>                          continue;
>                     }
>                     if(buffer_size == buffer_len) {
>                          buffer_len *= 2;
>                          buffer = realloc(buffer, (size_t)buffer_len);
>                     }
>                     buffer[buffer_size] = buf;
>                     buffer_size += 1;
>                     printf("Buffer: ");
>                     debug_str(buffer, buffer_size);
>                     if(valid_buffer()) {
>                          printf("Signal buffer_no_empty\n");
>                          pthread_cond_signal(&buffer_no_empty);
>                     }
>                     pthread_mutex_unlock(&buffer_mutex);
>                }else if(n<0 && errno!=11) {
>                     printf("Error %d from serial read: %s\n", errno,
> strerror(errno));
>                }
>           }
>           return NULL;
>      }
> 
>      static void send_and_read(const char *data, size_t size, int
> timeout, char **recv, size_t *size_recv) {
> 
>           printf("Write: ");
>           debug_str(data, size);
> 
>           write(serial, data, size);
> 
>           time_t startTime = time(NULL);
>           struct timespec ts;
>           clock_gettime(CLOCK_REALTIME, &ts);
>           ts.tv_sec += timeout;
> 
>           printf("Wait response...\n");
>           pthread_mutex_lock(&buffer_mutex);
> 
>           while(!valid_buffer() && time(NULL)-startTime<timeout-1)
>                pthread_cond_timedwait(&buffer_no_empty, &buffer_mutex, &ts);
> 
>           if(valid_buffer()) {
>                *recv = malloc(buffer_size+1);
>                *size_recv = buffer_size;
>                memcpy(*recv, buffer, buffer_size);
>                (*recv)[buffer_size]='\0';
>                printf("Read:");
>                debug_str(*recv, buffer_size);
>           }else{
>                printf("Timeout...\n");
>                *recv = NULL;
>                *size_recv = 0;
>           }
>           buffer_size = 0;
>           memset(buffer, 0, buffer_len);
> 
>           pthread_mutex_unlock(&buffer_mutex);
>      }
> 
>      int main(){
>           openPort("/dev/ttyUSB0");
>           if(serial>0) {
>                buffer = malloc(1024);
>                buffer_len = 1024;
>                pthread_t thread;
>                pthread_create(&thread, NULL, thread_read, NULL);
> 
>                char *test = NULL;
>                size_t s = 0;
>                send_and_read(enq, 1, 15, &test, &s);
>                if(s>0)
>                     printf("Test status: OK\n");
>                else
>                     printf("Test status: Fail\n");
> 
>                sleep(3); //Pause...
> 
>                char command[5] = {STX, 'S', '1', ETX, 'a'};
> 
>                send_and_read(command, 5, 15, &test, &s);
>                if(s>0)
>                     printf("Test command: OK\n");
>                else
>                     printf("Test command: Fail\n");
> 
>                finnish = 1;
> 
>                void *dummy;
>                pthread_join(thread, &dummy);
> 
>                close(serial);
>                free(buffer);
>           }
>      }
> 
> My Log of APP:
>      Write:  0x05
>      Wait response...
>      Buffer:  0x02
>      Buffer:  0x02 `
>      Buffer:  0x02 `@
>      Buffer:  0x02 `@ 0x03
>      Buffer:  0x02 `@ 0x03 #
>      Signal buffer_no_empty
>      Read: 0x02 `@ 0x03 #
>      Test status: OK
>      Write:  0x02 S1 0x03 a
>      Wait response...
>      Timeout...
>      Test command: Fail

I'm confused, what should it do?

And what kernel version are you using here?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  5:23         ` Greg KH
@ 2014-04-14  5:32           ` Kijam López
  2014-04-14  6:36             ` Kijam López
  0 siblings, 1 reply; 11+ messages in thread
From: Kijam López @ 2014-04-14  5:32 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial

All commands and responses are formatted: STX data ETX LRC (I replace
No printable Char for [space]0xXX[space])

If I sent a ENQ answers his state, which is 2 bytes, so replies:  0x02
`@ 0x03 # (`@ is a two-byte mask representing the internal state of
the device)

If sending the S1 command, which is " 0x02 S1 0x03 a", I should say
something like this:
" 0x02 S100 0x0A 00000000000000000 0x0A 00000479 0x0A 00000 0x0A
00000330 0x0A 00000 0x0A 0061 0x0A 0000 0x0A X-XXXXXXXX 0x0A XXXXXXXXX
0x0A 221715 0x0A 120414 0x0A  0x03  0x1B "

In Windows OS, it works perfectly with the same PC and the same USB
adapter. But Linux is not responding. Or respond but the driver is not
interpreted correctly.

My Kernel is 3.12.6, but i updated from GitHub this file an rebuild
this drivers:
https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c
(commit d9a38a8741fdffabc32e6d0943b1cdcf22712bec)


2014-04-14 0:53 GMT-04:30 Greg KH <gregkh@linuxfoundation.org>:
> On Mon, Apr 14, 2014 at 12:16:40AM -0430, Kijam López wrote:
>> I reported here:
>>
>>      https://bugreports.qt-project.org/browse/QTBUG-38305
>>
>> But just migrate my APP to ANSI C and is exactly the same.
>>
>> My code test in ANSI C:
>>
>>      <snip>
>>      Test command: Fail
>
> I'm confused, what should it do?
>
> And what kernel version are you using here?
>
> thanks,
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14  5:32           ` Kijam López
@ 2014-04-14  6:36             ` Kijam López
       [not found]               ` <CAMkwOQZe2Gr8YFXGOqdBMiG6nTJj-waJRa9sR2xcnwRuLpRAOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Kijam López @ 2014-04-14  6:36 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-serial

By testing, sometimes even when ENQ command, if they leave these four lines:

ch341_update_line_status - multiple status change
ch341_update_line_status - delta = 0x01
ch341_update_line_status - multiple status change
ch341_update_line_status - delta = 0x01

Always gives Timeout. Apparently there is the problem ... I think XD.

The problem with the driver gives me the kernel 3.12.6 original, a
despairing attempt to update the two files you mentioned, but still
always feel the same. Always respond timeout.


2014-04-14 1:02 GMT-04:30 Kijam López <kijamve@gmail.com>:
> All commands and responses are formatted: STX data ETX LRC (I replace
> No printable Char for [space]0xXX[space])
>
> If I sent a ENQ answers his state, which is 2 bytes, so replies:  0x02
> `@ 0x03 # (`@ is a two-byte mask representing the internal state of
> the device)
>
> If sending the S1 command, which is " 0x02 S1 0x03 a", I should say
> something like this:
> " 0x02 S100 0x0A 00000000000000000 0x0A 00000479 0x0A 00000 0x0A
> 00000330 0x0A 00000 0x0A 0061 0x0A 0000 0x0A X-XXXXXXXX 0x0A XXXXXXXXX
> 0x0A 221715 0x0A 120414 0x0A  0x03  0x1B "
>
> In Windows OS, it works perfectly with the same PC and the same USB
> adapter. But Linux is not responding. Or respond but the driver is not
> interpreted correctly.
>
> My Kernel is 3.12.6, but i updated from GitHub this file an rebuild
> this drivers:
> https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
> https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c
> (commit d9a38a8741fdffabc32e6d0943b1cdcf22712bec)
>
>
> 2014-04-14 0:53 GMT-04:30 Greg KH <gregkh@linuxfoundation.org>:
>> On Mon, Apr 14, 2014 at 12:16:40AM -0430, Kijam López wrote:
>>> I reported here:
>>>
>>>      https://bugreports.qt-project.org/browse/QTBUG-38305
>>>
>>> But just migrate my APP to ANSI C and is exactly the same.
>>>
>>> My code test in ANSI C:
>>>
>>>      <snip>
>>>      Test command: Fail
>>
>> I'm confused, what should it do?
>>
>> And what kernel version are you using here?
>>
>> thanks,
>>
>> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
       [not found]               ` <CAMkwOQZe2Gr8YFXGOqdBMiG6nTJj-waJRa9sR2xcnwRuLpRAOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-04-14  6:42                 ` Kijam López
  0 siblings, 0 replies; 11+ messages in thread
From: Kijam López @ 2014-04-14  6:42 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA

As a side note, I mentioned in a previous post, but remember, the
"delta = 0x01" I print, not the original driver.

  In https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
file on line 464 approximately, I wrote:

dev_info(&port->dev, "%s - delta=0x%02X\n", __func__, delta);


2014-04-14 2:06 GMT-04:30 Kijam López <kijamve-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> By testing, sometimes even when ENQ command, if they leave these four lines:
>
> ch341_update_line_status - multiple status change
> ch341_update_line_status - delta = 0x01
> ch341_update_line_status - multiple status change
> ch341_update_line_status - delta = 0x01
>
> Always gives Timeout. Apparently there is the problem ... I think XD.
>
> The problem with the driver gives me the kernel 3.12.6 original, a
> despairing attempt to update the two files you mentioned, but still
> always feel the same. Always respond timeout.
>
>
> 2014-04-14 1:02 GMT-04:30 Kijam López <kijamve-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> All commands and responses are formatted: STX data ETX LRC (I replace
>> No printable Char for [space]0xXX[space])
>>
>> If I sent a ENQ answers his state, which is 2 bytes, so replies:  0x02
>> `@ 0x03 # (`@ is a two-byte mask representing the internal state of
>> the device)
>>
>> If sending the S1 command, which is " 0x02 S1 0x03 a", I should say
>> something like this:
>> " 0x02 S100 0x0A 00000000000000000 0x0A 00000479 0x0A 00000 0x0A
>> 00000330 0x0A 00000 0x0A 0061 0x0A 0000 0x0A X-XXXXXXXX 0x0A XXXXXXXXX
>> 0x0A 221715 0x0A 120414 0x0A  0x03  0x1B "
>>
>> In Windows OS, it works perfectly with the same PC and the same USB
>> adapter. But Linux is not responding. Or respond but the driver is not
>> interpreted correctly.
>>
>> My Kernel is 3.12.6, but i updated from GitHub this file an rebuild
>> this drivers:
>> https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
>> https://github.com/torvalds/linux/blob/master/drivers/usb/serial/usb-serial.c
>> (commit d9a38a8741fdffabc32e6d0943b1cdcf22712bec)
>>
>>
>> 2014-04-14 0:53 GMT-04:30 Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>:
>>> On Mon, Apr 14, 2014 at 12:16:40AM -0430, Kijam López wrote:
>>>> I reported here:
>>>>
>>>>      https://bugreports.qt-project.org/browse/QTBUG-38305
>>>>
>>>> But just migrate my APP to ANSI C and is exactly the same.
>>>>
>>>> My code test in ANSI C:
>>>>
>>>>      <snip>
>>>>      Test command: Fail
>>>
>>> I'm confused, what should it do?
>>>
>>> And what kernel version are you using here?
>>>
>>> thanks,
>>>
>>> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
       [not found]     ` <CAMkwOQa4Wm9vnyDce_tkf3J=h73A3NfX3oAwTaOUeEVduStC4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-04-14 10:13       ` Karl Palsson
  2014-04-14 16:25         ` Kijam López
  0 siblings, 1 reply; 11+ messages in thread
From: Karl Palsson @ 2014-04-14 10:13 UTC (permalink / raw)
  To: Kijam López
  Cc: Greg KH, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA



On Sun, Apr 13, 2014 at 08:51:56PM -0430, Kijam López wrote:
> The following code works for me correctly in Windows, but Linux does
> not work. I am using the same PC, both operating systems are installed
> native. I do not use virtual machine. I need to work on Linux. I have
> tried in different linux distributions and does not work anywhere.
[snip]
>       if(!serial.setParity(QSerialPort::EvenParity))
>             qCritical()<<"Error in setParity";

the ch34x driver does not (yet) support parities other than None.  It doesn't report a
failure though, it just simply ignores it altogether.

If you're actually working with an even parity device, you're going to have all sorts of
not-fun.  I've got a patch here: http://www.spinics.net/lists/linux-usb/msg105238.html
but I've not (yet) resubmitted it after Johan Hovold's comments

Cheers,
Karl P
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Driver CH341 USB Adapter Serial Port not Works in Linux
  2014-04-14 10:13       ` Karl Palsson
@ 2014-04-14 16:25         ` Kijam López
  0 siblings, 0 replies; 11+ messages in thread
From: Kijam López @ 2014-04-14 16:25 UTC (permalink / raw)
  To: Karl Palsson; +Cc: Greg KH, linux-usb, linux-serial

Yes! Thank you so much, do not know how many days I had trying to make
it work :D. That patch worked perfectly me, now if I works perfect. I
look forward to mourn :'(.

I do not understand why not even include that patch in the Kernel.



2014-04-14 5:43 GMT-04:30 Karl Palsson <karlp@tweak.net.au>:
>
>
> On Sun, Apr 13, 2014 at 08:51:56PM -0430, Kijam López wrote:
>> The following code works for me correctly in Windows, but Linux does
>> not work. I am using the same PC, both operating systems are installed
>> native. I do not use virtual machine. I need to work on Linux. I have
>> tried in different linux distributions and does not work anywhere.
> [snip]
>>       if(!serial.setParity(QSerialPort::EvenParity))
>>             qCritical()<<"Error in setParity";
>
> the ch34x driver does not (yet) support parities other than None.  It doesn't report a
> failure though, it just simply ignores it altogether.
>
> If you're actually working with an even parity device, you're going to have all sorts of
> not-fun.  I've got a patch here: http://www.spinics.net/lists/linux-usb/msg105238.html
> but I've not (yet) resubmitted it after Johan Hovold's comments
>
> Cheers,
> Karl P
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-04-14 16:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-14  0:49 Driver CH341 USB Adapter Serial Port not Works in Linux Kijam López
2014-04-14  1:20 ` Greg KH
2014-04-14  1:21   ` Kijam López
2014-04-14  1:44     ` Greg KH
2014-04-14  4:46       ` Kijam López
2014-04-14  5:23         ` Greg KH
2014-04-14  5:32           ` Kijam López
2014-04-14  6:36             ` Kijam López
     [not found]               ` <CAMkwOQZe2Gr8YFXGOqdBMiG6nTJj-waJRa9sR2xcnwRuLpRAOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-14  6:42                 ` Kijam López
     [not found]     ` <CAMkwOQa4Wm9vnyDce_tkf3J=h73A3NfX3oAwTaOUeEVduStC4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-14 10:13       ` Karl Palsson
2014-04-14 16:25         ` Kijam López

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.