[haiku-commits] haiku: hrev44381 - src/add-ons/kernel/drivers/ports/usb_serial

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 22 Jul 2012 20:53:12 +0200 (CEST)

hrev44381 adds 1 changeset to branch 'master'
old head: 8899214980d031c69441a29c5c122e3fd592d0b7
new head: 7e67ec90a46ec4202ab7e4f7b0e07cf398200f45

----------------------------------------------------------------------------

7e67ec9: usb_serial: Set option driver to use the last found port.
  
  * Add a warning when >1 port is found (as we only use the
    last found serial port)
  * Verified working, remove if 0.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44381
Commit:      7e67ec90a46ec4202ab7e4f7b0e07cf398200f45
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7e67ec9
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Sun Jul 22 18:48:57 2012 UTC

----------------------------------------------------------------------------

2 files changed, 13 insertions(+), 7 deletions(-)
.../kernel/drivers/ports/usb_serial/Option.cpp     |   16 +++++++++++++---
.../drivers/ports/usb_serial/SerialDevice.cpp      |    4 ----

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp 
b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp
index d82812d..2041d8f 100644
--- a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp
+++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp
@@ -24,6 +24,7 @@ OptionDevice::AddDevice(const usb_configuration_info *config)
 {
        TRACE_FUNCALLS("> OptionDevice::AddDevice(%08x, %08x)\n", this, config);
 
+       int portsFound = 0;
        if (config->interface_count > 0) {
                for (size_t index = 0; index < config->interface_count; 
index++) {
                        usb_interface_info *interface = 
config->interface[index].active;
@@ -61,17 +62,26 @@ OptionDevice::AddDevice(const usb_configuration_info 
*config)
                        if (txEndpointID < 0 || rxEndpointID < 0 || 
irEndpointID < 0)
                                continue;
 
-                       TRACE("> OptionDevice::%s: found at interface %d\n", 
__func__,
+                       TRACE("> OptionDevice::%s: found port at interface 
%d\n", __func__,
                                index);
+                       portsFound++;
+
                        usb_endpoint_info *irEndpoint = 
&interface->endpoint[irEndpointID];
                        usb_endpoint_info *txEndpoint = 
&interface->endpoint[txEndpointID];
                        usb_endpoint_info *rxEndpoint = 
&interface->endpoint[rxEndpointID];
                        SetControlPipe(irEndpoint->handle);
                        SetReadPipe(rxEndpoint->handle);
                        SetWritePipe(txEndpoint->handle);
+               }
 
-                       // We accept the first found serial interface
-                       // TODO: We should set each matching interface up (can 
be > 1)
+               // TODO: We need to handle multiple ports
+               // We use the last found serial port for now
+               if (portsFound > 0) {
+                       if (portsFound > 1) {
+                               TRACE_ALWAYS("> OptionDevice::%s: Warning: 
Found more than one "
+                                       "serial port on this device (%d). Only 
the last one is "
+                                       "is used.\n", __func__, portsFound);
+                       }
                        return B_OK;
                }
        }
diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp 
b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp
index e3d1694..e8bb192 100644
--- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp
+++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp
@@ -760,9 +760,6 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
                }
        }
 
-       #if 0
-       // Not yet working
-
        // Option Serial Device
        for (uint32 i = 0; i < sizeof(kOptionDevices)
                / sizeof(kOptionDevices[0]); i++) {
@@ -772,7 +769,6 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
                                kOptionDevices[i].deviceName);
                }
        }
-       #endif
 
        // Otherwise, return standard ACM device
        return new(std::nothrow) ACMDevice(device, vendorID, productID,


Other related posts:

  • » [haiku-commits] haiku: hrev44381 - src/add-ons/kernel/drivers/ports/usb_serial - kallisti5