summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-04-16 19:20:40 -0700
committerDan Albert <danalbert@google.com>2015-04-16 19:20:40 -0700
commit7447dd05bdc12b87687c49ee7ecf0fe50d8ab17a (patch)
treedd66a21518ef2b5c0b0cb4f940071a422f1e6927
parentf8d6b9b1ef9c19769dd4a450390f9bdec17f11b3 (diff)
downloadsystem_core-7447dd05bdc12b87687c49ee7ecf0fe50d8ab17a.zip
system_core-7447dd05bdc12b87687c49ee7ecf0fe50d8ab17a.tar.gz
system_core-7447dd05bdc12b87687c49ee7ecf0fe50d8ab17a.tar.bz2
Move usb_osx to C++.
Change-Id: I21673211a702cc4f31d4311c36e2a4b22e55fac8
-rw-r--r--adb/Android.mk2
-rw-r--r--adb/usb_osx.cpp (renamed from adb/usb_osx.c)19
2 files changed, 11 insertions, 10 deletions
diff --git a/adb/Android.mk b/adb/Android.mk
index c27b4af..133a7c4 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -35,7 +35,7 @@ LIBADB_CFLAGS := \
LIBADB_darwin_SRC_FILES := \
fdevent.cpp \
get_my_path_darwin.cpp \
- usb_osx.c \
+ usb_osx.cpp \
LIBADB_linux_SRC_FILES := \
fdevent.cpp \
diff --git a/adb/usb_osx.c b/adb/usb_osx.cpp
index 94c8cfe..303ae45 100644
--- a/adb/usb_osx.c
+++ b/adb/usb_osx.cpp
@@ -26,6 +26,7 @@
#include <IOKit/IOMessage.h>
#include <mach/mach_port.h>
+#include <inttypes.h>
#include <stdio.h>
#include "adb.h"
@@ -111,7 +112,7 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
HRESULT result;
SInt32 score;
UInt32 locationId;
- UInt8 class, subclass, protocol;
+ UInt8 if_class, subclass, protocol;
UInt16 vendor;
UInt16 product;
UInt8 serialIndex;
@@ -132,9 +133,9 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
}
//* This gets us the interface object
- result = (*plugInInterface)->QueryInterface(plugInInterface,
- CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID), (LPVOID)
- &iface);
+ result = (*plugInInterface)->QueryInterface(
+ plugInInterface,
+ CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID), (LPVOID*)&iface);
//* We only needed the plugin to get the interface, so discard it
(*plugInInterface)->Release(plugInInterface);
if (result || !iface) {
@@ -142,12 +143,12 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
continue;
}
- kr = (*iface)->GetInterfaceClass(iface, &class);
+ kr = (*iface)->GetInterfaceClass(iface, &if_class);
kr = (*iface)->GetInterfaceSubClass(iface, &subclass);
kr = (*iface)->GetInterfaceProtocol(iface, &protocol);
- if(class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
+ if(if_class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
// Ignore non-ADB devices.
- DBG("Ignoring interface with incorrect class/subclass/protocol - %d, %d, %d\n", class, subclass, protocol);
+ DBG("Ignoring interface with incorrect class/subclass/protocol - %d, %d, %d\n", if_class, subclass, protocol);
(*iface)->Release(iface);
continue;
}
@@ -177,7 +178,7 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
}
result = (*plugInInterface)->QueryInterface(plugInInterface,
- CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID) &dev);
+ CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID*)&dev);
//* only needed this to query the plugin
(*plugInInterface)->Release(plugInInterface);
if (result || !dev) {
@@ -334,7 +335,7 @@ CheckInterface(IOUSBInterfaceInterface **interface, UInt16 vendor, UInt16 produc
interfaceSubClass, interfaceProtocol))
goto err_bad_adb_interface;
- handle = calloc(1, sizeof(usb_handle));
+ handle = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle)));
//* Iterate over the endpoints for this interface and find the first
//* bulk in/out pipes available. These will be our read/write pipes.