OpenBSD Journal

Developer blog: Jason [Cypress USB/RS-232 adapters]

Contributed by Jason Wright on from the mo-serial-stuff dept.

Cypress Semiconductor makes programmable USB/serial adapters. These are starting to show up in some of the cheap RS-232 dongles and integrated into some devices, like the Delorme Earthmate GPS.

A driver for these devices has been committed to the tree: ucycom(4). This driver is interesting because it required hacking in several related places: uhidev(4) and ucom(4).

uhidev is used by devices that are Human Interface Devices (usually mice, keyboards, tables, etc). The Cypress USB devices show up as HIDs but missing some otherwise normal stuff.

USB uses endpoints (an address on the device) and pipes (an unidirectional byte stream) for communication between the host and a device. Several different types of pipes are available: interrupt, configuration, and bulk. Each type has different uses and properties.

uhidev(4) made the assumption that there was only one interrupt pipe: a flow from the device to the host to handle high priority events (mouse movement, keyboard events, etc). Cypress two interrupt pipes for communication: host to device and device to host, so uhidev needed to allocate the new pipe and deal with it.

ucom(4) made the assumption throughout the driver that all of its i/o happened on bulk input or output pipes. Again, Cypress uses interrupt pipes for all communication instead requiring a split in the driver to handle either type of pipe.

The upshot of all this is that the Delorme Earthmate now works in current (and what will be 4.0), but some RS-232 devices are still broken. I need one of the broken ones to see what I can do to fix it.

(Comments are closed)


Comments
  1. By Anonymous Coward (24.148.72.216) on

    So what devices are broken?

    Any of them affordable? Available via an Amazon wishlist or some other easy mechanism to let some random philanthopist send you one?

    Comments
    1. By Jason Wright (68.101.39.147) jason@openbsd.org on http://www.thought.net/jason

      > So what devices are broken?
      >
      > Any of them affordable? Available via an Amazon wishlist or some other easy mechanism to let some random philanthopist send you one?

      I don't know what products they are in, but they show up as:

      uhidev0: Cypress Semiconductor USB to Serial, rev 1.00/0.00

    2. By Jason Wright (68.101.39.147) jason@openbsd.org on http://www.thought.net/jason

      > So what devices are broken?
      >
      > Any of them affordable? Available via an Amazon wishlist or some other easy mechanism to let some random philanthopist send you one?

      To expand on what I said... One of the problems with writing device drivers is that I often know what chip I'm talking about, but there is little (usually no) connection to the actual product name. I know what I'm looking for is devices based on the Cypress CY7C637xx and CY7C640/1xx.

      Comments
      1. By Amir S Mesry (208.52.133.98) on

        > > So what devices are broken?
        > >
        > > Any of them affordable? Available via an Amazon wishlist or some other easy mechanism to let some random philanthopist send you one?
        >
        > To expand on what I said... One of the problems with writing device drivers is that I often know what chip I'm talking about, but there is little (usually no) connection to the actual product name. I know what I'm looking for is devices based on the Cypress CY7C637xx and CY7C640/1xx.
        >

        If it's what I think it is, it's one of the TripLite USB to Serial Cables you can get for $40 from CDW. I will check tonight.

        Comments
        1. By Jason Wright (65.202.219.66) jason@openbsd.org on http://www.thought.net/jason

          > If it's what I think it is, it's one of the TripLite USB to Serial Cables you can get for $40 from CDW. I will check tonight.

          Please do, and let me know what those are either way. Also, if there are other USB/serial dongles that are not supported (or broken), I'm interested in them.

          Comments
          1. By Anonymous Coward (205.153.56.10) on

            > > If it's what I think it is, it's one of the TripLite USB to Serial Cables you can get for $40 from CDW. I will check tonight.
            >
            > Please do, and let me know what those are either way. Also, if there are other USB/serial dongles that are not supported (or broken), I'm interested in them.

            umct(4) doesn't work (according to the man page) and a couple of quick tests at home.

            Comments
            1. By Jason Wright (65.202.219.66) jason@openbsd.org on http://www.thought.net/jason

              > umct(4) doesn't work (according to the man page) and a couple of quick tests at home.

              Got a spare?

          2. By Aaron Linville (70.108.87.203) aaron@linville.org on http://www.linville.org/

            Please do, and let me know what those are either way. Also, if there are other USB/serial dongles that are not supported (or broken), I'm interested in them.

            Heard about the PalmConnect USB/serial adapter? It's a USB/serial adapter based on the KLSI KL5KUSB105 chipset.

            There is a Linux driver. I started an initial attempt at the driver (header/source), but haven't gotten around to finishing it (my first attempt at kernel driver, be gentle).

          3. By Amir S Mesry (208.52.133.98) on

            > > If it's what I think it is, it's one of the TripLite USB to Serial Cables you can get for $40 from CDW. I will check tonight.
            >
            > Please do, and let me know what those are either way. Also, if there are other USB/serial dongles that are not supported (or broken), I'm interested in them.

            I thought they were the cypress ones, but turns out they are Prolific Chipset based and they work.

            Sorry.

            I do know that some USB modems use those and I think one is the blue one made by Diamond.

      2. By Anonymous Coward (69.70.178.171) on

        > To expand on what I said... One of the problems with writing device drivers is that I often know what chip I'm talking about, but there is little (usually no) connection to the actual product name. I know what I'm looking for is devices based on the Cypress CY7C637xx and CY7C640/1xx.

        I believe I've got one.

        OpenBSD 4.0-beta (GENERIC) #1083: Mon Aug 21 21:24:02 MDT 2006
        deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
        <snip>
        uhidev0 at uhub0 port 1 configuration 1 interface 0
        uhidev0: SemiTech Semiconductor USB to Serial, rev 1.00/0.00, addr 2, iclass 3/0
        ucycom0 at uhidev0
        ucom0 at ucycom0 portno 0
        <snip>

        I'll test and report back to you either here or directly via eMail.

        Comments
        1. By Anonymous Coward (69.70.178.171) on

          I'll test and report back to you either here or directly via eMail.

          I've only had time to attach it to a cizzco switch, but thus far it seems to operate as expected with cu -l /dev/ttyU0. (assuming 8N1,9600)

          Here's some usbdevs info as well:
          Controller /dev/usb0:
          addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00 uhub0
           port 1 addr 2: full speed, power 100 mA, config 1, USB to Serial(0x5500), SemiTech Semiconductor(0x04b4), rev 0.00 uhidev0
           port 2 powered

  2. By maggis (193.167.71.222) on

    OT, but any opinions on the USB/RS-232 chipsets in general? Is this stable, and the driver/chip better than say FTDI chips, which have many new versions and features since the (outdated?) driver was written?
    I'm not afraid of writing code, would only like to know about experiences with this kind of hardware. ATM I'm looking at the mentioned FTDI chips, whose driver certainly would need to be brought up to date for my intentions. Prolific seems a bit shady judging by their WWW site...

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]