From 96bd8a2dfac1841b192ff80ffd78dcd36b1d1ba7 Mon Sep 17 00:00:00 2001
From: Jakob Gruber <jakob.gruber@gmail.com>
Date: Thu, 2 Aug 2012 10:46:20 +0200
Subject: [PATCH] usb: Convert logging to AVR_LOG()

A couple of these functions did not have references to avr_t, so this is
incomplete.
---
 simavr/sim/avr_usb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/simavr/sim/avr_usb.c b/simavr/sim/avr_usb.c
index 2d6f264..d87aca5 100644
--- a/simavr/sim/avr_usb.c
+++ b/simavr/sim/avr_usb.c
@@ -396,7 +396,7 @@ avr_usb_udaddr_write(
         void * param)
 {
 	if (v & 0x80)
-		printf("Activate address %d\n", v & 0x7f);
+		AVR_LOG(avr, LOG_TRACE, "USB: Activate address %d\n", v & 0x7f);
 	avr_core_watch_write(avr, addr, v);
 }
 
@@ -469,7 +469,7 @@ avr_usb_ep_write_ueintx(
 	if (curstate->stalledi & !newstate->stalledi)
 		curstate->stalledi = 0;
 	if (curstate->rwal & !newstate->rwal)
-		printf("pointless change of ueintx.rwal\n");
+		AVR_LOG(avr, LOG_WARNING, "USB: Pointless change of ueintx.rwal\n");
 
 	if ((curstate->v & 0xdf) == 0)
 		avr->data[p->r_usbcon + ueint] &= 0xff ^ (1 << ep); // mark ep0 interrupt
@@ -630,7 +630,7 @@ avr_usb_ioctl(
 				return AVR_IOCTL_USB_STALL;
 			}
 			if (ep && !epstate->uecfg0x.epdir)
-				printf("Reading from IN endpoint from host??\n");
+				AVR_LOG(io->avr, LOG_WARNING, "USB: Reading from IN endpoint from host??\n");
 
 			ret = ep_fifo_usb_read(epstate, d->buf);
 			if (ret < 0) {
@@ -653,7 +653,7 @@ avr_usb_ioctl(
 			epstate = get_epstate(p, ep);
 
 			if (ep && epstate->uecfg0x.epdir)
-				printf("Writing to IN endpoint from host??\n");
+				AVR_LOG(io->avr, LOG_WARNING, "USB: Writing to IN endpoint from host??\n");
 
 			if (epstate->ueconx.stallrq) {
 				raise_ep_interrupt(io->avr, p, 0, stalledi);
@@ -684,7 +684,7 @@ avr_usb_ioctl(
 
 			return 0;
 		case AVR_IOCTL_USB_RESET:
-			printf("__USB_RESET__\n");
+			AVR_LOG(io->avr, LOG_TRACE, "USB: __USB_RESET__\n");
 			reset_endpoints(io->avr, p);
 			raise_usb_interrupt(p, eorsti);
 			if (0)
@@ -710,7 +710,7 @@ avr_usb_reset(
 	p->io.avr->data[p->r_usbcon] = 0x20;
 	p->io.avr->data[p->r_usbcon + udcon] = 1;
 
-	printf("%s\n", __FUNCTION__);
+	AVR_LOG(io->avr, LOG_TRACE, "USB: %s\n", __FUNCTION__);
 }
 
 static const char * irq_names[USB_IRQ_COUNT] = {
-- 
2.39.5