From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Sun, 01 Nov 2009 08:29:51 -0600 Subject: [U-Boot] [PATCH 02/10] USB add macros for debugging usb device setup. In-Reply-To: <200911010909.51064.vapier@gentoo.org> References: <1257010667-10834-1-git-send-email-Tom.Rix@windriver.com> <200911010832.47687.vapier@gentoo.org> <4AED94EE.2070907@windriver.com> <200911010909.51064.vapier@gentoo.org> Message-ID: <4AED9B5F.3070102@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger wrote: > On Sunday 01 November 2009 09:02:22 Tom wrote: >> Mike Frysinger wrote: >>> 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() >> A better solution would be to combine this logic into debug(). > > yes and no. debug() should not change, but a new debug function would > probably make sense. debug_stdio() where the first argument would be the > device name you're debugging ("usbtty" here) and would handle sending directly > to the serial functions if current stdio is set to that. > > i look forward to your proposed code ;) This patch is not critical to the patchset. It would be easier for me to remove it. Tom