15 #ifndef kIOFireWireAVCLibUnitInterfaceID2
16 #define kIOFireWireAVCLibUnitInterfaceID2 \
17 CFUUIDGetConstantUUIDWithBytes( \
19 0x85, 0xB5, 0xE9, 0x54, 0x0A, 0xEF, 0x11, 0xD8, \
20 0x8D, 0x19, 0x00, 0x03, 0x93, 0x91, 0x4A, 0xBA)
24 void* , io_service_t , natural_t messageType,
28 IONotificationPortRef notify_port,
29 CFRunLoopRef &thread_cf_ref, io_object_t obj)
39 IORegistryEntryGetParentEntry(
41 IORegistryEntryGetParentEntry(
43 IORegistryEntryGetParentEntry(
48 IOServiceAddInterestNotification(
49 notify_port, obj, kIOGeneralInterest,
62 CFMutableDictionaryRef props;
63 int ret = IORegistryEntryCreateCFProperties(
64 obj, &props, kCFAllocatorDefault, kNilOptions);
65 if (kIOReturnSuccess != ret)
68 auto specDesc = (CFNumberRef)
69 CFDictionaryGetValue(props, CFSTR(
"Unit_Spec_ID"));
70 CFNumberGetValue(specDesc, kCFNumberSInt32Type, &
m_specid);
72 auto typeDesc = (CFNumberRef)
73 CFDictionaryGetValue(props, CFSTR(
"Unit_Type"));
74 CFNumberGetValue(typeDesc, kCFNumberSInt32Type, &
m_modelid);
76 auto vendorDesc = (CFNumberRef)
77 CFDictionaryGetValue(props, CFSTR(
"Vendor_ID"));
78 CFNumberGetValue(vendorDesc, kCFNumberSInt32Type, &
m_vendorid);
80 auto versionDesc = (CFNumberRef)
81 CFDictionaryGetValue(props, CFSTR(
"Unit_SW_Version"));
84 auto tmp0 = (CFStringRef)
85 CFDictionaryGetValue(props, CFSTR(
"FireWire Product Name"));
89 memset(tmp1, 0,
sizeof(tmp1));
90 CFStringGetCString(tmp0, tmp1,
sizeof(tmp1) -
sizeof(
char),
91 kCFStringEncodingMacRoman);
100 LOG(VB_RECORD, LOG_INFO, QString(
"Scanning guid: 0x%1").arg(
m_guid, 0, 16));
107 LOG(VB_GENERAL, LOG_ERR,
"GetSubunitInfo failed");
116 const std::vector<uint8_t> &cmd,
117 std::vector<uint8_t> &result,
122 uint32_t result_length = 4096;
123 uint8_t response[4096];
128 int ret = (*avc_handle)->
129 AVCCommand(
avc_handle, (
const UInt8*) &cmd[0], cmd.size(),
130 response, (UInt32*) &result_length);
132 if (ret != kIOReturnSuccess)
136 result.insert(result.end(), response, response + result_length);
173 IOCFPlugInInterface **input_plug;
175 int ret = IOCreatePlugInInterfaceForService(
177 &input_plug, (SInt32*) &dummy);
179 if (kIOReturnSuccess != ret)
183 HRESULT err = (*input_plug)->QueryInterface(
190 err = (*input_plug)->QueryInterface(
191 input_plug, CFUUIDGetUUIDBytes(kIOFireWireAVCLibUnitInterfaceID),
197 (*input_plug)->Release(input_plug);
202 ret = (*avc_handle)->addCallbackDispatcherToRunLoop(
205 (*input_plug)->Release(input_plug);
207 if (kIOReturnSuccess != ret)
215 if (kIOReturnSuccess != ret)
230 (*avc_handle)->removeCallbackDispatcherFromRunLoop(
avc_handle);
245 IOCFPlugInInterface **input_plug;
247 int ret = IOCreatePlugInInterfaceForService(
249 &input_plug, (SInt32*) &dummy);
251 if (kIOReturnSuccess != ret)
254 HRESULT err = (*input_plug)->QueryInterface(
255 input_plug, CFUUIDGetUUIDBytes(kIOFireWireNubInterfaceID),
260 (*input_plug)->Release(input_plug);
265 ret = (*fw_handle)->AddCallbackDispatcherToRunLoop(
268 (*input_plug)->Release(input_plug);
270 if (kIOReturnSuccess == ret)
273 ret = (*fw_handle)->OpenWithSessionRef(
277 if (kIOReturnSuccess != ret)
292 (*fw_handle)->RemoveCallbackDispatcherFromRunLoop(
fw_handle);
301 uint32_t generation = 0;
306 if ((*fw_handle)->version < 4)
308 if (kIOReturnSuccess == (*fw_handle)->GetGenerationAndNodeID(
309 fw_handle, (UInt32*) &generation, (UInt16*) &node))
314 if (kIOReturnSuccess == (*fw_handle)->GetLocalNodeID(
321 int ret = (*fw_handle)->GetBusGeneration(
fw_handle, (UInt32*)&generation);
322 if (kIOReturnSuccess == ret)
324 if (kIOReturnSuccess == (*fw_handle)->GetLocalNodeIDWithGeneration(
330 if (kIOReturnSuccess == (*fw_handle)->GetRemoteNodeID(
337 return (local_node >= 0) && (remote_node >= 0);
341 void *dfd, io_service_t , natural_t messageType,
void* )