USB and OS/2 (Part 3: Divide and conquer... up to 127)

By Jonas Buys

OS/2 and hardware... For more than a decade, OS/2 has been misjudged to have very limited hardware support. But in fact, if you dig some further, you'll notice that OS/2 Warp and eComStation offer extreme large and powerful hardware support. Recently, a whole lot has changed ever since USB support became available for OS/2. Over the last two or three years, IBM has provided us with some great device drivers, which enable the use of a great deal of older and modern USB devices with OS/2 Warp family of operating systems. The upcoming series of articles will discuss all IBM USB drivers thoroughly, and list a lot more OS/2 compatible devices and chipsets than the very limited number IBM tested with the drivers. Most USB controllers you can buy today come with four to five USB sockets at most. However, most new computers, and especially notebooks only come with one or two USB ports! With so many devices on the market today (read: devices that work with OS/2) you easily run out of sockets very quickly. For example, suppose you're using a USB memory stick, a USB Ethernet card, an external USB 2.0 hard disk drive, and a USB scanner. What to do if you need to use a USB printer too? Running out of ports too? Does this imply that you are limited to four of five USB devices? Not at all! As already pointed at in my previous article about USB Controllers, the USB technology supports up to a maximum of 127 devices, and hubs are a central part of this standard. This article will cover USB hubs, something IBM daren't breathe a word about, but just because you can't find any information about it, that doesn't mean that USB hubs should not be supported.

As of writing, the latest IBM USB Basic device drivers are dated February 7th, 2003 (version 10.117, build10.097).

1. The USB concept

Universal Serial Bus, in short USB, is a very powerful and flexible technology, as pointed out in the previous articles. This article will deal with USB hubs, a way to extend that flexibility to unlimited heights (the limit is only 127). USB allows for multiple peripherals to be plugged into a single USB port and addressed concurrently. This can be done by branching a USB hub to one of the sockets of the USB host controller, thereby applying some kind of divide 'n conquer strategy; compare it with recursion; you divide the &quot;problem&quot; to similar problems of smaller size, each problem is in fact the necessity to have one functioning USB peripheral. Let's look at an example in the figure at the left: you see one usb cable (red wire) leaving the computer; in this model we have attached that cable a USB hub, a certain model TU-400E, which is a 4-port bus-powered hub. The wire connecting the computer and the hub, is plugged in in one socket of the computer's USB controller, and at the Hub side, it is also plugged into one socket. A hub is in fact the &quot;person&quot; that applies the divide strategy, and the USB &quot;protocol&quot; is the one that applies the conquer strategy. At the hub in the image, you see four wires leaving; one to a scanner, another to a modem, yet another to a printer and again another to a camera. The hub feeds all these four devices with power from the computer, and correctly initializes the peripherals for use on the USB bus. Now, suppose we extend this picture. Suppose we have an Liquid Crystal Display Screen, in which a hub is included (this very same example applies with p.e. keyboards that come with a USB hub included). Of course, we connect the LCD Screen with the video connector on the video card with a special connector (for example, S-Sub). However, we want to attach the new USB peripheral (the built-in USB hub) to the USB chain; However, our TU-400E hub has only four ports for attaching USB peripherals. That means we lack one socket. No problem, unplug one device (scanner, camera, printer or modem), and instead of that peripheral connect the new built-in hub, and then attach the removed device to the new build-in USB hub, in the LCD Screen. This is the principle of USB hubs: you can add as many hubs to the chain as you want, and then attach USB peripheral devices (modems, printers, cameras, USB memory keys, ...) to the hub. The only thing you must think of is the length of the USB chain, and the number of devices (though it's very unlikely to have more than 127 USB devices, since the USB speed would then become awfully slow).

1.1. How hubs work

Hubs are the physical connection to the USB bus. The USB port on the computer is both a controller and a hub. While many computers have two USB ports, they may be connected to the same controller. Each controller provides 12 Mbps (approximately 1.5MBps) of bandwidth. When multiple devices are connected to a single USB controller, each one shares the controller's bandwidth. Some desktop motherboards have two USB controllers; two peripherals do not share bandwidth if plugged into different controllers. Up to 127 peripherals can (theoretically) be connected to a single controller. Hubs allow the physical connection of multiple peripherals to the USB controller. Hubs also provide power for peripherals. External hubs are connected to the USB port on a computer to provide additional ports. Active (or self-powered) hubs provide additional USB ports for peripherals and require power which usually comes from an external power supply. Active hubs provide 500 mA to each USB port. Passive (or bus-powered) hubs provide additional USB ports and are powered by the computer (or an active hub). Passive hubs divide power among the USB ports and are useful only for low power peripherals.

