File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,26 +305,27 @@ uint8_t XInputGamepad::getLEDPatternID() const {
305305}
306306
307307// Send an update packet to the PC
308- void XInputGamepad::send () {
309- if (!newData) return ; // TX data hasn't changed
308+ size_t XInputGamepad::send () {
309+ if (!newData) return 0 ; // TX data hasn't changed
310310#ifdef USB_XINPUT
311311 XInputUSB::send (tx, USB_Timeout);
312312 newData = false ;
313313#else
314314 #warning "Using debug output for XInput send()"
315315 printDebug ();
316316#endif
317+ return sizeof (tx);
317318}
318319
319- void XInputGamepad::receive () {
320+ size_t XInputGamepad::receive () {
320321#ifdef USB_XINPUT
321322 if (XInputUSB::available () == 0 ) {
322- return ; // No packet available
323+ return 0 ; // No packet available
323324 }
324325
325326 // Grab packet and store it in rx array
326327 uint8_t rx[8 ];
327- XInputUSB::recv (rx, USB_Timeout);
328+ size_t bytesRecv = XInputUSB::recv (rx, USB_Timeout);
328329
329330 // Rumble Packet
330331 if ((rx[0 ] == 0x00 ) & (rx[1 ] == 0x08 )) {
@@ -335,6 +336,9 @@ void XInputGamepad::receive() {
335336 else if (rx[0 ] == 0x01 ) {
336337 parseLED (rx[2 ]);
337338 }
339+ return bytesRecv;
340+ #else
341+ return 0 ;
338342#endif
339343}
340344
Original file line number Diff line number Diff line change @@ -104,8 +104,8 @@ class XInputGamepad {
104104 XInputLEDPattern getLEDPattern () const ; // Returns LED pattern type
105105
106106 // USB IO
107- void send ();
108- void receive ();
107+ size_t send ();
108+ size_t receive ();
109109
110110 // Control Input Ranges
111111 struct Range { int32_t min; int32_t max; };
You can’t perform that action at this time.
0 commit comments