FS#9917 - Cowon D2 Usb Serial

Attached to Project: Rockbox
Opened by Michaël Burtin (mbu) - Monday, 16 February 2009, 22:59 GMT
Task Type Patches
Category Drivers
Status Unconfirmed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Here's a patch to have a functional usb_serial driver allowing the use of "Logf over Usb" debug function.
This task depends upon

Comment by Rob Purchase (shotofadds) - Monday, 09 March 2009, 22:17 GMT
I must admit I'm a little confused by this patch. I've committed the parts that are necessary to get USB support compiling again (USB_NUM_ENDPOINTS, usb_attach() etc), and it seems that logf-over-usb works for me using just those changes.

Occasionally there are some repeated and/or missing characters at the end of logf lines - presumably the rest of your changes are aimed at fixing that? Unfortunately when I apply the full patch my D2 freezes when I connect the USB cable.

Could you maybe explain what your changes are doing? I'm quite unfamiliar with the existing USB driver so need all the help I can get...
Comment by Michaël Burtin (mbu) - Tuesday, 10 March 2009, 12:04 GMT
Yes you're right, the rest of the patch aim to fix those missing parts. It has something to do with alignment in memory.
I get some code from ifp_usb_serial.c, from the usb_get_packet and usb_send functions to have word-aligned data in memory before sending/reading register.

Another part of the patch in usb_drv_send_nonblocking :
- ep->count = count;
+ ep->count = 0;
is a bug fix I think because ep->count contains the number of send bytes and this value is changed in usb_drv_write_ep. I assumed it must be set to 0 before first call to usb_drv_write_ep.
Without this fix I got a Panic because the number of bytes send is incorrectly reported to usb_serial_transfer_complete.
It seems that recents changes in usb_serial.c made it works without this patch because the number of send bytes is not used anymore in usb_serial_transfer_complete.

I will update my working copy tonight and try to reproduce the freeze.
Comment by Michaël Burtin (mbu) - Wednesday, 11 March 2009, 22:21 GMT
I made some test on rev 20283. I first had the freeze you described with a fresh update and no patch.
After some tests it finally worked without any changes. I experience very strange behaviors with usb.
There's some factors I don't understand.

I made an update of the patch with rev 20283.
Comment by Postolati Maxim (tails_) - Tuesday, 26 October 2010, 06:37 GMT
this doesn't allows to connect D2 to PC without rebooting to original FW, isn't it?
Comment by Michaël Burtin (mbu) - Tuesday, 26 October 2010, 07:27 GMT
This patch allowed the D2 to be seen as an usb serial device, allowing to use logfoverusb.
This does not make usb mass storage work, and this is quite old.