Skip to content

Commit

Permalink
fixed libusb backend compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
whoozle committed May 17, 2015
1 parent c9b944a commit a494646
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mtp/backend/libusb/usb/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ namespace mtp { namespace usb
while(tr == (int)data.size());
}

void Device::WriteControl(u8 type, u8 req, u16 value, u16 index, const ByteArray &data, bool interruptCurrentTransaction, int timeout)
{
USB_CALL(libusb_control_transfer(_handle, type, req, value, index, const_cast<u8 *>(data.data()), data.size(), timeout));
}

std::string Device::GetString(int idx) const
{
Expand Down
6 changes: 5 additions & 1 deletion mtp/backend/libusb/usb/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define DEVICE_H

#include <mtp/ptp/IObjectStream.h>
#include <mtp/ByteArray.h>
#include <mtp/Token.h>
#include <mtp/types.h>
#include <libusb.h>

Expand Down Expand Up @@ -75,7 +77,7 @@ namespace mtp { namespace usb
libusb_device_handle * _handle;

public:
class InterfaceToken
class InterfaceToken : public IToken
{
libusb_device_handle * _handle;
int _index;
Expand All @@ -101,6 +103,8 @@ namespace mtp { namespace usb
void WriteBulk(const EndpointPtr & ep, const IObjectInputStreamPtr &inputStream, int timeout);
void ReadBulk(const EndpointPtr & ep, const IObjectOutputStreamPtr &outputStream, int timeout);

void WriteControl(u8 type, u8 req, u16 value, u16 index, const ByteArray &data, bool interruptCurrentTransaction, int timeout);

std::string GetString(int idx) const;
};
DECLARE_PTR(Device);
Expand Down

0 comments on commit a494646

Please sign in to comment.