Cross-Platform Serial in General
Ned Konz
ned at squeakland.org
Wed Mar 16 19:08:23 UTC 2005
On Wednesday 16 March 2005 10:29 am, Dan Ingalls wrote:
> Ned Konz <ned at squeakland.org> wrote:
> >And MIDI?
>
> This makes me think of more areas where we need nice cross-platform
> support. Namely
>
> USB
> and
> BlueTooth.
>
> Has anyone given some thought to how we might pull all these facilities
> together in a nice uniform manner and then provide necessary VM support so
> that it is wonderfully independent of platform?
>
One problem is that USB doesn't generally present itself as a generic serial
stream (unless you're using a USB to serial converter, in which case it looks
like a standard serial port).
Instead, USB devices have different kinds of interface depending on their
device class -- HID (human interface devices), Storage, etc.
-----
From the USB organization web site:
Device Descriptor bDeviceClass values:
Value Hex Value Descriptor
0 0 Class information at interface level
2 2 Communication (or with WMC 1.0 class information at interface level)
9 9 HUB
220 DC Diagnostic Device (see below for details)
224 E0 Wireless Controller (see below for details)
239 EF Miscellaneous Device Class (see below for details)
255 FF Vendor-Specific
Interface Descriptor bInterfaceClass values:
Value Hex Value Descriptor
1 1 Audio
2 2 CDC-Control
3 3 HID
5 5 Physical
6 6 Image (subclass & protocol must be 1)
7 7 Printer
8 8 Mass-Storage
9 9 HUB
10 A CDC-Data
11 B Chip/Smart Card
13 D Content-Security
14 E Video
220 DC Diagnostic Device (see below for details)
224 E0 Wireless Controller (see below for details)
254 FE Application-Specific (see below for details)
255 FF Vendor-Specific
Device / Interface Class Code Details:
Diagnostic Device (Device/Interface Class Code 220)
SubClass Protocol
1 Reprogrammable Diagnostic Device 1 USB2 Compliance Device
Wireless Controller (Device/Interface Class Code 224)
SubClass Protocol
1 RF Controller 1 Bluetooth Programming Interface
Miscellaneous Device Class (Device Class 239)
SubClass Protocol
2 Common Class 1 Interface Association Descriptor
Application-Specific (Interface Class Code 254)
SubClass
1 Device Firmware Update
2 IrDA Bridge
3 Test & Measurement Class (USBTMC)
-----
And then there's the vendor-specific definitions (like, for instance, a number
of the scanners and USB/serial interfaces), where the protocol isn't even
predictable.
And the way in which the various operating systems expose these APIs varies
considerably.
On some systems, for instance, if you plug in a USB CD drive you won't be able
to talk to it via the more generic USB interface, as that interface will be
owned by the storage driver.
On Linux, there's a userland USB host interface (usbdevice_fs.h) and a USB
client interface (for computers that are USB slaves) (usb_gadgetfs.h). The
USB host interface includes these ioctl calls:
USBDEVFS_CONTROL
USBDEVFS_BULK
USBDEVFS_RESETEP
USBDEVFS_SETINTERFACE
USBDEVFS_SETCONFIGURATION
USBDEVFS_GETDRIVER
USBDEVFS_SUBMITURB
USBDEVFS_DISCARDURB
USBDEVFS_REAPURB
USBDEVFS_REAPURBNDELAY
USBDEVFS_DISCSIGNAL
USBDEVFS_CLAIMINTERFACE
USBDEVFS_RELEASEINTERFACE
USBDEVFS_CONNECTINFO
USBDEVFS_IOCTL
USBDEVFS_HUB_PORTINFO
USBDEVFS_RESET
USBDEVFS_CLEAR_HALT
USBDEVFS_DISCONNECT
USBDEVFS_CONNECT
Are there particular devices or types of devices that you'd like to interface
to?
I'm not sure about Bluetooth; where I've seen it used it's looked like a
serial connection, but with the identity of the two ends known (so there's
potentially a bit of "pairing" and enumeration protocol involved).
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|