USBPre functions best when it is the only device connected to a host controller, giving it full USB bandwidth. USBPre must be plugged into either an active hub or directly into the PC, since it is a high power USB peripheral.

CABLING!!!

root hub &lt;-&gt; extra ext. hub

werking + vanaf nu refereren we met de term usb hub aan een externe &quot;verdeler&quot;.

IF YOU TYHOUGHT YOU COULD ORDER A 127-PORT USB CONTROLLER?THEN YOU4RE MISTAKING.

KATTEKOP

Just because IBM it, that doesn't necessarily mean that USB hubs are not supported.

What is a USB hub ?

directly to your computer or to another hub) and multiple downstream ports.
 * USB hub typically consists of a single upstream port (designed to connect

How Many USB hubs can I connect together ?

defined by the number of hubs a device's signal must pass through before it reaches the host. For example, using a 4-port USB hub, you could connect a theoretical maximum of 341 hubs in five tiers, this would leave you with an incredible 1024 ports to connect USB devices! But you should only connect 127 devices together at any time.
 * In total you should only connect 5 tiers of USB hubs together. A tier is

What kind of cables do I use with USB?

type (upstream) connectors. Unshielded USB cables running at 1.5Mb will have a maximum cable length of 3 meters. Shielded USB cables running at 12MB will have a maximum cable length of 5 meters. This simple scheme will ensure that users will not be able to plug cables in wrong, since the connectors are unique in size and shape.
 * USB cable will usually have both &quot;A&quot; type (downstream) and &quot;B&quot;

What software is needed to get the USB Hub to work?


 * No software is required as long as your computer can support USB Devices.

How far can a USB Device be away from the USB Hub?

Hub.
 * 5 meters is the maximum distance between each connected device and the USB

How fast is the the Data Transfer rate for the USB hub?


 * The USB Hub supports low speed (1.5 Mbps) up to full speed (12 Mbps).

1.2. USB hub versus switch

USB Switches support sharing either a single USB device among multiple USB computers, or one USB computer switching between multiple USB devices. These Switch boxes are useful in testing environments and instances where sharing of USB peripherals among computers is required. The downstream ports let you connect up to different computers equipped with one or more USB port(s). An upstream port can connect with just about any peripheral. You can share a printer, scanner, or hard drive by pushing some kind of ''Selector Button'' on the front or side of the switch. The selected computer becomes the active computer, and you can access the peripheral. Want to share multiple peripherals with up to four computers? To use more than one peripheral, connect an USB Hub to the switch and then connect additional USB devices to the Hub. The selected computer can access the peripherals you've connected.

EN OP OS/2????

1.3. 128 is the limit

waarom deze limiet? 2^7=128

1.4. Some common USB Terminology...

This article will not discuss the many reasons why USB is inferior to other technologies like e.g. SCSI, nor explain the technical details about USB (for that, please refer to my previous article about USB controllers). Fact is, despite of its limited performance (and this performance limit doesn't matter with today's modern Hi-Speed USB 2.0) USB is a great technology, since it combines ease of use, compatibility with all major operating systems, and especially mobility (USB memory keys, USB Ethernet NICs). Unfortunately, there often seems to be some misunderstanding related to USB terminology when discussing the Universal Serial Bus technology. That&#8217;s why a brief and clear overview is given here:

So far for a brief overview of technologies. Now, in the &quot;USB technology family&quot;, there are some variants: First, for USB 1.1 (or for USB 2.0 cards that can also use USB 1.1 devices), we have UHCI and OHCI. UHCI is short for Universal Host Controller Interface. It is one particular direction in the USB controller interfaces. It is used by Intel and VIA chipsets. Other brands also can be compatible with UHCI. This is the real standard for USB 1.1. nVideo nForce is also UHCI. A kind of equivalent of UHCI is OHCI, Open Systems Host Controller Interface. It's another particular direction in USB 1.1, and is mainly used in chipsets branded by SiS, ALi, Opti and Cyrix (Gnode). Then, there EHCI: Enhanced Host Controller Interface. This is a direction that enables USB 2.0, more to say USB Hi-Speed. All of these variants are supported using OS/2 Base USB Device Drivers.

2. Chipsets

Chipsets usually are a problem, since manufacturers often just refuse customers such information. Unlike USB host controller chipsets (like VIA VT6202, NEC &micro;7201, ...), USB hub controllers are so tiny small and well hidden behind a cool hub-design, that you will have a lot of trouble finding out what chipset is used. The following table lists some of the most wide-spread USB hub controllers that are compatible with OS/2 Warp. Normally ALL USB 1.1 (OHCI and/or UHCI) hubs should work perfectly with OS/2 Warp. As for USB 2.0 hubs, you shouldn't experience any troubles with IBM's very latest OS/2 Base Device Drivers.

There are still other chipsets that OS/2 CHL hardware testing team have not tested, but normally, every USB hub available should work perfectly with the latest IBM OS/2 Base Device Drivers.

3. What you should mind when choosing a USB hub

3.1. Shared bandwidth

As the name implies itself, Universal Serial Bus is a serial bus technology. That means that the bandwidth (1.5 Mbps for USB 1.0, 12 Mbps for USB 1.1, 480 Mbps for Hi-Speed USB 2.0) is shared among all devices connected to your controller. Suppose you've got a USB controller with three ports. To the first port you have attached a USB Memory Key, and to the second one is your 4-port USB hub. Let's suppose you've attached a USB modem to the hub, and also a USB harddisk. First of all, your bandwidth is being divided between your USB memory key, and your USB hub, and then at the hub, the available bandwidth there is again divided for each device attached to it. Once you have discovered the many advantages of USB, you'll rapidly have a broad range of devices at your home.

A hub is a perfect solution, but if you have a lot of devices, the USB performance can become very disappointing, since every USB device requires Input/Output bandwidth, and all share the same maximal bandwidth offered by the USB controller. Therefore, let us take a look at some USB devices and how much bandwidth they require. Study the table at the right. The red x'es indicate USB devices that require a lot of data traffic (thus also bandwidth), and thus, you should NOT attach them to a USB hub, unless you are obliged to. Instead, it would be wise to connect these devices individually to a USB socket of the USB controller in your PC. The green x'es indicate USB devices that can be connected to a hub and that won't degrade the USB performance too much. However, a lot of USB devices attached to one specific USB chain will lead to performance loss. If you have a USB 2.0 system, a limited number of red marked USB device types can be attached to a USB hub without too slow performance.

NOG / Hoe wordt bandwidth verdeeld bij hub?

available on the OS/2 Warp platform family. 2.0 bus, //////
 * Please note that at this moment of writing, no USB WebCam solutions are
 * On a USB 1.1 system, this could slow down the USB bus. However, on a USB

3.2. To be bus powered or not to be

Hubs can be powered or unpowered. The USB standard allows for devices to draw their power from their USB connection (from the PCI USB controller in your PC). This is called Bus Powered. Obviously, a high-power device like a printer or scanner will have its own power supply, but low-power devices like mice and digital cameras get their power from the bus in order to simplify them. The power (up to 500 mA at 5 V) comes from the computer. If you have lots of self-powered devices (like printers and scanners), then your hub does not need to be powered; none of the devices connecting to the hub needs additional power, so the computer can handle it. If you have lots of unpowered devices like mice and cameras, you probably need a powered hub. This is indicated by the term Self Powered. The hub has its own transformer and it supplies power to the bus so that the devices do not overload the computer's supply. Is a power supply really needed for a hub? The answer to this question depends of some factors:

Hubs allow the physical connection of multiple peripherals to the USB controller. Hubs also provide power for peripherals. External hubs are connected to the USB port on a computer to provide additional ports. Active (or self-powered) hubs provide additional USB ports for peripherals and require power which usually comes from an external power supply. Active hubs provide 500 mA to each USB port. Passive (or bus-powered) hubs provide additional USB ports and are powered by the computer (or an active hub). Passive hubs divide power among the USB ports and are useful only for low power peripherals.
 * The more devices you attach to the hub, the more power it will request from    the USB controller, and thus of the computer. Of course, for a desktop PC     that is not really a problem, but if you use a laptop, then power does become     an issue, even when you have recent Li-batteries. The problem is that hubs     for notebooks need to be compact in size and that there is often no power     point around when using them. If you use a bus powered USB hub to connect     both a USB mouse and a USB memory key to your laptop, you'll notice that your     battery will last a lot less than if you would only use a USB mouse, so keep     this in minds when purchasing notebook accessories.
 * Hi-Speed USB devices will request more power of the controller. In fact,    most USB 2.0 hubs will actually be shipped with an external power adapter     most of the time. The power supply is not needed if using low speed devices     such as joysticks, mice and keyboards.

3.3. USB 1.1 or 2.0?

4. Installation (IBM OS/2 Warp platform family)

Just install IBM's latest OS/2 Basic USB Support driver, downloadable via Device Driver Pack Online with an active valid SoftWare Choice or PassPort Advantage subscription, and follow the instructions below. You can also download the latest USB driver pack on the eComStation.com download section, if you have access to it (requires login and password). To install the Base USB Support device drivers, please refer to USB and OS/2, Part 1: Basic USB support: controllers, sections 2.1 and 2.3. As soon as this driver is installed, and you have rebooted and the driver(s) are initialized and loaded successfully, you can plug in your hub at any time, and after a few seconds you'll be ready to use it.

5. OS/2 CHL Tested USB Hubs

Below, only a limited listing has been included at date of writing. However, if you visit [], you'll have access to the latest table with tested USB hubs that is constantly synchronized with OS/2 CHL hardware list.

6. And what about Linux?

In theory, all USB 1.1 hubs should work correctly vanaf KERNEL ??? (met usb drvs)

USB 2.0 Hubs have &quot;Transaction Translators&quot;

OK, this section talks about what makes USB 2.0 tricky. And it's not all that user visible, so you can safely skip reading it if you're one of the many Linux users who just wants a top quality OS (or a Free one) and aren't very concerned about all the underlying technology.

If you're writing a device driver, you may want to know about this, since it can affect how you write your driver. At this writing, not all transaction translator features are used by Linux. Also, since those code paths aren't used much yet, a number of shortcuts have been taken, which limit throughput. (Someone will surely provide a patch to remove those shortcuts if/when they become troublesome.)

Using Transaction Translators

From the perspective of a Linux USB 2.0 host, there are two ways it talks to USB 1.1 devices through transaction translators. Some requests do this almost transparently, like control requests and (full speed only) bulk data transfer. In those cases, the host must tell the EHCI controller that it's talking through a transaction translator, and maybe be ready to recover from some errors, but for most purposes there's control and bulk requests are completely &quot;hands off&quot;. That means many USB 1.1 device drivers will continue to work just fine through a USB 2.0 hub ... many network adapters, modems, digital still cameras, MP3 players, disk drives, and similar devices won't need anything more.

Then there are the requests that need a lot of hands-on attention: periodic transfers like interrupt and (full speed only) isochronous ones. Because these are all reserved-bandwidth transacton types, they can't be automated as readily as control and bulk (which can opportunistically make progress whenever periodic transfers aren't active). The result is a lot of hub-related complexity in the EHCI driver, making sure that the periodic transfers are safely scheduled and that transaction translators don't get overcommited. Periodic transfers are already the most complex type in USB (though their API got simpler in the Linux kernel 2.5 series), so to some extent it's just one more consideration when scheduling,

