Project description from Greg K-H
Hi,
The things we just talked about (while I still remember it) were:
- accesses directly to usb endpoints through a character device and async-i/o.
The main file is drivers/usb/core/endpoint.c in the kernel source tree. The main function that creates the endpoint's device node is usb_create_ep_files(). Look at the MKDEV() call in that function. Right now it is saying that it has a character device for this endpoint, but that is a lie. To fix this try these steps:
- register a real major number with the kernel for these endpoints. You'll have to do that when the USB subsytem starts up, look at usb_init() in drivers/usb/core/usb.c for where to place a call to your code to do this.
- register a real cdev for the endpoint that is being created with a real minor number. That can be done in the endpoint.c file. You'll have to pick a better scheme for the minor number than I did, as my guess was obviously wrong.
- with that character device, create the file operations for the endpoints. That can probably go in a different file, just to make things simpler.
- hook up the async-i/o calls in those file operations. That will be all of the "real" work.
If you have any questions, please feel free to let me know. And as always, no patch is too small to accept :)
hope this helps,
greg k-h
Current Work
Worked out project schedule for Winter break:
- Emma -- write file operation for control transfers
- Sarah -- read file operation for control transfers
- James -- write file operation for control transfers
We still need to install a file operations table for each type of endpoint in endpoints.c.
Past work
Link to the patch(es) for a dynamic major for endpoints.
Tools
Necessary Packages:
- git-core
- gitk
- qgit
- cogito
- qemu
Other tools
- debugfs
- usbmon
- wireshark
To get usbmon, you need to recompile your kernel with debugfs built-in and usbmon as a module. debugfs is under Kernel Hacking in the main menuconfig menu and usbmon is under Device Drivers->USB support->USB Network->USB Monitor. Follow the directions in the kernel tree in Documentation/usb/usbmon.txt.
Wireshark is the new name for the network analyzer Ethereal. Wireshark can also read USB packets. You'll need to grab a CVS checkout of libpcap (the lastest release, 0.9.5, isn't new enough). Then you should recompile wireshark with the newest libpcap.
You'll also need the 2.6.18 Linux kernel sources. Once you have git installed, download Linus' 2.6.18 tree:
$ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Build the 2.6.18 kernel
$ make defconfig
$ make
Download a debian disk image from oszoo. Or make your own.
Make sure that you have permissions for the device nodes in /proc/bus/usb. Assuming you have your own group with id 1000, add this line to /etc/fstab, and remount /proc/bus/usb:
usbfs /proc/bus/usb usbfs devgid=1000,devmode=0660 0 0
Run qemu, giving it the kernel and disk image and enabling usb and the network interface:
$ qemu -kernel $KERNEL -hda $IMG -append 'root=/dev/hda' -usb -net user -net nic,model=rtl8139
You'll have to run dhclient to bring up the dhcp interface:
$ dhclient eth0
Links
Greg's original announcement about making usb endpoints real devices in sysfs.
Attachments: