Some more Mac MTP work.
Reminder: Ship libusb-compat, not legacy libusb as it is fucked.
This commit is contained in:
parent
75a576a5c2
commit
902e4906e2
|
@ -230,7 +230,7 @@ QString GetSerialForDevice(io_object_t device) {
|
|||
|
||||
QString GetSerialForMTPDevice(io_object_t device) {
|
||||
return QString(
|
||||
"MTP/" + GetUSBRegistryEntryString(device, CFSTR(kUSBSerialNumberString)));
|
||||
QString("MTP/") + [(NSString*)GetPropertyForDevice(device, CFSTR(kUSBSerialNumberString)) UTF8String]);
|
||||
}
|
||||
|
||||
QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) {
|
||||
|
@ -356,6 +356,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||
NSString* product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString));
|
||||
NSNumber* vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID));
|
||||
NSNumber* product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID));
|
||||
QString serial = GetSerialForMTPDevice(object);
|
||||
|
||||
MTPDevice device;
|
||||
device.vendor = QString::fromUtf8([vendor UTF8String]);
|
||||
|
@ -375,7 +376,8 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||
qDebug() << device.vendor
|
||||
<< device.vendor_id
|
||||
<< device.product
|
||||
<< device.product_id;
|
||||
<< device.product_id
|
||||
<< serial;
|
||||
|
||||
NSNumber* addr = (NSNumber*)GetPropertyForDevice(object, CFSTR("USB Address"));
|
||||
int bus = GetBusNumber(object);
|
||||
|
@ -477,7 +479,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||
continue;
|
||||
}
|
||||
// Hurray! We made it!
|
||||
me->FoundMTPDevice(device, GetSerialForMTPDevice(object));
|
||||
me->FoundMTPDevice(device, serial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ bool MtpDevice::StartCopy(QList<Song::FileType>* supported_types) {
|
|||
db_busy_.lock();
|
||||
|
||||
// Connect to the device
|
||||
connection_.reset(new MtpConnection(url_.host()));
|
||||
connection_.reset(new MtpConnection(url_));
|
||||
|
||||
// Did the caller want a list of supported types?
|
||||
if (supported_types) {
|
||||
|
@ -174,7 +174,7 @@ void MtpDevice::FinishDelete(bool success) {
|
|||
|
||||
bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) {
|
||||
QMutexLocker l(&db_busy_);
|
||||
MtpConnection connection(url_.host());
|
||||
MtpConnection connection(url_);
|
||||
if (!connection.is_valid()) {
|
||||
qWarning() << "Error connecting to MTP device, couldn't get list of supported filetypes";
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue