[U-Boot] [PATCH 02/10] USB add macros for debugging usb device setup.

Mike Frysinger vapier at gentoo.org
Sun Nov 1 14:32:46 CET 2009


On Saturday 31 October 2009 22:00:09 Tom wrote:
> Mike Frysinger wrote:
> > On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
> >> +#ifdef DEBUG
> >> +static inline void print_device_descriptor(struct usb_device_descriptor
> >>  *d) +{
> >> +	serial_printf("usb device descriptor \n");
> >
> > do you really need serial_printf() ?  what's wrong with debug() ?  then
> > you dont even really need "#ifdef DEBUG" around all the functions ...
> 
> The explicit serial_printf is done because this patch set changes the
> stdin and stdout for serial to usbtty.
> 
> When you use printf to debug printf, you regress into a bad state.

so in your specific use case it makes sense *some* of the time (usbtty is 
enabled and the console has been changed to it), but in the general use case 
(usb debugging), it does not.  why not make it intelligent instead of 
penalizing everyone to use their serial console:
 - default to debug()
 - if usbtty support is enabled, check the current stdout console to see if 
it's set to a usbtty, and only then fall back to forcing serial_printf()
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/a05a2879/attachment.pgp 


More information about the U-Boot mailing list