Skip to content

Commit 1323197

Browse files
committed
Switch send/receive types to use int
Returning -1 on error
1 parent e81aa92 commit 1323197

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/XInput.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,27 +326,27 @@ boolean XInputGamepad::connected() {
326326
}
327327

328328
//Send an update packet to the PC
329-
size_t XInputGamepad::send() {
329+
int XInputGamepad::send() {
330330
if (!newData) return 0; // TX data hasn't changed
331331
#ifdef USB_XINPUT
332-
XInputUSB::send(tx, USB_Timeout);
333332
newData = false;
333+
return XInputUSB::send(tx, USB_Timeout);
334334
#else
335335
#warning "Using debug output for XInput send()"
336336
printDebug();
337-
#endif
338337
return sizeof(tx);
338+
#endif
339339
}
340340

341-
size_t XInputGamepad::receive() {
341+
int XInputGamepad::receive() {
342342
#ifdef USB_XINPUT
343343
if (XInputUSB::available() == 0) {
344344
return 0; // No packet available
345345
}
346346

347347
// Grab packet and store it in rx array
348348
uint8_t rx[8];
349-
size_t bytesRecv = XInputUSB::recv(rx, USB_Timeout);
349+
int bytesRecv = XInputUSB::recv(rx, USB_Timeout);
350350

351351
const uint8_t PacketType = rx[0];
352352

src/XInput.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class XInputGamepad {
114114

115115
// USB IO
116116
boolean connected();
117-
size_t send();
118-
size_t receive();
117+
int send();
118+
int receive();
119119

120120
// Control Input Ranges
121121
struct Range { int32_t min; int32_t max; };

0 commit comments

Comments
 (0)