Skip to content

Commit 4f80972

Browse files
committed
cast to uint32_t to avoid compiler warning
that said, it's possible this api might return a variety of non-zero codes. code could benefit from being updated (e.g., documenting return codes)
1 parent 9ab68e1 commit 4f80972

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

libraries/USBHost/examples/ADKTerminalTest/ADKTerminalTest.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void setup(void)
3737
while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
3838
SERIAL_PORT_MONITOR.println("\r\nADK demo start");
3939

40-
if (usb.Init() == -1)
40+
if (usb.Init() == (uint32_t)-1)
4141
SERIAL_PORT_MONITOR.println("OSC did not start.");
4242

4343
delay(20);

libraries/USBHost/examples/KeyboardController/KeyboardController.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ void setup()
8383
{
8484
SerialDebug.begin( 115200 );
8585
SerialDebug.println("USB Host Keyboard Controller Program started");
86-
87-
if (usb.Init() == -1)
86+
if (usb.Init() == (uint32_t)-1)
8887
SerialDebug.println("USB Host did not start.");
8988

9089
SerialDebug.println("USB Host started");

libraries/USBHost/examples/MouseController/MouseController.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void setup()
9191
SerialDebug.begin( 115200 );
9292
SerialDebug.println("USB Host Mouse Controller Program started");
9393

94-
if (usb.Init() == -1)
94+
if (usb.Init() == (uint32_t)-1)
9595
SerialDebug.println("USB Host did not start.");
9696

9797
SerialDebug.println("USB Host started");

libraries/USBHost/examples/USB_desc/USB_desc.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ void setup()
5959
SerialDebug.println("Starting USB Descriptor test");
6060

6161
SerialDebug.println("Initializing USB");
62-
if (usb.Init() == -1)
63-
SerialDebug.println("USBhost did not start.");
62+
if (usb.Init() == (uint32_t)-1)
63+
SerialDebug.println("USBhost did not start.");
6464

6565
delay( 20 );
6666

@@ -159,7 +159,7 @@ byte getdevdescr( byte addr, byte &num_conf )
159159
return( 0 );
160160
}
161161

162-
void printhubdescr(uint8_t *descrptr, uint8_t addr)
162+
void printhubdescr(uint8_t *descrptr, __attribute__((unused)) uint8_t addr)
163163
{
164164
HubDescriptor *pHub = (HubDescriptor*) descrptr;
165165
uint8_t len = *((uint8_t*)descrptr);
@@ -213,13 +213,15 @@ byte getconfdescr( byte addr, byte conf )
213213
byte descr_length;
214214
byte descr_type;
215215
uint16_t total_length;
216+
// BUGBUG -- no check of return code from usb.getConfDescr()
216217
rcode = usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length
217218
LOBYTE( total_length ) = buf[ 2 ];
218219
HIBYTE( total_length ) = buf[ 3 ];
219220
if( total_length > sizeof(buf)) { //check if total length is larger than buffer
220221
printProgStr(Conf_Trunc_str);
221222
total_length = sizeof(buf);
222223
}
224+
// BUGBUG -- no check of return code from usb.getConfDescr()
223225
rcode = usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor
224226
while( buf_ptr < buf + total_length ) { //parsing descriptors
225227
descr_length = *( buf_ptr );

0 commit comments

Comments
 (0)