Author Topic: USB serial connector  (Read 1860 times)

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 94
  • Posts: 1125
    • View Profile
Re: USB serial connector
« Reply #30 on: July 08, 2017, 07:35:07 pm »
For completeness, here's the output of an actual USB Modem, which sadly stopped working after a power outage.
Quote
<<< Device Description >>>
 Type            : 01
 USB Rev         : 200
 Class           : Communication
 Subclass        : Reserved(0)
 Protocol        : No class specific protocol required
 Max. packetsize : 40
 Vendor  ID      : 0BAF
 Product ID      : 0303
 Device Release# : 0200
 Strings:
  Manufacturer Name : U.S.Robotics
  Product Name      : USB Modem
  Serial number     : 0000002
 Number of Configurations : 1

 Configuration 0 :
  Lenght     : 67
  Name       : <NONE>
  Value      : 2
  Attributes : 0x80
  Power      : 360 mA
  Interfaces : 2

  Interface 0
   Alt Setting : 0
   Name        : AltIf0
   Class       : Communication
   SubClass    : Abstract Control Model (Modem)
   Protocol    : RESERVED (future use)
   Endpoints   : 1
Class-Specific Interface Descriptor, Size : 5
Class-Specific Interface Descriptor, Size : 5
Class-Specific Interface Descriptor, Size : 5
Class-Specific Interface Descriptor, Size : 4

   Endpoint 0:
    Address     : 82
    Attributes  : 03
    Packetsize  : 0010
    Interval    : 10

  Interface 1
   Alt Setting : 0
   Name        : AltIf0
   Class       : Unknown class 0A
   SubClass    : Unknown Subclass 0A
   Protocol    : Unknown Protocol 0A
   Endpoints   : 2

   Endpoint 0:
    Address     : 01
    Attributes  : 02
    Packetsize  : 0200
    Interval    : 0

   Endpoint 1:
    Address     : 81
    Attributes  : 02
    Packetsize  : 0200
    Interval    : 0

Lars

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 21
  • Posts: 164
    • View Profile
Re: USB serial connector
« Reply #31 on: July 09, 2017, 06:30:49 pm »
Tried both ZOC and InJoy on COM2 and am able to communicate using AT commands! OK, I'm convinced it will work so now I need a SIM card. Looks like T-Mobile has a 'data only' add-on package.... thanks everyone for bringing this to my attention!

In the meantime I have updated USBCOM.SYS. I also added a switch /PROLFIC:vid:pid that allows to specify a vendor id (vid) and product id (pid) to be treated as a Prolific device. Then I fixed some shortcomings in the driver. Leave me your email message privately if you want to test it.

Lars

Valery Sedletski

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 8
  • Posts: 71
    • View Profile
Re: USB serial connector
« Reply #32 on: July 10, 2017, 11:11:47 am »
2David McKenna: A very good terminal emulator is DTerm: https://sites.google.com/site/os2acw/dterm_b10.zip. ZOC will work too, or any other terminal program.

André Heldoorn

  • Sr. Member
  • ****
  • Thank You
  • -Given: 46
  • -Receive: 9
  • Posts: 276
    • View Profile
Re: USB serial connector
« Reply #33 on: July 10, 2017, 02:57:25 pm »
am able to communicate using AT commands!

As a matter of fact, as usual it's quite likely that a HP Probook has a physical serial port. Disguised as a docking port. The other end of this port, a docking station or port replicator, could look like this:

« Last Edit: July 10, 2017, 03:04:21 pm by André Heldoorn »

Lars

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 21
  • Posts: 164
    • View Profile
Re: USB serial connector
« Reply #34 on: July 11, 2017, 10:46:20 am »
2Lars: USB modems usually have many interfaces, for example, my Huawei E367 3G modem has the following:

Quote
Identifier: 12d1:1506

As you can see, it has interfaces 0-3 with Vendor-specific class 0xff (Prolific-compatible). And interfaces 4-5 with Mass-Storage class (ZeroCD and microSD).  Another device (Ericsson F3507g WIreless Modem/GPS) works for me too. It has the following report:

Quote
USB Dock: Unknown device
Identifier: 0bdb:1900

It has class something called "CDC data". Here there are 10 interfaces. I'm not sure how it works in OS/2, but I see the 1st COM port on it, and it can be used to establish the connection.

As I can see, USBCOM .SYS takes only 1st Communication interface found on each device. So, for a full support, we need support for multiple communication interfaces.

You should know this: the USB driver stack is very "open" to what client/class driver accepts what device. For as long as ALL claimed interfaces are in one and the same USB configuration it is possible that multiple drivers claim the very same device. The OS/2 USB Driver stack is not very good at detecting any conflicts between multiple client divers and if a client driver claims a device where it should not, this can have catastrophic consequences. I had this problem with a device that contained a USB microphone (handled by USBAUDIO.SYS) and a virtualized CD-ROM drive (handled by USBMSD.ADD) ...
Additional note: Fortunately, there are very few devices that have more than 1 USB configuration (descriptor), therefore the initial restriction almost never has any practical consequences. The reason for this restriction is obvious: if a client driver were allowed to change the configuration, it would potentially make the device unusable for another client driver claiming the same device.
In short: it is possible for USBMSD.ADD to claim a device because it has an MSD function built in and additionally by USBCOM.SYS because it also contains COM function.

From your second example I also saw that the COM control/data class Interface combination is offered multiple times.
I you now think that maybe you could offer these as multiple COM ports: that is not possible under OS/2 as the device names are queried by OS/2 only during bootup. It is not possible to dynamically add COM port names to the device name list.
In short: USBCOM.SYS supports only one COM port for exactly this reason.
« Last Edit: July 11, 2017, 10:50:48 am by Lars »

David McKenna

  • Full Member
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 7
  • Posts: 168
    • View Profile
Re: USB serial connector
« Reply #35 on: July 16, 2017, 01:43:36 am »
@Lars: I left you a PM about testing your USBCOM.SYS driver. I was also wondering if you knew anything about using the /M switch listed at http://www.edm2.com/index.php/USBCOM.SYS? Is it even available in your version? I understand that multiple USB COM ports cannot be dynamically installed after boot, but can they be defined at boot time (for permanently installed devices)?

@André: Yes, this HP laptop has 1 COM port (and parallel too) built in and can be used with a dock. The broadband USB modem is on COM2.

Valery Sedletski

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 8
  • Posts: 71
    • View Profile
Re: USB serial connector
« Reply #36 on: July 17, 2017, 03:24:50 am »
2David McKenna: Multiple USB COM port indeed work if you install multiple copies of USBCOM.SYS (specifying different COM ports for each copy)

Valery Sedletski

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 8
  • Posts: 71
    • View Profile
Re: USB serial connector
« Reply #37 on: July 17, 2017, 03:31:42 am »
2Lars:

> It is not possible to dynamically add COM port names to the device name list.

But it is possible to reserve several COM port names for one USBCOM.SYS instance at boot time, and then use it when USB device is inserted.

Lars

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 21
  • Posts: 164
    • View Profile
Re: USB serial connector
« Reply #38 on: July 17, 2017, 10:05:50 am »
2Lars:

> It is not possible to dynamically add COM port names to the device name list.

But it is possible to reserve several COM port names for one USBCOM.SYS instance at boot time, and then use it when USB device is inserted.

That is true but that is not how USBCOM.SYS currently works.
If you'd use multiple instances of USBCOM.SYS then this problem happens: USBD.SYS offers EACH device to ALL client drivers for service. If you have multiple instances of USBCOM.SYS an attached device will be offered to ALL of them. So: which driver instance is taking what device ?
Secondly, if a device offers MULTIPLE communication Interfaces, USBCOM.SYS will only ever pick the first communication Interface that it finds.
USBCOM.SYS would need a major rewrite to work the way you intend. And if you did a rewrite it would certainly be better to only have one instance of USBCOM.SYS to serve all COM devices because that greatly simplifies things. What would be possible is to have USBCOM.SYS support a fixed maximum number of COM port names (just as you said).

The current "strategy" of USBCOM.SYS is to only offer one COM port and to use a second (third, fourth, fifth, ...) device as a "backup" device to take over if the currently active device starts to fail/become unresponsive. I guess this was done for some customer who requested fault tolerance.


In short: no way with the current USBCOM.SYS to achieve what you intend to achieve.

Lars
« Last Edit: July 17, 2017, 10:12:03 am by Lars »

Lars

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 21
  • Posts: 164
    • View Profile
Re: USB serial connector
« Reply #39 on: July 17, 2017, 10:09:26 am »
@Lars: I left you a PM about testing your USBCOM.SYS driver. I was also wondering if you knew anything about using the /M switch listed at http://www.edm2.com/index.php/USBCOM.SYS? Is it even available in your version? I understand that multiple USB COM ports cannot be dynamically installed after boot, but can they be defined at boot time (for permanently installed devices)?

@André: Yes, this HP laptop has 1 COM port (and parallel too) built in and can be used with a dock. The broadband USB modem is on COM2.

Yes, my driver supports all switches listed plus the /Z Switch (for Prolific specific handling of CTS) and now the /PROLIFIC Switch (to specify an arbitrary device to be a prolific device).
But /M: is useless for your case. It just limits the number of backup devices. See my other post.