SET_CONTROL_LINE_STATE request
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 2 Sep 2015 02:48:37 +0000 (11:48 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 2 Sep 2015 02:48:37 +0000 (11:48 +0900)
ChangeLog
src/main.c

index 6c6191b..5f16586 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-02  Niibe Yutaka  <gniibe@fsij.org>
+
+       * src/main.c (CDC_CTRL_DTR): New.
+       (usb_cb_ctrl_write_finish): Distinguish DTR accurately.
+
 2015-08-03  Niibe Yutaka  <gniibe@fsij.org>
 
        * VERSION: 1.0.3.
index 3f39dea..9332df8 100644 (file)
@@ -289,6 +289,8 @@ static struct line_coding line_coding = {
   0x08    /* bits:      8         */
 };
 
+#define CDC_CTRL_DTR            0x0001
+
 void
 usb_cb_ctrl_write_finish (uint8_t req, uint8_t req_no, uint16_t value)
 {
@@ -330,7 +332,7 @@ usb_cb_ctrl_write_finish (uint8_t req, uint8_t req_no, uint16_t value)
        {
          /* Open/close the connection.  */
          chopstx_mutex_lock (&usb_mtx);
-         connected = (value != 0)? 1 : 0;
+         connected = (value & CDC_CTRL_DTR)? 1 : 0;
          if (wait_usb_connection)
            {                   /* It is waiting a connection.  */
              if (connected)    /* It's now connected.  */