Fix macos code
This commit is contained in:
@@ -313,7 +313,7 @@ QString GetApplicationSupportPath() {
|
|||||||
NSString* user_path = [paths objectAtIndex:0];
|
NSString* user_path = [paths objectAtIndex:0];
|
||||||
ret = QString::fromUtf8([user_path UTF8String]);
|
ret = QString::fromUtf8([user_path UTF8String]);
|
||||||
} else {
|
} else {
|
||||||
ret = "~/Collection/Application Support";
|
ret = "~/Library/Application Support";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ScopedIOObject {
|
|||||||
|
|
||||||
// Helpful MTP & USB links:
|
// Helpful MTP & USB links:
|
||||||
// Apple USB device interface guide:
|
// Apple USB device interface guide:
|
||||||
// http://developer.apple.com/mac/collection/documentation/DeviceDrivers/Conceptual/USBBook/USBDeviceInterfaces/USBDevInterfaces.html
|
// http://developer.apple.com/mac/library/documentation/DeviceDrivers/Conceptual/USBBook/USBDeviceInterfaces/USBDevInterfaces.html
|
||||||
// Example Apple code for requesting a USB device descriptor:
|
// Example Apple code for requesting a USB device descriptor:
|
||||||
// http://www.opensource.apple.com/source/IOUSBFamily/IOUSBFamily-208.4.5/USBProber/BusProbeClass.m
|
// http://www.opensource.apple.com/source/IOUSBFamily/IOUSBFamily-208.4.5/USBProber/BusProbeClass.m
|
||||||
// Libmtp's detection code:
|
// Libmtp's detection code:
|
||||||
@@ -122,12 +122,9 @@ void MacDeviceLister::Init() {
|
|||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
LIBMTP_device_entry_t device = devices[i];
|
LIBMTP_device_entry_t device = devices[i];
|
||||||
MTPDevice d;
|
MTPDevice d;
|
||||||
// FIXME:
|
d.vendor = QString::fromLatin1(device.vendor);
|
||||||
//d.vendor = QString::toLatin1(device.vendor);
|
|
||||||
d.vendor = device.vendor;
|
|
||||||
d.vendor_id = device.vendor_id;
|
d.vendor_id = device.vendor_id;
|
||||||
//d.product = QString::toLatin1(device.product);
|
d.product = QString::fromLatin1(device.product);
|
||||||
d.product = device.product;
|
|
||||||
d.product_id = device.product_id;
|
d.product_id = device.product_id;
|
||||||
d.quirks = device.device_flags;
|
d.quirks = device.device_flags;
|
||||||
sMTPDeviceList << d;
|
sMTPDeviceList << d;
|
||||||
@@ -355,9 +352,7 @@ void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) {
|
|||||||
#ifdef HAVE_AUDIOCD
|
#ifdef HAVE_AUDIOCD
|
||||||
if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) {
|
if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) {
|
||||||
// CD inserted.
|
// CD inserted.
|
||||||
// FIXME:
|
QString bsd_name = QString::fromLatin1(DADiskGetBSDName(disk));
|
||||||
//QString bsd_name = QString::toLatin1(DADiskGetBSDName(disk));
|
|
||||||
QString bsd_name = DADiskGetBSDName(disk);
|
|
||||||
me->cd_devices_ << bsd_name;
|
me->cd_devices_ << bsd_name;
|
||||||
emit me->DeviceAdded(bsd_name);
|
emit me->DeviceAdded(bsd_name);
|
||||||
return;
|
return;
|
||||||
@@ -396,9 +391,7 @@ void MacDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) {
|
|||||||
// We cannot access the USB tree when the disk is removed but we still get
|
// We cannot access the USB tree when the disk is removed but we still get
|
||||||
// the BSD disk name.
|
// the BSD disk name.
|
||||||
|
|
||||||
// FIXME:
|
QString bsd_name = QString::fromLatin1(DADiskGetBSDName(disk));
|
||||||
//QString bsd_name = QString::toLatin1(DADiskGetBSDName(disk));
|
|
||||||
QString bsd_name = DADiskGetBSDName(disk);
|
|
||||||
if (me->cd_devices_.remove(bsd_name)) {
|
if (me->cd_devices_.remove(bsd_name)) {
|
||||||
emit me->DeviceRemoved(bsd_name);
|
emit me->DeviceRemoved(bsd_name);
|
||||||
return;
|
return;
|
||||||
@@ -571,9 +564,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||||||
if (!ret || data.at(0) != 0x28)
|
if (!ret || data.at(0) != 0x28)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// FIXME:
|
if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") {
|
||||||
//if (QString::toLatin1(data.data() + 0x12, 3) != "MTP") {
|
|
||||||
if (QString(data.data() + 0x12) != "MTP") {
|
|
||||||
// Not quite.
|
// Not quite.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -583,9 +574,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME:
|
if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") {
|
||||||
//if (QString::toLatin1(data.data() + 0x12) != "MTP") {
|
|
||||||
if (QString(data.data() + 0x12) != "MTP") {
|
|
||||||
// Not quite.
|
// Not quite.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -684,14 +673,14 @@ QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
|
|||||||
const MTPDevice& device = mtp_devices_[serial];
|
const MTPDevice& device = mtp_devices_[serial];
|
||||||
QString str;
|
QString str;
|
||||||
str.sprintf("gphoto2://usb-%d-%d/", device.bus, device.address);
|
str.sprintf("gphoto2://usb-%d-%d/", device.bus, device.address);
|
||||||
|
QUrlQuery url_query;
|
||||||
|
url_query.addQueryItem("vendor", device.vendor);
|
||||||
|
url_query.addQueryItem("vendor_id", QString::number(device.vendor_id));
|
||||||
|
url_query.addQueryItem("product", device.product);
|
||||||
|
url_query.addQueryItem("product_id", QString::number(device.product_id));
|
||||||
|
url_query.addQueryItem("quirks", QString::number(device.quirks));
|
||||||
QUrl url(str);
|
QUrl url(str);
|
||||||
// FIXME:
|
url.setQuery(url_query);
|
||||||
//QUrlQuery url(str);
|
|
||||||
//url.addQueryItem("vendor", device.vendor);
|
|
||||||
//url.addQueryItem("vendor_id", QString::number(device.vendor_id));
|
|
||||||
//url.addQueryItem("product", device.product);
|
|
||||||
//url.addQueryItem("product_id", QString::number(device.product_id));
|
|
||||||
//url.addQueryItem("quirks", QString::number(device.quirks));
|
|
||||||
return QList<QUrl>() << url;
|
return QList<QUrl>() << url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user