From: liangzhenying <867174124@qq.com> Date: Fri, 18 Apr 2025 06:11:34 +0000 (+0800) Subject: m8 hid调试 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=4bf367b0ba01e4ea8538276b1a8636af5f8052a7;p=mirrors%2FMouseSdk-MacOS.git m8 hid调试 --- diff --git a/MouseSdk/AiMouseSdk/AiMouseSdk.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist b/MouseSdk/AiMouseSdk/AiMouseSdk.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist index 64bd978..27157b9 100644 --- a/MouseSdk/AiMouseSdk/AiMouseSdk.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/MouseSdk/AiMouseSdk/AiMouseSdk.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ AiMouseSdk copy.xcscheme_^#shared#^_ orderHint - 2 + 4 AiMouseSdk.xcscheme_^#shared#^_ diff --git a/MouseSdk/AiMouseSdk/Manager/HidManager.m b/MouseSdk/AiMouseSdk/Manager/HidManager.m index 294da9e..734ec3a 100644 --- a/MouseSdk/AiMouseSdk/Manager/HidManager.m +++ b/MouseSdk/AiMouseSdk/Manager/HidManager.m @@ -50,8 +50,48 @@ static void hidAppearDevice(void *inContext,IOReturn inResult,void *inSender,IOH uint32_t PrimaryUsagePage = IOHIDDevGetUInt32Property(inIOHIDDeviceRef, CFSTR(kIOHIDPrimaryUsagePageKey)); uint32_t PrimaryUsage = IOHIDDevGetUInt32Property(inIOHIDDeviceRef, CFSTR(kIOHIDPrimaryUsageKey)); // [[HidManager shared] showLog: inIOHIDDeviceRef]; - - if((vid == 0x248a && pid == 0x6092) +// if((vid == 16700 && pid == 8455) +// ){ +// [[HidManager shared] showLog:([NSString stringWithFormat:@"发现M8%@,pid = %d,vid = %d ,page = %d, usage = %d",inIOHIDDeviceRef,pid,vid,PrimaryUsagePage,PrimaryUsage])]; +// if(PrimaryUsagePage == 1 && PrimaryUsage == 6){ +// [HidManager shared].productType = AiMouseProductType_m8; +// [HidManager shared].deviceInfoCha = inIOHIDDeviceRef; +// //注册消息回调 +// unsigned char InputBuffer[64]; +// IOHIDDeviceRegisterInputReportCallback(inIOHIDDeviceRef, InputBuffer, sizeof(InputBuffer), &hidReceiveData, NULL); +// +// IOReturn result = IOHIDDeviceOpen(inIOHIDDeviceRef, kIOHIDOptionsTypeNone); +// if (result != kIOReturnSuccess) { +// [[HidManager shared] showLog:[NSString stringWithFormat:@"打开设备失败! %d",result]]; +// [[AiDeviceAuthManager shared] showHidAlert]; +// return; +// }else{ +// [[HidManager shared] showLog:@"打开设备成功!"]; +// [HidManager shared].connectStateCallBack(true) ; +// } +// } +// else if (PrimaryUsagePage == 65282 && PrimaryUsage == 2){ +//// [HidManager shared].productType = AiMouseProductType_m8; +//// [HidManager shared].deviceInfoCha = inIOHIDDeviceRef; +// //注册消息回调 +// unsigned char InputBuffer[64]; +// IOHIDDeviceRegisterInputReportCallback(inIOHIDDeviceRef, InputBuffer, sizeof(InputBuffer), &hidReceiveData, NULL); +// +// IOReturn result = IOHIDDeviceOpen(inIOHIDDeviceRef, kIOHIDOptionsTypeNone); +// if (result != kIOReturnSuccess) { +// [[HidManager shared] showLog:[NSString stringWithFormat:@"打开设备失败! %d",result]]; +// [[AiDeviceAuthManager shared] showHidAlert]; +// return; +// }else{ +// [[HidManager shared] showLog:@"打开设备成功!"]; +// [HidManager shared].connectStateCallBack(true) ; +// } +// } +// +// return; +// } +// else + if((vid == 0x248a && pid == 0x6092) ){ [[HidManager shared] showLog:([NSString stringWithFormat:@"发现键盘%@,pid = %d,vid = %d ,page = %d, usage = %d",inIOHIDDeviceRef,pid,vid,PrimaryUsagePage,PrimaryUsage])]; [HidManager shared].productType = AiMouseProductType_keyboard; @@ -171,6 +211,7 @@ static void hidDisAppearDevice(void *inContext,IOReturn inResult,void *inSender, static void hidReceiveData(void* context, IOReturn result, void* sender, IOHIDReportType type, uint32_t reportID, uint8_t *report,CFIndex reportLength){ NSData *data = [[NSData alloc] initWithBytes:report length:reportLength]; // [[HidManager shared] showLog:[NSString stringWithFormat:@"receive = %@",data]]; +// return; if([HidManager shared].productType == AiMouseProductType_keyboard){ uint32_t primaryUsagePage = IOHIDDevGetUInt32Property(sender, CFSTR(kIOHIDPrimaryUsagePageKey)); uint32_t primaryUsage = IOHIDDevGetUInt32Property(sender, CFSTR(kIOHIDPrimaryUsageKey)); diff --git a/MouseSdk/AiMouseSdk/Manager/TimerManager.m b/MouseSdk/AiMouseSdk/Manager/TimerManager.m index a0267d1..556807b 100644 --- a/MouseSdk/AiMouseSdk/Manager/TimerManager.m +++ b/MouseSdk/AiMouseSdk/Manager/TimerManager.m @@ -32,7 +32,7 @@ // [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; // [[NSRunLoop currentRunLoop] run]; // }); - self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerAction) userInfo:nil repeats:true]; + self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timerAction) userInfo:nil repeats:true]; } - (void)timerAction{ diff --git a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate index bc0c02b..0e26bc4 100644 Binary files a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate and b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 51ba4e0..ff83931 100644 --- a/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/MouseSdk/MouseSdk.xcworkspace/xcuserdata/yaozuopan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -7,33 +7,33 @@ + startingLineNumber = "57" + endingLineNumber = "57" + landmarkName = "hidAppearDevice(inContext, inResult, inSender, inIOHIDDeviceRef)" + landmarkType = "9"> diff --git a/MouseSdk/Pods/Pods.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist b/MouseSdk/Pods/Pods.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist index 30f1cdd..a1cc8f6 100644 --- a/MouseSdk/Pods/Pods.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/MouseSdk/Pods/Pods.xcodeproj/xcuserdata/yaozuopan.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ Pods-MouseSdk.xcscheme_^#shared#^_ orderHint - 4 + 2