Thu May 17 13:20:47 EDT 2012

Linux host for USB debugging

I'm writing firmware for a USB device.  It would be useful to now be
able to run a kernel inside a debugger to see what's going on, and
maybe to freeze the enumeration process.

I don't want to do this on my development host because I might crash
the kernel.

I was thinking user mode linux or KVM for debugging, but it doesn't
look like that's going to work.  It seems to me that all emulation
will just pass USB stuff to the hosts' usb layer, and that's exactly
what I'm trying to debug.  Maybe its best to do this on a real host
with some kind of kernel debugger or at least a bunch of logging?

This needs:
  - A real host with usb subsystem as modules
  - Probably compiler on the real host

I have an old dell laptop to set this up.  Let's give it a try.
First, lets backup.

apt-get source linux-2.6

Once configured, to build only a single subdirectory, use.

make modules SUBDIRS=drivers/the_module_directory

I don't know how to configure a linux tree though.. maybe just
building it with kpkg-deb ?  I'm just using "make menuconfig" default now.

make oldconfig
make prepare
make modules SUBDIRS=drivers/usb/host

I have both uhci_hcd and ehci_hcd.  Which is it?  Stuff seems to work
without ehci_hcd.  It seems to work with only uhci_hcd, USB 1.1


The error messages like:
[ 8007.022046] usb 1-1.4: device descriptor read/64, error -71

come from drivers/usb/core/hub.c

Maybe it helps plugging it in directly to the 64bit host?