Yes, yes, this is my first foray since university into kernel space, but I have had enough of the user-space solutions to implementing the media transfer protocol. Hundreds of devices have now implemented the darn thing (including my iriver clix if you recall), and what's more the USB.org folks have finally published the 1.0 version of the standard.
First here is a bit of the technical reasoning.
- Already two distinct user-space implementations which both share similar drawbacks. libmtp, and libgphoto
- Dependant on libusb which has stalled in development
- Race condition in device connection, first application to detect and connect blocks any other software from using the device until connection is dropped
Etc, the current implementation suffers from all the problems that user space drivers suffer from in the monolithic world (even the microsoft implementation has this going on). Also, it's about time I get my hands dirty in the kernel for pete's sake.
So how is this thing going to work you might ask?
Well, here is how I see it right now, and others are welcome to chime in on this.
The protocol is implemented partly in kernel space, and partly in user-space depending on necessity and appropriateness.
Kernel Space Driver (mtp):
Connects and manages all operations:
Exposes file hierarchies as a mountable file system
Implements protocol for transferring straight files.
Issues device handles to userspace which can be used asynchronously (no more device pointers!)
Automatic device connection
User Space Library (libmtp-media)
Implements protocol for managing media (including meta-data) (music, pictures, video, etc)
User Space Library (libmtp-cal)
Implements protocol for managing contact and calendar (vcard, ical, etc)
Essentially the protocol implementation will be separated across a variety of locations.
Anywho, after an hour or so of fiddling, here is the latest line from dmesg:
usb 4-5: new high speed USB device using ehci_hcd and address 9
usb 4-5: configuration #1 chosen from 1 choice
mtp: USB Skeleton device now attached to USBSkel-192
usb 4-5: New USB device found, idVendor=4102, idProduct=112a
usb 4-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 4-5: Product: iriver clix
usb 4-5: Manufacturer: iriver Limited
usb 4-5: SerialNumber: 41dff81c000000f33230303530313031
usb 4-5: USB disconnect, address 9
mtp: USB Skeleton #192 now disconnected
Not much, but hey it's the beginning of the road here.
Lastly, if anyone wants to employ me to design this, I am certainly on the market.
Post a Comment