Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2002 14:25:05 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        hackers@freebsd.org
Subject:   VMware 3: usbdevfs support
Message-ID:  <20020913132505.GD28076@spc.org>

next in thread | raw e-mail | index | archive | help

--5/uDoXvLw7AC5HRs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Guys,

One of the 'neat features' of VMware 3.x is the ability to map unclaimed
USB devices into a virtual machine, and run the driver for the device
within the virtual machine.

In order to do this, VMware scans /proc/bus/usb under Linux. We don't have
this usbdevfs, so I've begun sketching some notes out about how we might
go about adding such support, which are in the attached NOTES file.

I would appreciate it very much if you could have a look over this and let
me know your thoughts/feedback.

Many thanks
BMS
(pissed off at yet another proprietary mp3 player with Windows drivers)

--5/uDoXvLw7AC5HRs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=NOTES


fstab entry on Linux:
none /proc/bus/usb usbdevfs noauto 0 0

fstab entry on FreeBSD:
usbdevfs /compat/linux/proc/bus/usb usbdevfs noauto 0 0
XXX: needs a mountpoint 'bus' inside procfs!

Paths look like this under fsroot:-

 /compat/linux/proc/bus/usb
        |
        |---/%03d (bus ID)
        |      |
        |      |- /%03d (device ID)
        |
        |---/devices
        |
        \---/drivers

This yields:-

typedef enum {
	Proot		/* filesystem root (root) */
	Pdevices	/* list of devices on all buses (regular file) */
	Pdrivers	/* list of loaded USB drivers (regular file) */
	Pbus		/* a directory containing all devices on a given bus */
	Pdevice		/* a USB device which is a child of Pbus */
} usbfstype;

Pdrivers should always contain: 'usbdevfs' and 'hub'
Under a bus node, 001 is almost always present as the root hub on the bus.

Lines in 'devices' file:

T beginning of a device entry (bus, level, prnt(?), port, count, dev, spd, mxch)
B bandwidth statistics/allocation
D device information, version, class
P product ID, vendor ID
S strings presented by the device (SerialNumber, Product et al)
C Configuration descriptor 
I Interface descriptor
E Endpoint descriptor

opendir /
-> Enumerate available USB buses from within the kernel

opendir /%03d
-> Enumerate available devices on each bus

open /%03d/%03d
-> Map opens of Pdevice onto the appropriate ugen instance in
   the kernel device tree.
-> Map ioctls in a similar manner.

-- what about claimed devices?
  modprobe usbserial --> 'serial' visible in /dev/usb/drivers list.
  modprobe usb-storage --> usb-storage in drivers

 -- usbdevfs makes no distinction between them but will report
unclaimed devices as I: ... Driver=(none)

   -- How to emulate; does VMware use this?
     -- Hardcode to 'usbdevfs' and 'hub' for the time being.
     -- Possibly also include 'claimed' as a shorthand to
        indicate device is claimed by some BSD USB class driver.
     -- Assumes VMware only looks for '(none)'.


--5/uDoXvLw7AC5HRs--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020913132505.GD28076>