Fix red introduced in 33d0a3ef

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit b562c9d58f044b1bb471a42ad070daf1bc0ec1c6
Author: Solomon Peachy <[email protected]>
Date:   Mon Jan 26 22:51:06 2026 -0500

    Fix red introduced in 33d0a3ef
    
    Many bootloaders broke because they have only partial USB
    implementations -- HAVE_USBSTACK but without HAVE_BOOTLOADER_USB_MODE...
    and a pile of exceptions.
    
    Those exceptions need to be cleaned up properly, but for now, get the
    build going again by wrapping the new ack-tracking bits with the
    USB_FULL_INIT define created by the above conditions.
    
    Change-Id: I936d4989b8c8195ee30d53808f61104a4986942a

diff --git a/firmware/usb.c b/firmware/usb.c
index 4727e1b5ff..9d9b221e0a 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -100,10 +100,10 @@ static long usb_stack[(DEFAULT_STACK_SIZE*4 + DUMP_BMP_LINESIZE + USB_EXTRA_STAC
 static const char usb_thread_name[] = "usb";
 static unsigned int usb_thread_entry = 0;
 static bool usb_monitor_enabled = false;
+static bool exclusive_storage_enabled = false;
 #endif /* USB_FULL_INIT */
 static struct event_queue usb_queue SHAREDBSS_ATTR;
 static bool exclusive_storage_requested = false;
-static bool exclusive_storage_enabled = false;
 #ifdef USB_ENABLE_HID
 static bool usb_hid = true;
 #endif
@@ -111,13 +111,16 @@ static bool usb_hid = true;
 static int usb_audio = 0;
 #endif
 
+#ifdef HAVE_USB_POWER
+static bool usb_power_only = false;
+#endif
+
 #ifdef USB_FULL_INIT
 static bool usb_host_present = false;
 static int usb_num_acks_to_expect = 0;
 static uint32_t usb_broadcast_seqnum = 0x80000000;
 #ifdef HAVE_USB_POWER
 static int usb_mode = USBMODE_DEFAULT;
-static bool usb_power_only = false;
 #endif
 
 #if defined(USB_FIREWIRE_HANDLING)
@@ -489,6 +492,7 @@ static void NORETURN_ATTR usb_thread(void)
             /* USB_INSERTED */
 
         case SYS_USB_CONNECTED_ACK:
+#ifdef USB_FULL_INIT
             if((uint32_t)ev.data != usb_broadcast_seqnum) {
                 DEBUGF("usb: late ack %lX < %lX", ev.data, usb_broadcast_seqnum);
                 break;
@@ -503,6 +507,7 @@ static void NORETURN_ATTR usb_thread(void)
             }
 
             DEBUGF("usb: all threads have acknowledged the connect.\n");
+#endif
             if(usb_host_present && exclusive_storage_requested) {
                 usb_slave_mode(true);
                 exclusive_storage_enabled = true;
@@ -803,7 +808,7 @@ bool usb_inserted(void)
     return usb_state == USB_INSERTED || usb_state == USB_POWERED;
 }
 
-#ifdef HAVE_USBSTACK
+#if defined(HAVE_USBSTACK) && defined(USB_FULL_INIT)
 bool usb_exclusive_storage(void)
 {
     /* Storage isn't actually exclusive until slave mode has been entered */
@@ -858,11 +863,14 @@ bool usb_exclusive_storage(void)
 void usb_request_exclusive_storage(void)
 {
     exclusive_storage_requested = true;
+#ifdef USB_FULL_INIT
     usb_broadcast_seqnum += 1;
     usb_num_acks_to_expect = queue_broadcast(SYS_USB_CONNECTED, usb_broadcast_seqnum) - 1;
     DEBUGF("usb: waiting for %d acks...\n", usb_num_acks_to_expect);
+#endif
 }
 
+#ifdef USB_FULL_INIT
 void usb_release_exclusive_storage(void)
 {
     if(!exclusive_storage_requested) {
@@ -882,6 +890,7 @@ void usb_release_exclusive_storage(void)
 #endif
     return;
 }
+#endif
 
 #ifdef USB_ENABLE_HID
 void usb_set_hid(bool enable)
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.