For example, suppose a USB 1.1 periodic transfer is to be worked on every eight frames (milliseconds). That's going to go through a specific transaction translator; the transfer needs a time when that translator isn't in use, and when there's also bus bandwidth. The EHCI driver needs to schedule a &quot;start split&quot; (a bit in an 's-mask') sometime in one microframe, and a &quot;complete split&quot; (bits in a 'c-mask') in some later microframe, and ensure that between the start and completion no other request uses that translator. Isochronous transfers can be bigger, and are managed by EHCI using a different type of data structure, but in both cases you can see that there's a fair amount of housekeeping involved in tracking what requests are active.

7. Conclusion

USB hubs can be used without any problems using a recent version of IBM's USB Basic OS/2 device drivers. Hubs can extend the power of USB by offering you the ability of using more devices simultaneously, while dividing the available USB bandwidth. Too many devices on one USB chain can seriously degrade performance, especially when using the older USB 1.1 technology. ''Though mobility requirements (p.e. for notebooks) make bus-powered bus an interesting solution, it is recommended to use//////''

''USB 2.0 hubs work, but haven't been widely stressed (especially in terms of faults happening during transaction translation). Warning: don't unplug these hubs with the 2.4.19 code ... a patch is of course available!''

8. References


 * OS/2 Compatible     Hardware List web site: OS/2 and USB web site;
 * OS/2 Compatible Hardware     List web site: hardware list project;
 * IBM OS/2     Warp Device Driver Pak OnLine.