Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fae5f627 authored by Benjamin Dobell's avatar Benjamin Dobell
Browse files

Implemented hack to make WinUSB play nice with empty receive transfers

parent e98281af
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -650,6 +650,14 @@ bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeou

int BridgeManager::ReceiveBulkTransfer(unsigned char *data, int length, int timeout, bool retry) const
{
	if (data == nullptr)
	{
		// HACK: It seems WinUSB ignores us when we try to read with length zero.
		static unsigned char dummyData;
		data = &dummyData;
		length = 1;
	}

	int dataTransferred;
	int result = libusb_bulk_transfer(deviceHandle, inEndpoint, data, length, &dataTransferred, timeout);