#include "wx/mac/corefoundation/hid.h"
#include "wx/string.h"
#include "wx/log.h"
+#include "wx/mac/corefoundation/cfstring.h"
// ---------------------------------------------------------------------------
//Now get the maching services
io_iterator_t pIterator;
wxIOCHECK(IOServiceGetMatchingServices(m_pPort, pDictionary, &pIterator), "No Matching HID Services");
- wxASSERT(pIterator != 0);
+ wxASSERT_MSG(pIterator != 0, wxT("No devices found!"));
//Now we iterate through them
io_object_t pObject;
//Just for sanity :)
wxASSERT(CFGetTypeID(CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey))) == CFStringGetTypeID());
+/*
+ kIOHIDTransportKey;
+ kIOHIDVendorIDKey;
+ kIOHIDProductIDKey;
+ kIOHIDVersionNumberKey;
+ kIOHIDManufacturerKey;
+ kIOHIDSerialNumberKey;
+ if !kIOHIDLocationIDKey
+ kUSBDevicePropertyLocationID
+ kIOHIDPrimaryUsageKey
+kIOHIDPrimaryUsagePageKey
+idProduct
+idVendor
+USB Product Name
+*/
//Get [product] name
- m_szName = CFStringGetCStringPtr (
- (CFStringRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey)),
- CFStringGetSystemEncoding()
- );
+ m_szProductName = wxMacCFStringHolder( (CFStringRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey)), false ).AsString();
+
+ CFNumberRef nref = (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductIDKey));
+
+ if (nref)
+ CFNumberGetValue(
+ nref,
+ kCFNumberIntType,
+ &m_nProductId
+ );
+
+ nref = (CFNumberRef) CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey));
+ if (nref)
+ CFNumberGetValue(
+ nref,
+ kCFNumberIntType,
+ &m_nManufacturerId
+ );
//Create the interface (good grief - long function names!)
SInt32 nScore;
//
wxCFArray CookieArray = CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDElementKey));
BuildCookies(CookieArray);
- if (m_ppQueue != NULL)
- wxVERIFY((*m_ppQueue)->start(m_ppQueue) == S_OK);
//cleanup
CFRelease(pDictionary);
//Now get the maching services
io_iterator_t pIterator;
wxIOCHECK(IOServiceGetMatchingServices(m_pPort, pDictionary, &pIterator), "No Matching HID Services");
- wxASSERT(pIterator != 0);
+
+ if(pIterator == NULL)
+ return 0;
//Now we iterate through them
io_object_t pObject;