From owner-freebsd-hackers Fri Sep 13 8:15: 0 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3286D37B400 for ; Fri, 13 Sep 2002 08:14:55 -0700 (PDT) Received: from insomnia.spc.org (insomnia.spc.org [195.224.94.183]) by mx1.FreeBSD.org (Postfix) with SMTP id 41E1C43E81 for ; Fri, 13 Sep 2002 08:14:44 -0700 (PDT) (envelope-from bms@insomnia.spc.org) Received: (qmail 9871 invoked by uid 1031); 13 Sep 2002 13:25:06 -0000 Date: Fri, 13 Sep 2002 14:25:05 +0100 From: Bruce M Simpson To: hackers@freebsd.org Subject: VMware 3: usbdevfs support Message-ID: <20020913132505.GD28076@spc.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline User-Agent: Mutt/1.3.28i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --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