From d4ffd217288cfc0d2798b3df67ab20bc867a7f7e Mon Sep 17 00:00:00 2001 From: Dominik Pich Date: Sun, 17 Mar 2013 13:33:20 +0100 Subject: DDHIDLib 1.1.1 --- DDHidLib-Info.plist | 22 + DDHidLib.xcodeproj/project.pbxproj | 1118 ++++ LICENSE.html | 181 + README.md | 10 +- browser/English.lproj/EventWatcher.nib/classes.nib | 13 + browser/English.lproj/EventWatcher.nib/info.nib | 16 + .../EventWatcher.nib/keyedobjects.nib | Bin 0 -> 9260 bytes browser/English.lproj/InfoPlist.strings | Bin 0 -> 190 bytes browser/English.lproj/MainMenu.nib/classes.nib | 19 + browser/English.lproj/MainMenu.nib/info.nib | 22 + .../English.lproj/MainMenu.nib/keyedobjects.nib | Bin 0 -> 31311 bytes browser/HIDBrowser_Prefix.pch | 7 + browser/HexFormatter.h | 34 + browser/HexFormatter.m | 49 + browser/HidBrowserController.h | 42 + browser/HidBrowserController.m | 144 + browser/Info.plist | 30 + browser/WatcherWindowController.h | 57 + browser/WatcherWindowController.m | 269 + browser/main.m | 30 + changelog.yml | 24 + device_test/AppleMikeyPaneController.h | 62 + device_test/AppleMikeyPaneController.m | 160 + device_test/AppleRemote.tiff | Bin 0 -> 90050 bytes device_test/AppleRemotePaneController.h | 51 + device_test/AppleRemotePaneController.m | 145 + device_test/BoolFormatter.h | 35 + device_test/BoolFormatter.m | 82 + device_test/ButtonState.h | 38 + device_test/ButtonState.m | 77 + device_test/DeviceTestController.h | 35 + device_test/DeviceTestController.m | 49 + device_test/English.lproj/InfoPlist.strings | Bin 0 -> 190 bytes .../English.lproj/MainMenu.nib/designable.nib | 5311 ++++++++++++++++++++ .../English.lproj/MainMenu.nib/keyedobjects.nib | Bin 0 -> 46512 bytes device_test/Info.plist | 26 + device_test/JoystickPaneController.h | 72 + device_test/JoystickPaneController.m | 174 + device_test/KeyboardPaneController.h | 64 + device_test/KeyboardPaneController.m | 179 + device_test/MousePaneController.h | 68 + device_test/MousePaneController.m | 211 + device_test/RemoteFeedbackView.h | 42 + device_test/RemoteFeedbackView.m | 162 + device_test/main.m | 30 + header.c | 23 + lib/DDHidAppleMikey.h | 66 + lib/DDHidAppleMikey.m | 164 + lib/DDHidAppleRemote.h | 84 + lib/DDHidAppleRemote.m | 236 + lib/DDHidDevice.h | 131 + lib/DDHidDevice.m | 585 +++ lib/DDHidElement.h | 65 + lib/DDHidElement.m | 185 + lib/DDHidEvent.h | 45 + lib/DDHidEvent.m | 81 + lib/DDHidJoystick.h | 132 + lib/DDHidJoystick.m | 654 +++ lib/DDHidKeyboard.h | 68 + lib/DDHidKeyboard.m | 173 + lib/DDHidKeyboardBarcodeScanner.h | 74 + lib/DDHidKeyboardBarcodeScanner.m | 222 + lib/DDHidLib.h | 36 + lib/DDHidMouse.h | 78 + lib/DDHidMouse.m | 279 + lib/DDHidQueue.h | 70 + lib/DDHidQueue.m | 172 + lib/DDHidStandardUsages.plist | 2327 +++++++++ lib/DDHidUsage.h | 52 + lib/DDHidUsage.m | 84 + lib/DDHidUsageTables.h | 40 + lib/DDHidUsageTables.m | 85 + lib/NSDictionary+DDHidExtras.h | 46 + lib/NSDictionary+DDHidExtras.m | 81 + usb_hid_usages.txt | 1086 ++++ usb_hid_usages2plist | 46 + vendor/NSXReturnThrowError/NSXReturnThrowError.h | 103 + vendor/NSXReturnThrowError/NSXReturnThrowError.m | 106 + versions.xcconfig | 2 + 79 files changed, 16839 insertions(+), 2 deletions(-) create mode 100644 DDHidLib-Info.plist create mode 100644 DDHidLib.xcodeproj/project.pbxproj create mode 100644 LICENSE.html create mode 100644 browser/English.lproj/EventWatcher.nib/classes.nib create mode 100644 browser/English.lproj/EventWatcher.nib/info.nib create mode 100644 browser/English.lproj/EventWatcher.nib/keyedobjects.nib create mode 100644 browser/English.lproj/InfoPlist.strings create mode 100644 browser/English.lproj/MainMenu.nib/classes.nib create mode 100644 browser/English.lproj/MainMenu.nib/info.nib create mode 100644 browser/English.lproj/MainMenu.nib/keyedobjects.nib create mode 100644 browser/HIDBrowser_Prefix.pch create mode 100644 browser/HexFormatter.h create mode 100644 browser/HexFormatter.m create mode 100644 browser/HidBrowserController.h create mode 100644 browser/HidBrowserController.m create mode 100644 browser/Info.plist create mode 100644 browser/WatcherWindowController.h create mode 100644 browser/WatcherWindowController.m create mode 100644 browser/main.m create mode 100644 changelog.yml create mode 100644 device_test/AppleMikeyPaneController.h create mode 100644 device_test/AppleMikeyPaneController.m create mode 100644 device_test/AppleRemote.tiff create mode 100644 device_test/AppleRemotePaneController.h create mode 100644 device_test/AppleRemotePaneController.m create mode 100644 device_test/BoolFormatter.h create mode 100644 device_test/BoolFormatter.m create mode 100644 device_test/ButtonState.h create mode 100644 device_test/ButtonState.m create mode 100644 device_test/DeviceTestController.h create mode 100644 device_test/DeviceTestController.m create mode 100644 device_test/English.lproj/InfoPlist.strings create mode 100644 device_test/English.lproj/MainMenu.nib/designable.nib create mode 100644 device_test/English.lproj/MainMenu.nib/keyedobjects.nib create mode 100644 device_test/Info.plist create mode 100644 device_test/JoystickPaneController.h create mode 100644 device_test/JoystickPaneController.m create mode 100644 device_test/KeyboardPaneController.h create mode 100644 device_test/KeyboardPaneController.m create mode 100644 device_test/MousePaneController.h create mode 100644 device_test/MousePaneController.m create mode 100644 device_test/RemoteFeedbackView.h create mode 100644 device_test/RemoteFeedbackView.m create mode 100644 device_test/main.m create mode 100644 header.c create mode 100644 lib/DDHidAppleMikey.h create mode 100644 lib/DDHidAppleMikey.m create mode 100644 lib/DDHidAppleRemote.h create mode 100644 lib/DDHidAppleRemote.m create mode 100644 lib/DDHidDevice.h create mode 100644 lib/DDHidDevice.m create mode 100644 lib/DDHidElement.h create mode 100644 lib/DDHidElement.m create mode 100644 lib/DDHidEvent.h create mode 100644 lib/DDHidEvent.m create mode 100644 lib/DDHidJoystick.h create mode 100644 lib/DDHidJoystick.m create mode 100644 lib/DDHidKeyboard.h create mode 100644 lib/DDHidKeyboard.m create mode 100644 lib/DDHidKeyboardBarcodeScanner.h create mode 100644 lib/DDHidKeyboardBarcodeScanner.m create mode 100644 lib/DDHidLib.h create mode 100644 lib/DDHidMouse.h create mode 100644 lib/DDHidMouse.m create mode 100644 lib/DDHidQueue.h create mode 100644 lib/DDHidQueue.m create mode 100644 lib/DDHidStandardUsages.plist create mode 100644 lib/DDHidUsage.h create mode 100644 lib/DDHidUsage.m create mode 100644 lib/DDHidUsageTables.h create mode 100644 lib/DDHidUsageTables.m create mode 100644 lib/NSDictionary+DDHidExtras.h create mode 100644 lib/NSDictionary+DDHidExtras.m create mode 100644 usb_hid_usages.txt create mode 100755 usb_hid_usages2plist create mode 100644 vendor/NSXReturnThrowError/NSXReturnThrowError.h create mode 100644 vendor/NSXReturnThrowError/NSXReturnThrowError.m create mode 100644 versions.xcconfig diff --git a/DDHidLib-Info.plist b/DDHidLib-Info.plist new file mode 100644 index 0000000..b77aa20 --- /dev/null +++ b/DDHidLib-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.dribin.dave.DDHidLib + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + CFBundleShortVersionString + ${CURRENT_MARKETING_VERSION} + + diff --git a/DDHidLib.xcodeproj/project.pbxproj b/DDHidLib.xcodeproj/project.pbxproj new file mode 100644 index 0000000..9f72bee --- /dev/null +++ b/DDHidLib.xcodeproj/project.pbxproj @@ -0,0 +1,1118 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXAggregateTarget section */ + 551711110B8F41EB00C82155 /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 551711280B8F420E00C82155 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + 551711130B8F41F500C82155 /* PBXTargetDependency */, + 551711150B8F41F500C82155 /* PBXTargetDependency */, + 55D5935D0BAE3B1E00364849 /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 55170D360B8EC2CE00C82155 /* DDHidAppleRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 55170D340B8EC2CE00C82155 /* DDHidAppleRemote.h */; }; + 55170D370B8EC2CE00C82155 /* DDHidAppleRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 55170D350B8EC2CE00C82155 /* DDHidAppleRemote.m */; }; + 55170E0D0B8ECCAC00C82155 /* AppleRemotePaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55170E0C0B8ECCAC00C82155 /* AppleRemotePaneController.m */; }; + 55170E650B8ECEF600C82155 /* RemoteFeedbackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 55170E640B8ECEF600C82155 /* RemoteFeedbackView.m */; }; + 55170E670B8ECF0000C82155 /* AppleRemote.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 55170E660B8ECF0000C82155 /* AppleRemote.tiff */; }; + 55193E580B93F31D004C0C98 /* DDHidDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917B4F0B533C82005308AC /* DDHidDevice.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E590B93F31D004C0C98 /* DDHidDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917B500B533C82005308AC /* DDHidDevice.m */; }; + 55193E5A0B93F31D004C0C98 /* DDHidElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917E6F0B5413E7005308AC /* DDHidElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E5B0B93F31D004C0C98 /* DDHidElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E700B5413E7005308AC /* DDHidElement.m */; }; + 55193E5C0B93F31D004C0C98 /* DDHidUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = 559CB82B0B595B2F00C8FD74 /* DDHidUsage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E5D0B93F31D004C0C98 /* DDHidUsage.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CB82C0B595B2F00C8FD74 /* DDHidUsage.m */; }; + 55193E5E0B93F31D004C0C98 /* DDHidQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 559180CA0B575698005308AC /* DDHidQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E5F0B93F31D004C0C98 /* DDHidQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 559180CB0B575698005308AC /* DDHidQueue.m */; }; + 55193E600B93F31D004C0C98 /* DDHidEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 559181A40B576149005308AC /* DDHidEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E610B93F31D004C0C98 /* DDHidEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 559181A50B576149005308AC /* DDHidEvent.m */; }; + 55193E620B93F31D004C0C98 /* DDHidUsageTables.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917F610B545104005308AC /* DDHidUsageTables.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E630B93F31D004C0C98 /* DDHidUsageTables.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917F620B545104005308AC /* DDHidUsageTables.m */; }; + 55193E640B93F31D004C0C98 /* NSDictionary+DDHidExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917E720B541541005308AC /* NSDictionary+DDHidExtras.h */; settings = {ATTRIBUTES = (); }; }; + 55193E650B93F31D004C0C98 /* NSDictionary+DDHidExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E730B541541005308AC /* NSDictionary+DDHidExtras.m */; }; + 55193E660B93F31D004C0C98 /* DDHidMouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 559CBC2A0B5B34C300C8FD74 /* DDHidMouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E670B93F31D004C0C98 /* DDHidMouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CBC2B0B5B34C300C8FD74 /* DDHidMouse.m */; }; + 55193E680B93F31D004C0C98 /* DDHidJoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FD66D30B5DDC3F00325FEF /* DDHidJoystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E690B93F31D004C0C98 /* DDHidJoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FD66D40B5DDC3F00325FEF /* DDHidJoystick.m */; }; + 55193E6A0B93F31D004C0C98 /* DDHidAppleRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 55170D340B8EC2CE00C82155 /* DDHidAppleRemote.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E6B0B93F31D004C0C98 /* DDHidAppleRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 55170D350B8EC2CE00C82155 /* DDHidAppleRemote.m */; }; + 55193E6C0B93F31D004C0C98 /* DDHidLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FD67CB0B5DE18600325FEF /* DDHidLib.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55193E700B93F35A004C0C98 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 556E1E680B5359F9002F709C /* IOKit.framework */; }; + 55193F110B93F36F004C0C98 /* NSXReturnThrowError.h in Headers */ = {isa = PBXBuildFile; fileRef = 55BE6DCB0B8033010085514D /* NSXReturnThrowError.h */; settings = {ATTRIBUTES = (); }; }; + 55193F120B93F371004C0C98 /* NSXReturnThrowError.m in Sources */ = {isa = PBXBuildFile; fileRef = 55BE6DCC0B8033010085514D /* NSXReturnThrowError.m */; }; + 556E1E690B5359F9002F709C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 556E1E680B5359F9002F709C /* IOKit.framework */; }; + 55917B640B53408C005308AC /* HidBrowserController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917B630B53408C005308AC /* HidBrowserController.m */; }; + 55917E1C0B53E454005308AC /* HexFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E1B0B53E454005308AC /* HexFormatter.m */; }; + 559CBAEB0B5B31AB00C8FD74 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 559CBAE90B5B31AB00C8FD74 /* Info.plist */; }; + 559CBAEC0B5B31AB00C8FD74 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CBAEA0B5B31AB00C8FD74 /* main.m */; }; + 559CBB930B5B31E300C8FD74 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + 559CBB940B5B31EA00C8FD74 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 556E1E680B5359F9002F709C /* IOKit.framework */; }; + 559CBBD10B5B337600C8FD74 /* DDHidDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917B4F0B533C82005308AC /* DDHidDevice.h */; }; + 559CBBD20B5B337600C8FD74 /* DDHidDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917B500B533C82005308AC /* DDHidDevice.m */; }; + 559CBBD30B5B337600C8FD74 /* DDHidElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917E6F0B5413E7005308AC /* DDHidElement.h */; }; + 559CBBD40B5B337600C8FD74 /* DDHidElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E700B5413E7005308AC /* DDHidElement.m */; }; + 559CBBD50B5B337600C8FD74 /* DDHidUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = 559CB82B0B595B2F00C8FD74 /* DDHidUsage.h */; }; + 559CBBD60B5B337600C8FD74 /* DDHidUsage.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CB82C0B595B2F00C8FD74 /* DDHidUsage.m */; }; + 559CBBD70B5B337600C8FD74 /* DDHidQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 559180CA0B575698005308AC /* DDHidQueue.h */; }; + 559CBBD80B5B337600C8FD74 /* DDHidQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 559180CB0B575698005308AC /* DDHidQueue.m */; }; + 559CBBD90B5B337600C8FD74 /* DDHidEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 559181A40B576149005308AC /* DDHidEvent.h */; }; + 559CBBDA0B5B337600C8FD74 /* DDHidEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 559181A50B576149005308AC /* DDHidEvent.m */; }; + 559CBBDB0B5B337600C8FD74 /* DDHidUsageTables.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917F610B545104005308AC /* DDHidUsageTables.h */; }; + 559CBBDC0B5B337600C8FD74 /* DDHidUsageTables.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917F620B545104005308AC /* DDHidUsageTables.m */; }; + 559CBBDD0B5B337600C8FD74 /* NSDictionary+DDHidExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 55917E720B541541005308AC /* NSDictionary+DDHidExtras.h */; }; + 559CBC260B5B349100C8FD74 /* NSDictionary+DDHidExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E730B541541005308AC /* NSDictionary+DDHidExtras.m */; }; + 559CBC2C0B5B34C300C8FD74 /* DDHidMouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 559CBC2A0B5B34C300C8FD74 /* DDHidMouse.h */; }; + 559CBC2D0B5B34C300C8FD74 /* DDHidMouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CBC2B0B5B34C300C8FD74 /* DDHidMouse.m */; }; + 559CBCA90B5B3BCE00C8FD74 /* MousePaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CBCA80B5B3BCE00C8FD74 /* MousePaneController.m */; }; + 55A000520B5D7C06001B47E5 /* BoolFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A000500B5D7C06001B47E5 /* BoolFormatter.m */; }; + 55BE6DCD0B8033010085514D /* NSXReturnThrowError.h in Headers */ = {isa = PBXBuildFile; fileRef = 55BE6DCB0B8033010085514D /* NSXReturnThrowError.h */; }; + 55BE6DCE0B8033010085514D /* NSXReturnThrowError.m in Sources */ = {isa = PBXBuildFile; fileRef = 55BE6DCC0B8033010085514D /* NSXReturnThrowError.m */; }; + 55CA60E50BA0F2530012CF7B /* DDHidKeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 55CA60E30BA0F2530012CF7B /* DDHidKeyboard.h */; }; + 55CA60E60BA0F2530012CF7B /* DDHidKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA60E40BA0F2530012CF7B /* DDHidKeyboard.m */; }; + 55CA668B0BA38AEF0012CF7B /* KeyboardPaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA668A0BA38AEF0012CF7B /* KeyboardPaneController.m */; }; + 55D5927D0BAE306E00364849 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55D5927B0BAE306E00364849 /* InfoPlist.strings */; }; + 55D592940BAE30B600364849 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 55D592920BAE30B600364849 /* MainMenu.nib */; }; + 55D593290BAE3ABD00364849 /* DDHidLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55193E500B93F2EE004C0C98 /* DDHidLib.framework */; }; + 55D593390BAE3ADF00364849 /* DDHidLib.framework in Copy Files to Frameworks */ = {isa = PBXBuildFile; fileRef = 55193E500B93F2EE004C0C98 /* DDHidLib.framework */; }; + 55D593660BAE3B5D00364849 /* DDHidLib.framework in Copy Files to Frameworks */ = {isa = PBXBuildFile; fileRef = 55193E500B93F2EE004C0C98 /* DDHidLib.framework */; }; + 55D593750BAE3B7500364849 /* DDHidLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55193E500B93F2EE004C0C98 /* DDHidLib.framework */; }; + 55D5937B0BAE3B8800364849 /* DDHidKeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 55CA60E30BA0F2530012CF7B /* DDHidKeyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55D5937C0BAE3B8800364849 /* DDHidKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA60E40BA0F2530012CF7B /* DDHidKeyboard.m */; }; + 55D593870BAE3BB700364849 /* DDHidStandardUsages.plist in Resources */ = {isa = PBXBuildFile; fileRef = 55917F760B54535B005308AC /* DDHidStandardUsages.plist */; }; + 55DCD9C60B55D35D000648E5 /* WatcherWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55DCD9C50B55D35D000648E5 /* WatcherWindowController.m */; }; + 55DCD9E00B55D503000648E5 /* EventWatcher.nib in Resources */ = {isa = PBXBuildFile; fileRef = 55DCD9DE0B55D503000648E5 /* EventWatcher.nib */; }; + 55FC9FDB0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FC9FD90BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h */; }; + 55FC9FDC0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FC9FDA0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m */; }; + 55FC9FDD0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FC9FD90BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 55FC9FDE0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FC9FDA0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m */; }; + 55FD65CB0B5DD57200325FEF /* DeviceTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FD65CA0B5DD57200325FEF /* DeviceTestController.m */; }; + 55FD66D50B5DDC3F00325FEF /* DDHidJoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FD66D30B5DDC3F00325FEF /* DDHidJoystick.h */; }; + 55FD66D60B5DDC3F00325FEF /* DDHidJoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FD66D40B5DDC3F00325FEF /* DDHidJoystick.m */; }; + 55FD66FD0B5DDD2100325FEF /* JoystickPaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FD66FC0B5DDD2100325FEF /* JoystickPaneController.m */; }; + 55FD67750B5DDF8200325FEF /* ButtonState.m in Sources */ = {isa = PBXBuildFile; fileRef = 55FD67740B5DDF8200325FEF /* ButtonState.m */; }; + 55FD67CC0B5DE18600325FEF /* DDHidLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FD67CB0B5DE18600325FEF /* DDHidLib.h */; }; + 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + B366F1B016F5DE9800C0BA49 /* DDHidAppleMikey.h in Headers */ = {isa = PBXBuildFile; fileRef = B366F1AE16F5DE9800C0BA49 /* DDHidAppleMikey.h */; }; + B366F1B116F5DE9800C0BA49 /* DDHidAppleMikey.m in Sources */ = {isa = PBXBuildFile; fileRef = B366F1AF16F5DE9800C0BA49 /* DDHidAppleMikey.m */; }; + B366F1B316F5E20800C0BA49 /* DDHidAppleMikey.m in Sources */ = {isa = PBXBuildFile; fileRef = B366F1AF16F5DE9800C0BA49 /* DDHidAppleMikey.m */; }; + B366F1B616F5E64B00C0BA49 /* AppleMikeyPaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = B366F1B516F5E64B00C0BA49 /* AppleMikeyPaneController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 551711120B8F41F500C82155 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D1107260486CEB800E47090; + remoteInfo = HIDBrowser; + }; + 551711140B8F41F500C82155 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 559CBAE00B5B313000C8FD74; + remoteInfo = HIDDeviceTest; + }; + 55D593250BAE3AA800364849 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55193E4F0B93F2EE004C0C98; + remoteInfo = DDHidLib; + }; + 55D5935C0BAE3B1E00364849 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55193E4F0B93F2EE004C0C98; + remoteInfo = DDHidLib; + }; + 55D593600BAE3B3300364849 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55193E4F0B93F2EE004C0C98; + remoteInfo = DDHidLib; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 55D593350BAE3AC800364849 /* Copy Files to Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 55D593390BAE3ADF00364849 /* DDHidLib.framework in Copy Files to Frameworks */, + ); + name = "Copy Files to Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 55D593620BAE3B4B00364849 /* Copy Files to Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 55D593660BAE3B5D00364849 /* DDHidLib.framework in Copy Files to Frameworks */, + ); + name = "Copy Files to Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* HIDBrowser_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIDBrowser_Prefix.pch; sourceTree = ""; }; + 55170D340B8EC2CE00C82155 /* DDHidAppleRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidAppleRemote.h; sourceTree = ""; }; + 55170D350B8EC2CE00C82155 /* DDHidAppleRemote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidAppleRemote.m; sourceTree = ""; }; + 55170E0B0B8ECCAC00C82155 /* AppleRemotePaneController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleRemotePaneController.h; sourceTree = ""; }; + 55170E0C0B8ECCAC00C82155 /* AppleRemotePaneController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppleRemotePaneController.m; sourceTree = ""; }; + 55170E630B8ECEF600C82155 /* RemoteFeedbackView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RemoteFeedbackView.h; sourceTree = ""; }; + 55170E640B8ECEF600C82155 /* RemoteFeedbackView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = RemoteFeedbackView.m; sourceTree = ""; }; + 55170E660B8ECF0000C82155 /* AppleRemote.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = AppleRemote.tiff; sourceTree = ""; }; + 55193E500B93F2EE004C0C98 /* DDHidLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DDHidLib.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 55193E510B93F2EE004C0C98 /* DDHidLib-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DDHidLib-Info.plist"; sourceTree = ""; }; + 556E1E680B5359F9002F709C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; + 55917B4F0B533C82005308AC /* DDHidDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidDevice.h; sourceTree = ""; }; + 55917B500B533C82005308AC /* DDHidDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidDevice.m; sourceTree = ""; }; + 55917B620B53408C005308AC /* HidBrowserController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HidBrowserController.h; sourceTree = ""; }; + 55917B630B53408C005308AC /* HidBrowserController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HidBrowserController.m; sourceTree = ""; }; + 55917E1A0B53E454005308AC /* HexFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexFormatter.h; sourceTree = ""; }; + 55917E1B0B53E454005308AC /* HexFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HexFormatter.m; sourceTree = ""; }; + 55917E6F0B5413E7005308AC /* DDHidElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidElement.h; sourceTree = ""; }; + 55917E700B5413E7005308AC /* DDHidElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidElement.m; sourceTree = ""; }; + 55917E720B541541005308AC /* NSDictionary+DDHidExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+DDHidExtras.h"; sourceTree = ""; }; + 55917E730B541541005308AC /* NSDictionary+DDHidExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+DDHidExtras.m"; sourceTree = ""; }; + 55917F610B545104005308AC /* DDHidUsageTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidUsageTables.h; sourceTree = ""; }; + 55917F620B545104005308AC /* DDHidUsageTables.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidUsageTables.m; sourceTree = ""; }; + 55917F760B54535B005308AC /* DDHidStandardUsages.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = DDHidStandardUsages.plist; path = ../lib/DDHidStandardUsages.plist; sourceTree = ""; }; + 559180CA0B575698005308AC /* DDHidQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidQueue.h; sourceTree = ""; }; + 559180CB0B575698005308AC /* DDHidQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidQueue.m; sourceTree = ""; }; + 559181A40B576149005308AC /* DDHidEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidEvent.h; sourceTree = ""; }; + 559181A50B576149005308AC /* DDHidEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidEvent.m; sourceTree = ""; }; + 559CB82B0B595B2F00C8FD74 /* DDHidUsage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidUsage.h; sourceTree = ""; }; + 559CB82C0B595B2F00C8FD74 /* DDHidUsage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidUsage.m; sourceTree = ""; }; + 559CBAE10B5B313000C8FD74 /* HIDDeviceTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HIDDeviceTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 559CBAE90B5B31AB00C8FD74 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 559CBAEA0B5B31AB00C8FD74 /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 559CBBCC0B5B336600C8FD74 /* libddhid.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libddhid.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 559CBC2A0B5B34C300C8FD74 /* DDHidMouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidMouse.h; sourceTree = ""; }; + 559CBC2B0B5B34C300C8FD74 /* DDHidMouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidMouse.m; sourceTree = ""; }; + 559CBCA70B5B3BCE00C8FD74 /* MousePaneController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MousePaneController.h; sourceTree = ""; }; + 559CBCA80B5B3BCE00C8FD74 /* MousePaneController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MousePaneController.m; sourceTree = ""; }; + 55A000500B5D7C06001B47E5 /* BoolFormatter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = BoolFormatter.m; sourceTree = ""; }; + 55A000510B5D7C06001B47E5 /* BoolFormatter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BoolFormatter.h; sourceTree = ""; }; + 55BE6DCB0B8033010085514D /* NSXReturnThrowError.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSXReturnThrowError.h; sourceTree = ""; }; + 55BE6DCC0B8033010085514D /* NSXReturnThrowError.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSXReturnThrowError.m; sourceTree = ""; }; + 55CA60E30BA0F2530012CF7B /* DDHidKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidKeyboard.h; sourceTree = ""; }; + 55CA60E40BA0F2530012CF7B /* DDHidKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidKeyboard.m; sourceTree = ""; }; + 55CA66890BA38AEF0012CF7B /* KeyboardPaneController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardPaneController.h; sourceTree = ""; }; + 55CA668A0BA38AEF0012CF7B /* KeyboardPaneController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyboardPaneController.m; sourceTree = ""; }; + 55D592200BAE2E4500364849 /* versions.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = versions.xcconfig; sourceTree = ""; }; + 55D5927C0BAE306E00364849 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 55D592930BAE30B600364849 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; + 55DCD9C40B55D35D000648E5 /* WatcherWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WatcherWindowController.h; sourceTree = ""; }; + 55DCD9C50B55D35D000648E5 /* WatcherWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WatcherWindowController.m; sourceTree = ""; }; + 55DCD9DF0B55D503000648E5 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/EventWatcher.nib; sourceTree = ""; }; + 55FC9FD90BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DDHidKeyboardBarcodeScanner.h; sourceTree = ""; }; + 55FC9FDA0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DDHidKeyboardBarcodeScanner.m; sourceTree = ""; }; + 55FD65C90B5DD57200325FEF /* DeviceTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceTestController.h; sourceTree = ""; }; + 55FD65CA0B5DD57200325FEF /* DeviceTestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceTestController.m; sourceTree = ""; }; + 55FD66D30B5DDC3F00325FEF /* DDHidJoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidJoystick.h; sourceTree = ""; }; + 55FD66D40B5DDC3F00325FEF /* DDHidJoystick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidJoystick.m; sourceTree = ""; }; + 55FD66FB0B5DDD2100325FEF /* JoystickPaneController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JoystickPaneController.h; sourceTree = ""; }; + 55FD66FC0B5DDD2100325FEF /* JoystickPaneController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JoystickPaneController.m; sourceTree = ""; }; + 55FD67730B5DDF8200325FEF /* ButtonState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonState.h; sourceTree = ""; }; + 55FD67740B5DDF8200325FEF /* ButtonState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ButtonState.m; sourceTree = ""; }; + 55FD67CB0B5DE18600325FEF /* DDHidLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidLib.h; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* HIDBrowser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HIDBrowser.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B366F1AE16F5DE9800C0BA49 /* DDHidAppleMikey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDHidAppleMikey.h; sourceTree = ""; }; + B366F1AF16F5DE9800C0BA49 /* DDHidAppleMikey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDHidAppleMikey.m; sourceTree = ""; }; + B366F1B416F5E64A00C0BA49 /* AppleMikeyPaneController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleMikeyPaneController.h; sourceTree = ""; }; + B366F1B516F5E64B00C0BA49 /* AppleMikeyPaneController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppleMikeyPaneController.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 55193E4E0B93F2EE004C0C98 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55193E700B93F35A004C0C98 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBADF0B5B313000C8FD74 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55D593750BAE3B7500364849 /* DDHidLib.framework in Frameworks */, + 559CBB940B5B31EA00C8FD74 /* IOKit.framework in Frameworks */, + 559CBB930B5B31E300C8FD74 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBBCA0B5B336600C8FD74 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55D593290BAE3ABD00364849 /* DDHidLib.framework in Frameworks */, + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 556E1E690B5359F9002F709C /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 55917B620B53408C005308AC /* HidBrowserController.h */, + 55917B630B53408C005308AC /* HidBrowserController.m */, + 55917E1A0B53E454005308AC /* HexFormatter.h */, + 55917E1B0B53E454005308AC /* HexFormatter.m */, + 55DCD9C40B55D35D000648E5 /* WatcherWindowController.h */, + 55DCD9C50B55D35D000648E5 /* WatcherWindowController.m */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 556E1E680B5359F9002F709C /* IOKit.framework */, + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* HIDBrowser.app */, + 559CBAE10B5B313000C8FD74 /* HIDDeviceTest.app */, + 559CBBCC0B5B336600C8FD74 /* libddhid.a */, + 55193E500B93F2EE004C0C98 /* DDHidLib.framework */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* HIDBrowser */ = { + isa = PBXGroup; + children = ( + 559CBAE80B5B31AB00C8FD74 /* device_test */, + 559CBAA10B5B2F4400C8FD74 /* browser */, + 55917B4C0B533C53005308AC /* lib */, + 55BE6DC90B8033010085514D /* vendor */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + 55193E510B93F2EE004C0C98 /* DDHidLib-Info.plist */, + 55D592200BAE2E4500364849 /* versions.xcconfig */, + ); + name = HIDBrowser; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* HIDBrowser_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 55917F760B54535B005308AC /* DDHidStandardUsages.plist */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, + 55DCD9DE0B55D503000648E5 /* EventWatcher.nib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5547B9D20B8E1C02003C6ADE /* Classes */ = { + isa = PBXGroup; + children = ( + B366F1B416F5E64A00C0BA49 /* AppleMikeyPaneController.h */, + B366F1B516F5E64B00C0BA49 /* AppleMikeyPaneController.m */, + 55FD65C90B5DD57200325FEF /* DeviceTestController.h */, + 55FD65CA0B5DD57200325FEF /* DeviceTestController.m */, + 559CBCA70B5B3BCE00C8FD74 /* MousePaneController.h */, + 559CBCA80B5B3BCE00C8FD74 /* MousePaneController.m */, + 55FD66FB0B5DDD2100325FEF /* JoystickPaneController.h */, + 55FD66FC0B5DDD2100325FEF /* JoystickPaneController.m */, + 55CA66890BA38AEF0012CF7B /* KeyboardPaneController.h */, + 55CA668A0BA38AEF0012CF7B /* KeyboardPaneController.m */, + 55170E0B0B8ECCAC00C82155 /* AppleRemotePaneController.h */, + 55170E0C0B8ECCAC00C82155 /* AppleRemotePaneController.m */, + 55170E630B8ECEF600C82155 /* RemoteFeedbackView.h */, + 55170E640B8ECEF600C82155 /* RemoteFeedbackView.m */, + 55A000510B5D7C06001B47E5 /* BoolFormatter.h */, + 55A000500B5D7C06001B47E5 /* BoolFormatter.m */, + 55FD67730B5DDF8200325FEF /* ButtonState.h */, + 55FD67740B5DDF8200325FEF /* ButtonState.m */, + ); + name = Classes; + sourceTree = ""; + }; + 55917B4C0B533C53005308AC /* lib */ = { + isa = PBXGroup; + children = ( + B366F1AE16F5DE9800C0BA49 /* DDHidAppleMikey.h */, + B366F1AF16F5DE9800C0BA49 /* DDHidAppleMikey.m */, + 55917B4F0B533C82005308AC /* DDHidDevice.h */, + 55917B500B533C82005308AC /* DDHidDevice.m */, + 55917E6F0B5413E7005308AC /* DDHidElement.h */, + 55917E700B5413E7005308AC /* DDHidElement.m */, + 559CB82B0B595B2F00C8FD74 /* DDHidUsage.h */, + 559CB82C0B595B2F00C8FD74 /* DDHidUsage.m */, + 559180CA0B575698005308AC /* DDHidQueue.h */, + 559180CB0B575698005308AC /* DDHidQueue.m */, + 559181A40B576149005308AC /* DDHidEvent.h */, + 559181A50B576149005308AC /* DDHidEvent.m */, + 55917F610B545104005308AC /* DDHidUsageTables.h */, + 55917F620B545104005308AC /* DDHidUsageTables.m */, + 55917E720B541541005308AC /* NSDictionary+DDHidExtras.h */, + 55917E730B541541005308AC /* NSDictionary+DDHidExtras.m */, + 559CBC2A0B5B34C300C8FD74 /* DDHidMouse.h */, + 55FD66D30B5DDC3F00325FEF /* DDHidJoystick.h */, + 559CBC2B0B5B34C300C8FD74 /* DDHidMouse.m */, + 55FD66D40B5DDC3F00325FEF /* DDHidJoystick.m */, + 55CA60E30BA0F2530012CF7B /* DDHidKeyboard.h */, + 55CA60E40BA0F2530012CF7B /* DDHidKeyboard.m */, + 55170D340B8EC2CE00C82155 /* DDHidAppleRemote.h */, + 55170D350B8EC2CE00C82155 /* DDHidAppleRemote.m */, + 55FC9FD90BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h */, + 55FC9FDA0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m */, + 55FD67CB0B5DE18600325FEF /* DDHidLib.h */, + ); + path = lib; + sourceTree = ""; + }; + 559CBAA10B5B2F4400C8FD74 /* browser */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + ); + path = browser; + sourceTree = ""; + }; + 559CBAE80B5B31AB00C8FD74 /* device_test */ = { + isa = PBXGroup; + children = ( + 5547B9D20B8E1C02003C6ADE /* Classes */, + 559CBAEA0B5B31AB00C8FD74 /* main.m */, + 559CBBA20B5B31FD00C8FD74 /* Resources */, + ); + path = device_test; + sourceTree = ""; + }; + 559CBBA20B5B31FD00C8FD74 /* Resources */ = { + isa = PBXGroup; + children = ( + 55170E660B8ECF0000C82155 /* AppleRemote.tiff */, + 559CBAE90B5B31AB00C8FD74 /* Info.plist */, + 55D5927B0BAE306E00364849 /* InfoPlist.strings */, + 55D592920BAE30B600364849 /* MainMenu.nib */, + ); + name = Resources; + sourceTree = ""; + }; + 55BE6DC90B8033010085514D /* vendor */ = { + isa = PBXGroup; + children = ( + 55BE6DCA0B8033010085514D /* NSXReturnThrowError */, + ); + path = vendor; + sourceTree = ""; + }; + 55BE6DCA0B8033010085514D /* NSXReturnThrowError */ = { + isa = PBXGroup; + children = ( + 55BE6DCB0B8033010085514D /* NSXReturnThrowError.h */, + 55BE6DCC0B8033010085514D /* NSXReturnThrowError.m */, + ); + path = NSXReturnThrowError; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 55193E4B0B93F2EE004C0C98 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 55193E580B93F31D004C0C98 /* DDHidDevice.h in Headers */, + 55193E5A0B93F31D004C0C98 /* DDHidElement.h in Headers */, + 55193E5C0B93F31D004C0C98 /* DDHidUsage.h in Headers */, + 55193E5E0B93F31D004C0C98 /* DDHidQueue.h in Headers */, + 55193E600B93F31D004C0C98 /* DDHidEvent.h in Headers */, + 55193E620B93F31D004C0C98 /* DDHidUsageTables.h in Headers */, + 55193E640B93F31D004C0C98 /* NSDictionary+DDHidExtras.h in Headers */, + 55193E660B93F31D004C0C98 /* DDHidMouse.h in Headers */, + 55193E680B93F31D004C0C98 /* DDHidJoystick.h in Headers */, + 55193E6A0B93F31D004C0C98 /* DDHidAppleRemote.h in Headers */, + 55193E6C0B93F31D004C0C98 /* DDHidLib.h in Headers */, + 55193F110B93F36F004C0C98 /* NSXReturnThrowError.h in Headers */, + 55D5937B0BAE3B8800364849 /* DDHidKeyboard.h in Headers */, + 55FC9FDD0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBBC80B5B336600C8FD74 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 559CBBD10B5B337600C8FD74 /* DDHidDevice.h in Headers */, + 559CBBD30B5B337600C8FD74 /* DDHidElement.h in Headers */, + 559CBBD50B5B337600C8FD74 /* DDHidUsage.h in Headers */, + 559CBBD70B5B337600C8FD74 /* DDHidQueue.h in Headers */, + 559CBBD90B5B337600C8FD74 /* DDHidEvent.h in Headers */, + 559CBBDB0B5B337600C8FD74 /* DDHidUsageTables.h in Headers */, + 559CBBDD0B5B337600C8FD74 /* NSDictionary+DDHidExtras.h in Headers */, + 559CBC2C0B5B34C300C8FD74 /* DDHidMouse.h in Headers */, + 55FD66D50B5DDC3F00325FEF /* DDHidJoystick.h in Headers */, + 55FD67CC0B5DE18600325FEF /* DDHidLib.h in Headers */, + 55BE6DCD0B8033010085514D /* NSXReturnThrowError.h in Headers */, + 55170D360B8EC2CE00C82155 /* DDHidAppleRemote.h in Headers */, + 55CA60E50BA0F2530012CF7B /* DDHidKeyboard.h in Headers */, + 55FC9FDB0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.h in Headers */, + B366F1B016F5DE9800C0BA49 /* DDHidAppleMikey.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 55193E4F0B93F2EE004C0C98 /* DDHidLib */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55193E530B93F2EF004C0C98 /* Build configuration list for PBXNativeTarget "DDHidLib" */; + buildPhases = ( + 55193E4B0B93F2EE004C0C98 /* Headers */, + 55193E4C0B93F2EE004C0C98 /* Resources */, + 55193E4D0B93F2EE004C0C98 /* Sources */, + 55193E4E0B93F2EE004C0C98 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DDHidLib; + productName = DDHidLib; + productReference = 55193E500B93F2EE004C0C98 /* DDHidLib.framework */; + productType = "com.apple.product-type.framework"; + }; + 559CBAE00B5B313000C8FD74 /* HIDDeviceTest */ = { + isa = PBXNativeTarget; + buildConfigurationList = 559CBAE40B5B313000C8FD74 /* Build configuration list for PBXNativeTarget "HIDDeviceTest" */; + buildPhases = ( + 559CBADD0B5B313000C8FD74 /* Resources */, + 559CBADE0B5B313000C8FD74 /* Sources */, + 559CBADF0B5B313000C8FD74 /* Frameworks */, + 55D593620BAE3B4B00364849 /* Copy Files to Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 55D593610BAE3B3300364849 /* PBXTargetDependency */, + ); + name = HIDDeviceTest; + productName = HIDDeviceTest; + productReference = 559CBAE10B5B313000C8FD74 /* HIDDeviceTest.app */; + productType = "com.apple.product-type.application"; + }; + 559CBBCB0B5B336600C8FD74 /* ddhid */ = { + isa = PBXNativeTarget; + buildConfigurationList = 559CBBE60B5B338B00C8FD74 /* Build configuration list for PBXNativeTarget "ddhid" */; + buildPhases = ( + 559CBBC80B5B336600C8FD74 /* Headers */, + 559CBBC90B5B336600C8FD74 /* Sources */, + 559CBBCA0B5B336600C8FD74 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ddhid; + productName = ddhid; + productReference = 559CBBCC0B5B336600C8FD74 /* libddhid.a */; + productType = "com.apple.product-type.library.static"; + }; + 8D1107260486CEB800E47090 /* HIDBrowser */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HIDBrowser" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + 55D593350BAE3AC800364849 /* Copy Files to Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 55D593260BAE3AA800364849 /* PBXTargetDependency */, + ); + name = HIDBrowser; + productInstallPath = "$(HOME)/Applications"; + productName = HIDBrowser; + productReference = 8D1107320486CEB800E47090 /* HIDBrowser.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DDHidLib" */; + compatibilityVersion = "Xcode 2.4"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* HIDBrowser */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 551711110B8F41EB00C82155 /* All */, + 8D1107260486CEB800E47090 /* HIDBrowser */, + 559CBAE00B5B313000C8FD74 /* HIDDeviceTest */, + 559CBBCB0B5B336600C8FD74 /* ddhid */, + 55193E4F0B93F2EE004C0C98 /* DDHidLib */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 55193E4C0B93F2EE004C0C98 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55D593870BAE3BB700364849 /* DDHidStandardUsages.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBADD0B5B313000C8FD74 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 559CBAEB0B5B31AB00C8FD74 /* Info.plist in Resources */, + 55170E670B8ECF0000C82155 /* AppleRemote.tiff in Resources */, + 55D5927D0BAE306E00364849 /* InfoPlist.strings in Resources */, + 55D592940BAE30B600364849 /* MainMenu.nib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 55DCD9E00B55D503000648E5 /* EventWatcher.nib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 55193E4D0B93F2EE004C0C98 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55193E590B93F31D004C0C98 /* DDHidDevice.m in Sources */, + 55193E5B0B93F31D004C0C98 /* DDHidElement.m in Sources */, + 55193E5D0B93F31D004C0C98 /* DDHidUsage.m in Sources */, + 55193E5F0B93F31D004C0C98 /* DDHidQueue.m in Sources */, + 55193E610B93F31D004C0C98 /* DDHidEvent.m in Sources */, + 55193E630B93F31D004C0C98 /* DDHidUsageTables.m in Sources */, + 55193E650B93F31D004C0C98 /* NSDictionary+DDHidExtras.m in Sources */, + 55193E670B93F31D004C0C98 /* DDHidMouse.m in Sources */, + 55193E690B93F31D004C0C98 /* DDHidJoystick.m in Sources */, + 55193E6B0B93F31D004C0C98 /* DDHidAppleRemote.m in Sources */, + 55193F120B93F371004C0C98 /* NSXReturnThrowError.m in Sources */, + 55D5937C0BAE3B8800364849 /* DDHidKeyboard.m in Sources */, + 55FC9FDE0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m in Sources */, + B366F1B316F5E20800C0BA49 /* DDHidAppleMikey.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBADE0B5B313000C8FD74 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 559CBAEC0B5B31AB00C8FD74 /* main.m in Sources */, + 559CBCA90B5B3BCE00C8FD74 /* MousePaneController.m in Sources */, + 55A000520B5D7C06001B47E5 /* BoolFormatter.m in Sources */, + 55FD65CB0B5DD57200325FEF /* DeviceTestController.m in Sources */, + 55FD66FD0B5DDD2100325FEF /* JoystickPaneController.m in Sources */, + 55FD67750B5DDF8200325FEF /* ButtonState.m in Sources */, + 55170E0D0B8ECCAC00C82155 /* AppleRemotePaneController.m in Sources */, + 55170E650B8ECEF600C82155 /* RemoteFeedbackView.m in Sources */, + 55CA668B0BA38AEF0012CF7B /* KeyboardPaneController.m in Sources */, + B366F1B616F5E64B00C0BA49 /* AppleMikeyPaneController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 559CBBC90B5B336600C8FD74 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 559CBBD20B5B337600C8FD74 /* DDHidDevice.m in Sources */, + 559CBBD40B5B337600C8FD74 /* DDHidElement.m in Sources */, + 559CBBD60B5B337600C8FD74 /* DDHidUsage.m in Sources */, + 559CBBD80B5B337600C8FD74 /* DDHidQueue.m in Sources */, + 559CBBDA0B5B337600C8FD74 /* DDHidEvent.m in Sources */, + 559CBBDC0B5B337600C8FD74 /* DDHidUsageTables.m in Sources */, + 559CBC260B5B349100C8FD74 /* NSDictionary+DDHidExtras.m in Sources */, + 559CBC2D0B5B34C300C8FD74 /* DDHidMouse.m in Sources */, + 55FD66D60B5DDC3F00325FEF /* DDHidJoystick.m in Sources */, + 55BE6DCE0B8033010085514D /* NSXReturnThrowError.m in Sources */, + 55170D370B8EC2CE00C82155 /* DDHidAppleRemote.m in Sources */, + 55CA60E60BA0F2530012CF7B /* DDHidKeyboard.m in Sources */, + 55FC9FDC0BB76D8D0095FC7B /* DDHidKeyboardBarcodeScanner.m in Sources */, + B366F1B116F5DE9800C0BA49 /* DDHidAppleMikey.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 55917B640B53408C005308AC /* HidBrowserController.m in Sources */, + 55917E1C0B53E454005308AC /* HexFormatter.m in Sources */, + 55DCD9C60B55D35D000648E5 /* WatcherWindowController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 551711130B8F41F500C82155 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D1107260486CEB800E47090 /* HIDBrowser */; + targetProxy = 551711120B8F41F500C82155 /* PBXContainerItemProxy */; + }; + 551711150B8F41F500C82155 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 559CBAE00B5B313000C8FD74 /* HIDDeviceTest */; + targetProxy = 551711140B8F41F500C82155 /* PBXContainerItemProxy */; + }; + 55D593260BAE3AA800364849 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55193E4F0B93F2EE004C0C98 /* DDHidLib */; + targetProxy = 55D593250BAE3AA800364849 /* PBXContainerItemProxy */; + }; + 55D5935D0BAE3B1E00364849 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55193E4F0B93F2EE004C0C98 /* DDHidLib */; + targetProxy = 55D5935C0BAE3B1E00364849 /* PBXContainerItemProxy */; + }; + 55D593610BAE3B3300364849 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55193E4F0B93F2EE004C0C98 /* DDHidLib */; + targetProxy = 55D593600BAE3B3300364849 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { + isa = PBXVariantGroup; + children = ( + 29B97319FDCFA39411CA2CEA /* English */, + ); + name = MainMenu.nib; + sourceTree = ""; + }; + 55D5927B0BAE306E00364849 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55D5927C0BAE306E00364849 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55D592920BAE30B600364849 /* MainMenu.nib */ = { + isa = PBXVariantGroup; + children = ( + 55D592930BAE30B600364849 /* English */, + ); + name = MainMenu.nib; + sourceTree = ""; + }; + 55DCD9DE0B55D503000648E5 /* EventWatcher.nib */ = { + isa = PBXVariantGroup; + children = ( + 55DCD9DF0B55D503000648E5 /* English */, + ); + name = EventWatcher.nib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 551711290B8F420E00C82155 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = All; + }; + name = Debug; + }; + 5517112A0B8F420E00C82155 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + PRODUCT_NAME = All; + ZERO_LINK = NO; + }; + name = Release; + }; + 55193E540B93F2EF004C0C98 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "DDHidLib-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DDHidLib; + ZERO_LINK = NO; + }; + name = Debug; + }; + 55193E550B93F2EF004C0C98 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "DDHidLib-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DDHidLib; + ZERO_LINK = NO; + }; + name = Release; + }; + 559CBAE50B5B313000C8FD74 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = device_test/Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-ObjC", + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = HIDDeviceTest; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Debug; + }; + 559CBAE60B5B313000C8FD74 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = device_test/Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-ObjC", + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = HIDDeviceTest; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 559CBBE70B5B338B00C8FD74 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = ddhid; + ZERO_LINK = NO; + }; + name = Debug; + }; + 559CBBE80B5B338B00C8FD74 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = ddhid; + ZERO_LINK = NO; + }; + name = Release; + }; + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = browser/Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = HIDBrowser; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = browser/Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = HIDBrowser; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.4; + PREBINDING = NO; + SDKROOT = macosx; + VALID_ARCHS = i386; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55D592200BAE2E4500364849 /* versions.xcconfig */; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.4; + PREBINDING = NO; + SDKROOT = macosx; + VALID_ARCHS = i386; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 551711280B8F420E00C82155 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 551711290B8F420E00C82155 /* Debug */, + 5517112A0B8F420E00C82155 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55193E530B93F2EF004C0C98 /* Build configuration list for PBXNativeTarget "DDHidLib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55193E540B93F2EF004C0C98 /* Debug */, + 55193E550B93F2EF004C0C98 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 559CBAE40B5B313000C8FD74 /* Build configuration list for PBXNativeTarget "HIDDeviceTest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 559CBAE50B5B313000C8FD74 /* Debug */, + 559CBAE60B5B313000C8FD74 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 559CBBE60B5B338B00C8FD74 /* Build configuration list for PBXNativeTarget "ddhid" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 559CBBE70B5B338B00C8FD74 /* Debug */, + 559CBBE80B5B338B00C8FD74 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "HIDBrowser" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DDHidLib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/LICENSE.html b/LICENSE.html new file mode 100644 index 0000000..5831837 --- /dev/null +++ b/LICENSE.html @@ -0,0 +1,181 @@ + + + + + + + + + + The MIT License (MIT) | Open Source Initiative + + + + + + + + + + + + +
+
+ + + + + +
+

You are here

+

The MIT License (MIT)

+
+
+
+ + +
+
+ + + + +
+ [OSI Approved License] +

The MIT License (MIT)

+ + + +

Copyright (c) <year> <copyright holders>

+ +

Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

+ +

The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.

+ + +
+ +
+ + +
+ +
+
+
+
+
+ +
+ + +
+
+ + diff --git a/README.md b/README.md index 4ca735b..5c44eb5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ DDHidLib -======== +===== +###by Dave Dribin -An Objective-C wrapper around IOHIDLib by Dave Dribin \ No newline at end of file +An Objective-C wrapper around IOHIDLib. + +http://www.dribin.org/dave/software/ + +###Modifications in the repo: +added experimental support for apple mics with built-in keys. \ No newline at end of file diff --git a/browser/English.lproj/EventWatcher.nib/classes.nib b/browser/English.lproj/EventWatcher.nib/classes.nib new file mode 100644 index 0000000..8f04df5 --- /dev/null +++ b/browser/English.lproj/EventWatcher.nib/classes.nib @@ -0,0 +1,13 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {clearHistory = id; }; + CLASS = WatcherWindowController; + LANGUAGE = ObjC; + OUTLETS = {mEventHistoryController = NSArrayController; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/browser/English.lproj/EventWatcher.nib/info.nib b/browser/English.lproj/EventWatcher.nib/info.nib new file mode 100644 index 0000000..1c52771 --- /dev/null +++ b/browser/English.lproj/EventWatcher.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 69 14 356 240 0 0 1440 878 + IBFramework Version + 446.1 + IBOpenObjects + + 5 + + IBSystem Version + 8N1037 + + diff --git a/browser/English.lproj/EventWatcher.nib/keyedobjects.nib b/browser/English.lproj/EventWatcher.nib/keyedobjects.nib new file mode 100644 index 0000000..61ebe6c Binary files /dev/null and b/browser/English.lproj/EventWatcher.nib/keyedobjects.nib differ diff --git a/browser/English.lproj/InfoPlist.strings b/browser/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..30cfd96 Binary files /dev/null and b/browser/English.lproj/InfoPlist.strings differ diff --git a/browser/English.lproj/MainMenu.nib/classes.nib b/browser/English.lproj/MainMenu.nib/classes.nib new file mode 100644 index 0000000..910a1c9 --- /dev/null +++ b/browser/English.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,19 @@ +{ + IBClasses = ( + {CLASS = DDHidElement; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = HexFormatter; LANGUAGE = ObjC; SUPERCLASS = NSFormatter; }, + { + ACTIONS = {exportPlist = id; watchSelected = id; }; + CLASS = HidBrowserController; + LANGUAGE = ObjC; + OUTLETS = { + mDevicesController = NSArrayController; + mElementsController = NSTreeController; + mWindow = NSWindow; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/browser/English.lproj/MainMenu.nib/info.nib b/browser/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 0000000..d20a5cf --- /dev/null +++ b/browser/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,22 @@ + + + + + IBDocumentLocation + 110 86 356 240 0 0 1440 878 + IBEditorPositions + + 29 + 95 721 310 44 0 0 1440 878 + + IBFramework Version + 446.1 + IBOpenObjects + + 21 + 29 + + IBSystem Version + 8N1037 + + diff --git a/browser/English.lproj/MainMenu.nib/keyedobjects.nib b/browser/English.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000..904f45d Binary files /dev/null and b/browser/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/browser/HIDBrowser_Prefix.pch b/browser/HIDBrowser_Prefix.pch new file mode 100644 index 0000000..5d5ed48 --- /dev/null +++ b/browser/HIDBrowser_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'HIDBrowser' target in the 'HIDBrowser' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/browser/HexFormatter.h b/browser/HexFormatter.h new file mode 100644 index 0000000..e3b28c2 --- /dev/null +++ b/browser/HexFormatter.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface HexFormatter : NSFormatter { + +} + ++ (NSString*)format:(long)number; + +@end diff --git a/browser/HexFormatter.m b/browser/HexFormatter.m new file mode 100644 index 0000000..5ac3f6f --- /dev/null +++ b/browser/HexFormatter.m @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "HexFormatter.h" + + +@implementation HexFormatter + ++ (NSString*)format:(long)number; +{ + return [NSString stringWithFormat: @"0x%02X", number]; +} + + +- (NSString *)stringForObjectValue:(id)anObject { + return [HexFormatter format:[anObject longValue]]; +} + +- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error { + return NO; +} + +- (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes { + return [[[NSAttributedString alloc] initWithString:[self stringForObjectValue:anObject]] autorelease]; +} + + +@end diff --git a/browser/HidBrowserController.h b/browser/HidBrowserController.h new file mode 100644 index 0000000..3e7e116 --- /dev/null +++ b/browser/HidBrowserController.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface HidBrowserController : NSObject +{ + IBOutlet NSWindow * mWindow; + IBOutlet NSArrayController * mDevicesController; + IBOutlet NSTreeController * mElementsController; + NSArray * mDevices; +} + +- (NSArray *) devices; + +- (IBAction) watchSelected: (id) sender; + +- (IBAction) exportPlist: (id) sender; + +@end diff --git a/browser/HidBrowserController.m b/browser/HidBrowserController.m new file mode 100644 index 0000000..4b12267 --- /dev/null +++ b/browser/HidBrowserController.m @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "HidBrowserController.h" +#import "DDHidUsageTables.h" +#import "DDHidDevice.h" +#import "DDHidElement.h" +#import "WatcherWindowController.h" + +@implementation HidBrowserController + +static BOOL sSleepAtExit = NO; + +static void exit_sleeper() +{ + while (sSleepAtExit) sleep(60); +} + +- (void) awakeFromNib +{ + sSleepAtExit = [[NSUserDefaults standardUserDefaults] boolForKey: @"SleepAtExit"]; + atexit(exit_sleeper); + + [self willChangeValueForKey: @"devices"]; + mDevices = [[DDHidDevice allDevices] retain]; + [self didChangeValueForKey: @"devices"]; + + [mWindow center]; + [mWindow makeKeyAndOrderFront: self]; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mDevices release]; + + mDevices = nil; + [super dealloc]; +} + +//=========================================================== +// - devices +//=========================================================== +- (NSArray *) devices +{ + return mDevices; +} + +- (DDHidDevice *) selectedDevice; +{ + NSArray * selectedDevices = [mDevicesController selectedObjects]; + if ([selectedDevices count] > 0) + return [selectedDevices objectAtIndex: 0]; + else + return nil; +} + +- (IBAction) watchSelected: (id) sender; +{ + NSArray * selectedElements = [mElementsController selectedObjects]; + if ([selectedElements count] == 0) + return; + + WatcherWindowController * controller = + [[WatcherWindowController alloc] init]; + [controller setDevice: [self selectedDevice]]; + [controller setElements: selectedElements]; + [controller showWindow: self]; +} + +- (IBAction) exportPlist: (id) sender; +{ + DDHidDevice * selectedDevice = [self selectedDevice]; + if (selectedDevice == nil) + return; + + NSSavePanel * panel = [NSSavePanel savePanel]; + + /* set up new attributes */ + [panel setRequiredFileType: @"plist"]; + [panel setAllowsOtherFileTypes: NO]; + [panel setCanSelectHiddenExtension: YES]; + + /* display the NSSavePanel */ + [panel beginSheetForDirectory: NSHomeDirectory() + file: @"" + modalForWindow: [NSApp mainWindow] + modalDelegate: self + didEndSelector: @selector(exportPlistPanelDidEnd:returnCode:contextInfo:) + contextInfo: selectedDevice]; +} + +- (void) exportPlistPanelDidEnd: (NSSavePanel *) panel + returnCode: (int) returnCode + contextInfo: (void *) contextInfo; +{ + DDHidDevice * selectedDevice = contextInfo; + + /* if successful, save file under designated name */ + if (returnCode != NSOKButton) + return; + + NSDictionary * deviceProperties = [selectedDevice properties]; + if (![deviceProperties writeToFile: [panel filename] atomically: YES]) + NSBeep(); +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication +{ + return YES; +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification +{ + [self willChangeValueForKey: @"devices"]; + [mDevices release]; + mDevices = nil; + [self didChangeValueForKey: @"devices"]; +} + +@end diff --git a/browser/Info.plist b/browser/Info.plist new file mode 100644 index 0000000..feff01c --- /dev/null +++ b/browser/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + org.dribin.dave.ddhidlib.HIDBrowser + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + CFBundleShortVersionString + ${CURRENT_MARKETING_VERSION} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/browser/WatcherWindowController.h b/browser/WatcherWindowController.h new file mode 100644 index 0000000..5cc447a --- /dev/null +++ b/browser/WatcherWindowController.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" +#import "DDHidElement.h" + +@class DDHidQueue; + +@interface WatcherWindowController : NSWindowController +{ + IBOutlet NSArrayController * mEventHistoryController; + DDHidDevice * mDevice; + NSArray * mElements; + DDHidQueue * mQueue; + NSMutableArray * mEventHistory; + int mNextIndex; +} + +- (DDHidDevice *) device; +- (void) setDevice: (DDHidDevice *) newDevice; + +- (NSArray *) elements; +- (void) setElements: (NSArray *) newElements; + +- (NSMutableArray *) eventHistory; +- (void) setEventHistory: (NSMutableArray *) anEventHistory; +- (void) addToEventHistory: (id)mEventHistoryObject; +- (void) removeFromEventHistory: (id)mEventHistoryObject; + +- (BOOL) isWatching; +- (void) setWatching: (BOOL) watching; + +- (IBAction) clearHistory: (id) sender; + +@end diff --git a/browser/WatcherWindowController.m b/browser/WatcherWindowController.m new file mode 100644 index 0000000..a13c986 --- /dev/null +++ b/browser/WatcherWindowController.m @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "WatcherWindowController.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#import "DDHidUsage.h" + +@interface WatcherEvent : NSObject +{ + NSString * mUsageDescription; + DDHidEvent * mEvent; + int mIndex; +} + +- (id) initWithUsageDescription: (NSString *) anUsageDecription + event: (DDHidEvent *) anEvent + index: (int) index; + +- (NSString *) usageDescription; +- (DDHidEvent *) event; +- (int) index; + +@end + +@implementation WatcherEvent : NSObject + +- (id) initWithUsageDescription: (NSString *) anUsageDescription + event: (DDHidEvent *) anEvent + index: (int) index +{ + if (self = [super init]) + { + mUsageDescription = [anUsageDescription retain]; + mEvent = [anEvent retain]; + mIndex = index; + } + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mUsageDescription release]; + [mEvent release]; + + mUsageDescription = nil; + mEvent = nil; + [super dealloc]; +} + +//=========================================================== +// - usageDescription +//=========================================================== +- (NSString *) usageDescription +{ + return mUsageDescription; +} + +//=========================================================== +// - event +//=========================================================== +- (DDHidEvent *) event +{ + return mEvent; +} + +//=========================================================== +// - index +//=========================================================== +- (int) index +{ + return mIndex; +} + +@end + +@implementation WatcherWindowController + +- (id) init +{ + self = [super initWithWindowNibName: @"EventWatcher" owner: self]; + if (self == nil) + return nil; + + mEventHistory = [[NSMutableArray alloc] init]; + mNextIndex = 1; + + return self; +} + + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mQueue release]; + [mDevice release]; + [mElements release]; + [mEventHistory release]; + + mQueue = nil; + mDevice = nil; + mElements = nil; + mEventHistory = nil; + [super dealloc]; +} + +- (void)windowWillClose:(NSNotification *)notification +{ + [mQueue release]; + mQueue = nil; + [mDevice close]; + [self autorelease]; +} + +- (IBAction)showWindow:(id)sender +{ + [super showWindow: sender]; +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + WatcherEvent * watcherEvent; + watcherEvent = + [[WatcherEvent alloc] initWithUsageDescription: @"-----------------------------" + event: nil + index: mNextIndex++]; + [watcherEvent autorelease]; + [mEventHistoryController addObject: watcherEvent]; + + NSMutableArray * newEvents = [NSMutableArray array]; + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + DDHidElement * element = [mDevice elementForCookie: [event elementCookie]]; + watcherEvent = + [[WatcherEvent alloc] initWithUsageDescription: [[element usage] usageNameWithIds] + event: event + index: mNextIndex++]; + [watcherEvent autorelease]; + [newEvents addObject: watcherEvent]; + } + + [mEventHistoryController addObjects: newEvents]; +} + +- (void) windowDidLoad; +{ + [mDevice open]; + mQueue = [[mDevice createQueueWithSize: 30] retain]; + [mQueue setDelegate: self]; + [mQueue addElements: mElements]; + [self willChangeValueForKey: @"watching"]; + [mQueue startOnCurrentRunLoop]; + [self didChangeValueForKey: @"watching"]; +} + +//=========================================================== +// device +//=========================================================== +- (DDHidDevice *) device +{ + return [[mDevice retain] autorelease]; +} + +- (void) setDevice: (DDHidDevice *) newDevice +{ + if (mDevice != newDevice) + { + [mDevice release]; + mDevice = [newDevice retain]; + } +} + +//=========================================================== +// elements +//=========================================================== +- (NSArray *) elements +{ + return [[mElements retain] autorelease]; +} + +- (void) setElements: (NSArray *) newElements +{ + if (mElements != newElements) + { + [mElements release]; + mElements = [newElements retain]; + } +} + +//=========================================================== +// eventHistory +//=========================================================== +- (NSMutableArray *) eventHistory +{ + return mEventHistory; +} + +- (void) setEventHistory: (NSMutableArray *) anEventHistory +{ + if (mEventHistory != anEventHistory) + { + [mEventHistory release]; + mEventHistory = [anEventHistory retain]; + } +} +- (void) addToEventHistory: (id)mEventHistoryObject +{ + [[self eventHistory] addObject: mEventHistoryObject]; +} +- (void) removeFromEventHistory: (id)mEventHistoryObject +{ + [[self eventHistory] removeObject: mEventHistoryObject]; +} + +- (BOOL) isWatching; +{ + if (mQueue == nil) + return NO; + return [mQueue isStarted]; +} + +- (void) setWatching: (BOOL) watching; +{ + BOOL isStarted = [mQueue isStarted]; + if (isStarted == watching) + return; + + if (watching) + [mQueue startOnCurrentRunLoop]; + else + [mQueue stop]; +} + +- (IBAction) clearHistory: (id) sender; +{ + [self willChangeValueForKey: @"eventHistory"]; + [mEventHistory removeAllObjects]; + mNextIndex = 1; + [self didChangeValueForKey: @"eventHistory"]; +} + +@end diff --git a/browser/main.m b/browser/main.m new file mode 100644 index 0000000..f05b99f --- /dev/null +++ b/browser/main.m @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/changelog.yml b/changelog.yml new file mode 100644 index 0000000..743fff5 --- /dev/null +++ b/changelog.yml @@ -0,0 +1,24 @@ +- version: "1.1" + date: 2008-04-22 + changes: + - Added logical joysticks for devices with multiple top-level elements. + Should allow devices like PS/2 to USB converters to work better. + - Change joystick normalized values to +/- 65536. + - Update Apple Remote codes for Leopard. + - Improved keyboard barcode scanning for certain devices. + - Added internal debugging code to help detect memory leaks. + +- version: "1.0.1" + date: 2007-04-03 + changes: + - "Replace deprecated stringWithCString: with stringWithUTF8String:." + - Make DDHidKeyboard.h public so it gets copied to the framework. + - Plugged some memory leaks. + - Added a class for barcode scanners, thanks to Lucas Newman of Delicious + Monster. + - Add support for point of view hat switches on joysticks. + +- version: "1.0" + date: 2007-03-19 + changes: + - Initial release. diff --git a/device_test/AppleMikeyPaneController.h b/device_test/AppleMikeyPaneController.h new file mode 100644 index 0000000..28f6fc1 --- /dev/null +++ b/device_test/AppleMikeyPaneController.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@class DDHidAppleMikey; + +@interface AppleMikeyPaneController : NSObject +{ + IBOutlet NSArrayController * mMikeysController; + IBOutlet NSArrayController * mMikeysEventsController; + + NSArray * mMikeys; + unsigned mMikeyIndex; + NSMutableArray * mEvents; + + // Don't retain these + DDHidAppleMikey * mCurrentMikey; +} + +- (NSArray *) mMikeys; +- (void) setMikeys: (NSArray *) theMikeys; + +- (unsigned) mikeyIndex; +- (void) setMikeyIndex: (unsigned) theMikeyIndex; + +- (NSMutableArray *) events; +- (void) setEvents: (NSMutableArray *) theEvents; +- (void) addEvent: (id)theEvent; +- (void) removeEvent: (id)theEvent; + +@end + +@interface AppleMikeyPaneController (DDHidAppleMikeyDelegate) + +- (void) ddhidAppleMikey: (DDHidAppleMikey *) mikey + press: (unsigned) usageId + upOrDown:(BOOL)upOrDown; + +@end diff --git a/device_test/AppleMikeyPaneController.m b/device_test/AppleMikeyPaneController.m new file mode 100644 index 0000000..0760688 --- /dev/null +++ b/device_test/AppleMikeyPaneController.m @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "AppleMikeyPaneController.h" +#import "DDHidLib.h" +#include + +@implementation AppleMikeyPaneController + +- (id) init; +{ + self = [super init]; + if (self == nil) + return nil; + + mEvents = [[NSMutableArray alloc] init]; + + return self; +} + +- (void) awakeFromNib; +{ + NSArray * mikeys = [DDHidAppleMikey allMikeys]; + + [mikeys makeObjectsPerformSelector: @selector(setDelegate:) + withObject: self]; + [self setMikeys: mikeys]; + + if ([mikeys count] > 0) + [self setMikeyIndex: 0]; + else + [self setMikeyIndex: NSNotFound]; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mMikeys release]; + [mEvents release]; + + mMikeys = nil; + mEvents = nil; + [super dealloc]; +} + +//=========================================================== +// mikeys +//=========================================================== +- (NSArray *) mikeys +{ + return mMikeys; +} + +- (void) setMikeys: (NSArray *) theMikeys +{ + if (mMikeys != theMikeys) + { + [mMikeys release]; + mMikeys = [theMikeys retain]; + } +} +//=========================================================== +// mikeyIndex +//=========================================================== +- (unsigned) mikeyIndex +{ + return mMikeyIndex; +} + +- (void) setMikeyIndex: (unsigned) theMikeyIndex +{ + if (mCurrentMikey != nil) + { + [mCurrentMikey stopListening]; + mCurrentMikey = nil; + } + mMikeyIndex = theMikeyIndex; + [mMikeysController setSelectionIndex: mMikeyIndex]; + [self willChangeValueForKey: @"events"]; + [mEvents removeAllObjects]; + [self didChangeValueForKey: @"events"]; + if (mMikeyIndex != NSNotFound) + { + mCurrentMikey = [mMikeys objectAtIndex: mMikeyIndex]; + [mCurrentMikey startListening]; + } +} + +//=========================================================== +// events +//=========================================================== +- (NSMutableArray *) events +{ + return mEvents; +} + +- (void) setEvents: (NSMutableArray *) theEvents +{ + if (mEvents != theEvents) + { + [mEvents release]; + mEvents = [theEvents retain]; + } +} +- (void) addEvent: (id)theEvent +{ + [[self events] addObject: theEvent]; +} +- (void) removeEvent: (id)theEvent +{ + [[self events] removeObject: theEvent]; +} + +@end + +@implementation AppleMikeyPaneController (DDHidAppleMikeyDelegate) + +- (void) ddhidAppleMikey:(DDHidAppleMikey *)mikey press:(unsigned int)usageId upOrDown:(BOOL)upOrDown +{ + NSString *usage = nil; + if(usageId==kHIDUsage_GD_SystemMenuDown) { + usage = @"MenuDown"; + } + else if(usageId == kHIDUsage_GD_SystemMenuUp) { + usage = @"MenuUp"; + } + + if(!usage) + return; + + NSMutableDictionary * row = [mMikeysEventsController newObject]; + [row setObject: upOrDown ? @"Down" : @"Up" forKey: @"event"]; + [row setObject:usage forKey: @"description"]; + [mMikeysEventsController addObject: row]; +} + +@end diff --git a/device_test/AppleRemote.tiff b/device_test/AppleRemote.tiff new file mode 100644 index 0000000..7e002ca Binary files /dev/null and b/device_test/AppleRemote.tiff differ diff --git a/device_test/AppleRemotePaneController.h b/device_test/AppleRemotePaneController.h new file mode 100644 index 0000000..ca4a9e9 --- /dev/null +++ b/device_test/AppleRemotePaneController.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidLib.h" + +@class DDHidAppleRemote; +@class RemoteFeedbackView; + +@interface AppleRemotePaneController : NSObject +{ + IBOutlet NSButton * mStartStopButton; + IBOutlet RemoteFeedbackView * mFeedbackView; + IBOutlet NSTextField * mFeedbackText; + + DDHidAppleRemote * mRemote; + BOOL mOpenInExclusiveMode; +} + +- (DDHidAppleRemote *) remote; + +- (IBAction) toggleListening: (id) sender; + +- (BOOL) openInExclusiveMode; +- (void) setOpenInExclusiveMode: (BOOL) flag; + +- (void) ddhidAppleRemoteButton: (DDHidAppleRemoteEventIdentifier) buttonIdentifier + pressedDown: (BOOL) pressedDown; + +@end diff --git a/device_test/AppleRemotePaneController.m b/device_test/AppleRemotePaneController.m new file mode 100644 index 0000000..7cbaf52 --- /dev/null +++ b/device_test/AppleRemotePaneController.m @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "AppleRemotePaneController.h" +#import "RemoteFeedbackView.h" + +@implementation AppleRemotePaneController + +- (void) awakeFromNib; +{ + [self willChangeValueForKey: @"remote"]; + mRemote = [[DDHidAppleRemote firstRemote] retain]; + [self didChangeValueForKey: @"remote"]; + + [mRemote setDelegate: self]; + [self setOpenInExclusiveMode: YES]; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mRemote release]; + + mRemote = nil; + [super dealloc]; +} + +- (DDHidAppleRemote *) remote; +{ + return mRemote; +} + +- (IBAction) toggleListening: (id) sender; +{ + NSAssert(mRemote != nil, @"Remote is nil"); + + if ([mRemote isListening]) + { + [mRemote stopListening]; + [mStartStopButton setTitle: @"Start Listening"]; + } + else + { + [mRemote setListenInExclusiveMode: mOpenInExclusiveMode]; + [mRemote startListening]; + [mStartStopButton setTitle: @"Stop Listening"]; + } +} + +//=========================================================== +// openInExclusiveMode +//=========================================================== +- (BOOL) openInExclusiveMode +{ + return mOpenInExclusiveMode; +} + +- (void) setOpenInExclusiveMode: (BOOL) flag +{ + mOpenInExclusiveMode = flag; +} + +- (void) ddhidAppleRemoteButton: (DDHidAppleRemoteEventIdentifier) buttonIdentifier + pressedDown: (BOOL) pressedDown; +{ + NSString * buttonName= nil; + NSString * pressed = @""; + + switch(buttonIdentifier) + { + case kDDHidRemoteButtonVolume_Plus: + buttonName = @"Volume up"; + if (pressedDown) pressed = @"(down)"; else pressed = @"(up)"; + break; + case kDDHidRemoteButtonVolume_Minus: + buttonName = @"Volume down"; + if (pressedDown) pressed = @"(down)"; else pressed = @"(up)"; + break; + case kDDHidRemoteButtonMenu: + buttonName = @"Menu"; + break; + case kDDHidRemoteButtonPlay: + buttonName = @"Play"; + break; + case kDDHidRemoteButtonRight: + buttonName = @"Right"; + break; + case kDDHidRemoteButtonLeft: + buttonName = @"Left"; + break; + case kDDHidRemoteButtonRight_Hold: + buttonName = @"Right holding"; + if (pressedDown) pressed = @"(down)"; else pressed = @"(up)"; + break; + case kDDHidRemoteButtonLeft_Hold: + buttonName = @"Left holding"; + if (pressedDown) pressed = @"(down)"; else pressed = @"(up)"; + break; + case kDDHidRemoteButtonPlay_Sleep: + buttonName = @"Play (sleep mode)"; + break; + case kDDHidRemoteButtonMenu_Hold: + buttonName = @"Menu (long)"; + break; + case kDDHidRemoteControl_Switched: + buttonName = @"Remote Control Switched"; + break; + case kDDHidRemoteControl_Paired: + buttonName = @"Remote Control Paired"; + break; + default: + NSLog(@"Unmapped event for button %d", buttonIdentifier); + break; + } + [mFeedbackText setStringValue:[NSString stringWithFormat:@"%@ %@", + buttonName, pressed]]; + + [mFeedbackView ddhidAppleRemoteButton: buttonIdentifier + pressedDown: pressedDown]; +} + +@end diff --git a/device_test/BoolFormatter.h b/device_test/BoolFormatter.h new file mode 100644 index 0000000..79661cb --- /dev/null +++ b/device_test/BoolFormatter.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface BoolFormatter : NSFormatter +{ + id labels; +} + +- (id)initWithLables:(id)_l; + +@end diff --git a/device_test/BoolFormatter.m b/device_test/BoolFormatter.m new file mode 100644 index 0000000..7f302f9 --- /dev/null +++ b/device_test/BoolFormatter.m @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "BoolFormatter.h" + + +@implementation BoolFormatter + +- (id)initWithLables:(id)_l { + if ((self = [super init]) != nil) { + self->labels = [_l retain]; + } + return self; +} + +- (void)dealloc { + [self->labels release]; + [super dealloc]; +} + +- (BOOL) boolForObjectValue: (id) object +{ + BOOL result; + if ([object respondsToSelector: @selector(boolValue)]) + result = [object boolValue] ? YES : NO; + else + result = NO; + return result; +} + +- (NSString *)stringForObjectValue:(id)_obj +{ + NSString *str; + + if ([self boolForObjectValue: _obj]) + str = @"Yes"; + else + str = @"No"; + + return (self->labels != nil) + ? (NSString *)[self->labels valueForKey:str] : str; +} + +- (NSAttributedString *)attributedStringForObjectValue:(id)anObject + withDefaultAttributes:(NSDictionary *)defaultAttributes +{ + NSDictionary * yesAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor redColor], NSBackgroundColorAttributeName, + nil]; + NSDictionary * attributes = defaultAttributes; + if ([self boolForObjectValue: anObject]) + attributes = yesAttributes; + + NSAttributedString * string = + [[NSAttributedString alloc] initWithString: [self stringForObjectValue: anObject] + attributes: attributes]; + [string autorelease]; + return string; +} + +@end diff --git a/device_test/ButtonState.h b/device_test/ButtonState.h new file mode 100644 index 0000000..63bde74 --- /dev/null +++ b/device_test/ButtonState.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +@interface ButtonState : NSObject +{ + NSString * mName; + BOOL mPressed; +} + +- (NSString *) name; + +- (BOOL) pressed; +- (void) setPressed: (BOOL) flag; + +@end diff --git a/device_test/ButtonState.m b/device_test/ButtonState.m new file mode 100644 index 0000000..d093b52 --- /dev/null +++ b/device_test/ButtonState.m @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "ButtonState.h" + +@implementation ButtonState + +- (id) initWithName: (NSString *) name +{ + self = [super init]; + if (self == nil) + return nil; + + mName = [name retain]; + mPressed = NO; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mName release]; + + mName = nil; + [super dealloc]; +} + +//=========================================================== +// - name +//=========================================================== +- (NSString *) name +{ + return mName; +} + +//=========================================================== +// - pressed +//=========================================================== +- (BOOL) pressed +{ + return mPressed; +} + +//=========================================================== +// - setPressed: +//=========================================================== +- (void) setPressed: (BOOL) flag +{ + mPressed = flag; +} + +@end + diff --git a/device_test/DeviceTestController.h b/device_test/DeviceTestController.h new file mode 100644 index 0000000..bb03cf1 --- /dev/null +++ b/device_test/DeviceTestController.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +@class MousePaneController; + +@interface DeviceTestController : NSObject +{ + IBOutlet NSWindow * mWindow; + IBOutlet MousePaneController * mMousePaneController; +} + +@end diff --git a/device_test/DeviceTestController.m b/device_test/DeviceTestController.m new file mode 100644 index 0000000..58d0f91 --- /dev/null +++ b/device_test/DeviceTestController.m @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DeviceTestController.h" + +static BOOL sSleepAtExit = NO; + +static void exit_sleeper() +{ + while (sSleepAtExit) sleep(60); +} + +@implementation DeviceTestController + +- (void) awakeFromNib +{ + sSleepAtExit = [[NSUserDefaults standardUserDefaults] boolForKey: @"SleepAtExit"]; + atexit(exit_sleeper); + + [mWindow center]; + [mWindow makeKeyAndOrderFront: self]; +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication +{ + return YES; +} +@end diff --git a/device_test/English.lproj/InfoPlist.strings b/device_test/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..30cfd96 Binary files /dev/null and b/device_test/English.lproj/InfoPlist.strings differ diff --git a/device_test/English.lproj/MainMenu.nib/designable.nib b/device_test/English.lproj/MainMenu.nib/designable.nib new file mode 100644 index 0000000..fbb8f5a --- /dev/null +++ b/device_test/English.lproj/MainMenu.nib/designable.nib @@ -0,0 +1,5311 @@ + + + + 1070 + 11G63 + 3084 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 3084 + + + NSArrayController + NSBox + NSButton + NSButtonCell + NSCustomObject + NSCustomView + NSLevelIndicator + NSLevelIndicatorCell + NSMenu + NSMenuItem + NSPopUpButton + NSPopUpButtonCell + NSScrollView + NSScroller + NSTabView + NSTabViewItem + NSTableColumn + NSTableHeaderView + NSTableView + NSTextField + NSTextFieldCell + NSView + NSWindowTemplate + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + + NSApplication + + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{183, 341}, {529, 499}} + 1881669632 + HID Device Test + NSWindow + + View + + + {213, 107} + + + 256 + + + + 274 + {{13, 10}, {503, 483}} + + + + + + + 1 + + + + 256 + + + + 268 + {{17, 399}, {50, 17}} + + + YES + + 67239424 + 272629760 + Mouse: + + LucidaGrande + 13 + 1044 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 266 + {{69, 393}, {397, 26}} + + + YES + + -2076049856 + 2048 + + + 109199615 + 1 + + LucidaGrande + 13 + 16 + + + + + + 400 + 75 + + + Item1 + + 1048576 + 2147483647 + 1 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + + YES + + + OtherViews + + + + + + Item2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + + + + 268 + {{17, 372}, {93, 17}} + + + YES + + 67239424 + 272629760 + Manufacturer: + + + + + + + + + 266 + {{112, 372}, {354, 17}} + + + YES + + 67239424 + 272629760 + System Font Text + + + + + + + + + 268 + {{48, 338}, {62, 17}} + + + YES + + 67239424 + 272629760 + Mouse X: + + + + + + + + + 266 + {{12, 361}, {459, 5}} + + + {0, 0} + + 67239424 + 0 + Box + + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 268 + {{46, 312}, {62, 17}} + + + YES + + 67239424 + 272629760 + Mouse Y: + + + + + + + + + 268 + {{17, 286}, {91, 17}} + + + YES + + 67239424 + 272629760 + Mouse Wheel: + + + + + + + + + 266 + {{113, 338}, {350, 16}} + + + YES + + 130560 + 0 + + 5000 + 1 + + + + + 266 + {{113, 312}, {350, 16}} + + + YES + + 130560 + 0 + + 5000 + 1 + + + + + 266 + {{113, 286}, {350, 16}} + + + YES + + 130560 + 0 + + 5 + 1 + + + + + 272 + + + + 2304 + + + + 256 + {157, 240} + + + YES + + + 256 + {157, 17} + + + + + + + 256 + {{158, 0}, {16, 17}} + + + + + + 65 + 40 + 1000 + + 75628096 + 2048 + Button + + LucidaGrande + 11 + 3100 + + + 3 + MC4zMzMzMzI5OQA + + + 6 + System + headerTextColor + + + + + 337772096 + 2048 + + + + 6 + System + controlBackgroundColor + + + + + 3 + YES + YES + + + + 85.97607421875 + 48.97607421875 + 1000 + + 75628096 + 2048 + Pressed + + + + + + 337772032 + 0 + + LucidaGrande + 12 + 16 + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 6 + System + gridColor + + 3 + MC41AA + + + 17 + -700448768 + + + 5 + 15 + 0 + YES + 0 + 1 + + + {{1, 17}, {157, 240}} + + + + + 4 + + + + 256 + {{158, 17}, {15, 240}} + + + + _doScroller: + 0.89473682641983032 + + + + -2147483392 + {{-100, -100}, {131, 15}} + + + 1 + + _doScroller: + 0.99047619104385376 + + + + 2304 + + + + {{1, 0}, {157, 17}} + + + + + 4 + + + + {{113, 20}, {174, 258}} + + + 133138 + + + + + + QSAAAEEgAABBmAAAQZgAAA + + + {{10, 33}, {483, 437}} + + + Mice + + + + + + 2 + + + + 256 + + + + 268 + {{17, 399}, {57, 17}} + + YES + + 67239424 + 272629760 + Joystick: + + + + + + + + + 266 + {{76, 393}, {390, 26}} + + YES + + -2076049856 + 2048 + + + 109199615 + 1 + + + + + + 400 + 75 + + + Item1 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + + OtherViews + + + + + + Item2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + + + + 268 + {{17, 372}, {93, 17}} + + YES + + 67239424 + 272629760 + Manufacturer: + + + + + + + + + 266 + {{112, 372}, {354, 17}} + + YES + + 69336577 + 272629760 + System Font Text + + + + + + + + + 276 + + + + 2304 + + + + 256 + {177, 267} + + YES + + + 256 + {177, 17} + + + + + + 256 + {{178, 0}, {16, 17}} + + + + + 80 + 40 + 1000 + + 75628096 + 2048 + Button + + + 3 + MC4zMzMzMzI5OQA + + + + + 337772096 + 2048 + + + + + + 3 + YES + + + + 90.97607421875 + 48.97607421875 + 1000 + + 75628096 + 2048 + Pressed + + + + + + 337772032 + 0 + + + + + + 3 + YES + + + + 3 + 2 + + + 17 + -700448768 + + + 5 + 15 + 0 + YES + 0 + 1 + + + {{1, 17}, {177, 267}} + + + + + 4 + + + + 256 + {{178, 17}, {15, 267}} + + + _doScroller: + 0.95789474248886108 + + + + 256 + {{-100, -100}, {177, 15}} + + 1 + + _doScroller: + 0.99047619104385376 + + + + 2304 + + + + {{1, 0}, {177, 17}} + + + + + 4 + + + + {{74, 20}, {194, 285}} + + + 133138 + + + + + QSAAAEEgAABBmAAAQZgAAA + + + + 266 + {{12, 361}, {459, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 266 + {{74, 337}, {389, 16}} + + YES + + 130560 + 0 + + -32768 + 32768 + 1 + + + + + 266 + {{74, 313}, {389, 16}} + + YES + + 130560 + 0 + + -32768 + 32768 + 1 + + + + + 268 + {{17, 337}, {52, 17}} + + YES + + 67239424 + 272629760 + X-Axis: + + + + + + + + + 268 + {{17, 313}, {52, 17}} + + YES + + 67239424 + 272629760 + Y-Axis: + + + + + + + + {{10, 33}, {483, 437}} + + Joysticks + + + + + + + 256 + + + + 266 + {{87, 393}, {379, 26}} + + + YES + + -2076049856 + 2048 + + + 109199615 + 1 + + + + + + 400 + 75 + + + Item1 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + + OtherViews + + + + + + Item2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + + + + 264 + {{17, 399}, {68, 17}} + + + YES + + 67239424 + 272629760 + Keyboard: + + + + + + + + + 266 + {{112, 372}, {354, 17}} + + + YES + + 67239424 + 272629760 + System Font Text + + + + + + + + + 264 + {{17, 372}, {93, 17}} + + + YES + + 67239424 + 272629760 + Manufacturer: + + + + + + + + + 256 + {{12, 361}, {459, 5}} + + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 256 + + + + 2304 + + + + 256 + {426, 333} + + + YES + + + 256 + {{427, 0}, {16, 17}} + + + + 94 + 40 + 1000 + + 75628096 + 2048 + + + + 3 + MC4zMzMzMzI5OQA + + + + + 337772096 + 2048 + + + + + + 3 + YES + YES + + + + 326 + 40 + 1000 + + 75628096 + 2048 + + + + + + + 337772096 + 2048 + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 17 + 306184192 + + + 4 + 15 + 0 + YES + 0 + 1 + + + {{1, 1}, {426, 333}} + + + + + 4 + + + + 256 + {{427, 1}, {15, 333}} + + + + _doScroller: + 0.96315789222717285 + + + + -2147483392 + {{-100, -100}, {426, 15}} + + + 1 + + _doScroller: + 0.99047619104385376 + + + {{20, 20}, {443, 335}} + + + 133138 + + + + QSAAAEEgAABBmAAAQZgAAA + + + {{10, 33}, {483, 437}} + + + Keyboards + + + + + + + 256 + + + + 256 + {{188, 137}, {107, 280}} + + + RemoteFeedbackView + NSView + + + + 256 + {{176, 67}, {131, 32}} + + + YES + + 67239424 + 134217728 + Start Listening + + + -2038284033 + 1 + + + + + + 200 + 25 + + + + + 256 + {{165, 39}, {151, 18}} + + YES + + 67239424 + 131072 + Open in exclusive mode + + + 1211912703 + 2 + + NSSwitch + + + + 200 + 25 + + + + + 256 + {{165, 115}, {152, 14}} + + + YES + + 67239424 + 138543104 + - + + + + + + + + + 256 + {{194, 423}, {63, 14}} + + + YES + + 67239424 + 272629760 + Remote ID: + + + + + + + + + 256 + {{259, 423}, {32, 14}} + + + YES + + 67239424 + 272629760 + 9999 + + + + + + + + {{10, 33}, {483, 437}} + + + Remote + + + + + + + 256 + + + + 266 + {{87, 393}, {379, 26}} + + + + YES + + -2076049856 + 2048 + + + 109199615 + 1 + + + + + + 400 + 75 + + + Item1 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + + OtherViews + + + + + + Item2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + + + + 264 + {{17, 399}, {41, 17}} + + + + YES + + 67239424 + 272629760 + Mikey + + + + + + + + + 266 + {{112, 372}, {354, 17}} + + + + YES + + 67239424 + 272629760 + System Font Text + + + + + + + + + 264 + {{17, 372}, {93, 17}} + + + + YES + + 67239424 + 272629760 + Manufacturer: + + + + + + + + + 256 + {{12, 361}, {459, 5}} + + + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 256 + + + + 2304 + + + + 256 + {426, 333} + + + + YES + + + 256 + {{427, 0}, {16, 17}} + + + + 94 + 40 + 1000 + + 75628096 + 2048 + + + + 3 + MC4zMzMzMzI5OQA + + + + + 337772096 + 2048 + + + + + + 3 + YES + YES + + + + 326 + 40 + 1000 + + 75628096 + 2048 + + + + + + + 337772096 + 2048 + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 17 + 306184192 + + + 4 + 15 + 0 + YES + 0 + 1 + + + {{1, 1}, {426, 333}} + + + + + + 4 + + + + 256 + {{427, 1}, {15, 333}} + + + + + _doScroller: + 0.96315789222717285 + + + + -2147483392 + {{-100, -100}, {426, 15}} + + + + 1 + + _doScroller: + 0.99047619104385376 + + + {{20, 20}, {443, 335}} + + + + 133138 + + + + QSAAAEEgAABBmAAAQZgAAA + + + {{10, 33}, {483, 437}} + + + + + Mikeys + + + + + + + 0 + YES + YES + + + + + + {529, 499} + + + + + {{0, 0}, {1920, 1178}} + {213, 129} + {10000000000000, 10000000000000} + YES + + + MainMenu + + + + HIDDeviceTest + + 1048576 + 2147483647 + + + submenuAction: + + HIDDeviceTest + + + + About HIDDeviceTest + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + + Services + + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide HIDDeviceTest + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit HIDDeviceTest + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + + File + + + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + + Open Recent + + + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1048576 + 2147483647 + + + + + + Revert + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup… + P + 1048576 + 2147483647 + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + + Edit + + + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + + Find + + + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1048576 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling + + 1048576 + 2147483647 + + + submenuAction: + + Spelling + + + + Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling as You Type + + 1048576 + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + + Window + + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + + Help + + + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + DeviceTestController + + + + productName + manufacturer + + + YES + YES + YES + YES + YES + + + + name + pressed + + + YES + YES + YES + YES + YES + + + BoolFormatter + + + MousePaneController + + + JoystickPaneController + + + + productName + manufacturer + + + YES + YES + YES + YES + YES + + + + name + pressed + + + YES + YES + YES + YES + YES + + + AppleRemotePaneController + + + KeyboardPaneController + + + + productName + manufacturer + + YES + + YES + YES + YES + YES + YES + + + + event + description + + YES + + YES + YES + YES + YES + YES + + + AppleMikeyPaneController + + + + productName + manufacturer + + YES + + YES + YES + YES + YES + YES + + + + event + description + + YES + + YES + YES + YES + YES + YES + + + + 256 + {125, 1} + + + + + + + 256 + {125, 1} + + + + + + + 256 + {125, 1} + + + + + + + + + + terminate: + + + + 139 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + hideOtherApplications: + + + + 146 + + + + hide: + + + + 152 + + + + unhideAllApplications: + + + + 153 + + + + delegate + + + + 396 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + showHelp: + + + + 122 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + performFindPanelAction: + + + + 242 + + + + performFindPanelAction: + + + + 243 + + + + performFindPanelAction: + + + + 244 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + pasteAsPlainText: + + + + 247 + + + + content: arrangedObjects.productName + + + + + + content: arrangedObjects.productName + content + arrangedObjects.productName + + Foo + Bar + No Mice + + 2 + + + 342 + + + + selectedIndex: mouseIndex + + + + + + selectedIndex: mouseIndex + selectedIndex + mouseIndex + + 2 + + + 355 + + + + mMousePaneController + + + + 346 + + + + mWindow + + + + 397 + + + + contentArray: mice + + + + + + contentArray: mice + contentArray + mice + + NSConditionallySetsEditable + + + 2 + + + 354 + + + + value: selection.manufacturer + + + + + + value: selection.manufacturer + value + selection.manufacturer + 2 + + + 267 + + + + maxValue: maxValue + + + + + + maxValue: maxValue + maxValue + maxValue + 2 + + + 347 + + + + value: mouseX + + + + + + value: mouseX + value + mouseX + + 2 + + + 356 + + + + maxValue: maxValue + + + + + + maxValue: maxValue + maxValue + maxValue + 2 + + + 349 + + + + value: mouseY + + + + + + value: mouseY + value + mouseY + + 2 + + + 357 + + + + maxValue: maxValue + + + + + + maxValue: maxValue + maxValue + maxValue + 2 + + + 351 + + + + value: mouseWheel + + + + + + value: mouseWheel + value + mouseWheel + + 2 + + + 358 + + + + value: arrangedObjects.name + + + + + + value: arrangedObjects.name + value + arrangedObjects.name + 2 + + + 316 + + + + value: arrangedObjects.pressed + + + + + + value: arrangedObjects.pressed + value + arrangedObjects.pressed + 2 + + + 317 + + + + contentArray: mouseButtons + + + + + + contentArray: mouseButtons + contentArray + mouseButtons + + NSConditionallySetsEditable + + + 2 + + + 353 + + + + formatter + + + + 323 + + + + mMiceController + + + + 345 + + + + mJoysticksController + + + + 374 + + + + content: arrangedObjects.productName + + + + + + content: arrangedObjects.productName + content + arrangedObjects.productName + + NSNullPlaceholder + No Joysticks + + 2 + + + 394 + + + + selectedIndex: joystickIndex + + + + + + selectedIndex: joystickIndex + selectedIndex + joystickIndex + + 2 + + + 395 + + + + value: selection.manufacturer + + + + + + value: selection.manufacturer + value + selection.manufacturer + + NSNoSelectionPlaceholder + IA + + 2 + + + 393 + + + + contentArray: joysticks + + + + + + contentArray: joysticks + contentArray + joysticks + 2 + + + 369 + + + + value: arrangedObjects.pressed + + + + + + value: arrangedObjects.pressed + value + arrangedObjects.pressed + + NSConditionallySetsEditable + + + 2 + + + 401 + + + + value: arrangedObjects.name + + + + + + value: arrangedObjects.name + value + arrangedObjects.name + 2 + + + 385 + + + + contentArray: joystickButtons + + + + + + contentArray: joystickButtons + contentArray + joystickButtons + 2 + + + 383 + + + + formatter + + + + 388 + + + + value: xAxis + + + + + + value: xAxis + value + xAxis + 2 + + + 404 + + + + value: yAxis + + + + + + value: yAxis + value + yAxis + 2 + + + 405 + + + + toggleListening: + + + + 412 + + + + mStartStopButton + + + + 414 + + + + mFeedbackView + + + + 415 + + + + mFeedbackText + + + + 419 + + + + value: openInExclusiveMode + + + + + + value: openInExclusiveMode + value + openInExclusiveMode + 2 + + + 413 + + + + value: remote.remoteId + + + + + + value: remote.remoteId + value + remote.remoteId + 2 + + + 422 + + + + mKeyboardsController + + + + 454 + + + + mKeyboardEventsController + + + + 457 + + + + content: arrangedObjects.productName + + + + + + content: arrangedObjects.productName + content + arrangedObjects.productName + + NSNullPlaceholder + No Joysticks + + 2 + + + 440 + + + + selectedIndex: keyboardIndex + + + + + + selectedIndex: keyboardIndex + selectedIndex + keyboardIndex + + 2 + + + 441 + + + + value: selection.manufacturer + + + + + + value: selection.manufacturer + value + selection.manufacturer + 2 + + + 439 + + + + contentArray: keyboards + + + + + + contentArray: keyboards + contentArray + keyboards + 2 + + + 433 + + + + value: arrangedObjects.event + + + + + + value: arrangedObjects.event + value + arrangedObjects.event + 2 + + + 459 + + + + value: arrangedObjects.description + + + + + + value: arrangedObjects.description + value + arrangedObjects.description + 2 + + + 460 + + + + contentArray: events + + + + + + contentArray: events + contentArray + events + 2 + + + 456 + + + + mMikeysController + + + + 504 + + + + mMikeysEventsController + + + + 505 + + + + contentArray: mikeys + + + + + + contentArray: mikeys + contentArray + mikeys + 2 + + + 538 + + + + contentArray: events + + + + + + contentArray: events + contentArray + events + 2 + + + 540 + + + + value: selection.manufacturer + + + + + + value: selection.manufacturer + value + selection.manufacturer + 2 + + + 544 + + + + content: arrangedObjects.productName + + + + + + content: arrangedObjects.productName + content + arrangedObjects.productName + + NSNullPlaceholder + No Mikeys + + 2 + + + 541 + + + + selectedIndex: mikeyIndex + + + + + + selectedIndex: mikeyIndex + selectedIndex + mikeyIndex + + 2 + + + 542 + + + + value: arrangedObjects.description + + + + + + value: arrangedObjects.description + value + arrangedObjects.description + 2 + + + 536 + + + + value: arrangedObjects.event + + + + + + value: arrangedObjects.event + value + arrangedObjects.event + 2 + + + 535 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + 21 + + + + + + Window + + + 2 + + + + + + + + 248 + + + + + + + + + + + + 249 + + + + + + + + 250 + + + + + + + + + + + + + + + + + 360 + + + + + + + + 361 + + + + + + + + 366 + + + + + + + + 367 + + + + + + + + 376 + + + + + + + + + + + 377 + + + + + + + + + 378 + + + + + + + + 387 + + + + + 379 + + + + + + + + 380 + + + + + + 398 + + + + + + + + 399 + + + + + + + + 402 + + + + + + + + 403 + + + + + + + + 251 + + + + + + + + 252 + + + + + + + + + + + + + + + + + + + 255 + + + + + + + + 256 + + + + + + + + 265 + + + + + + + + 266 + + + + + + + + 270 + + + + + + + + 271 + + + + + + 273 + + + + + + + + 274 + + + + + + + + 281 + + + + + + + + 288 + + + + + + + + 294 + + + + + + + + 310 + + + + + + + + + + + 311 + + + + + + + + + 312 + + + + + + + + 313 + + + + + + + + 321 + + + + + 253 + + + + + + + + 254 + + + + + + + + + + + + + 424 + + + + + + + + 429 + + + + + + + + 430 + + + + + + + + 431 + + + + + + + + 448 + + + + + + 450 + + + + + + + + + + 451 + + + + + + + + + 452 + + + + + + + + 453 + + + + + + + + 407 + + + + + + + + 408 + + + + + + + + + + + + + 409 + + + + + 410 + + + + + + + + 411 + + + + + + + + 416 + + + + + + + + 420 + + + + + + + + 421 + + + + + + + + 29 + + + + + + + + + + MainMenu + + + 19 + + + + + + + + 24 + + + + + + + + + + + 5 + + + + + 23 + + + + + 92 + + + + + 239 + + + + + 56 + + + + + + + + 57 + + + + + + + + + + + + + + + + + + 58 + + + + + 129 + + + + + 131 + + + + + + + + 130 + + + + + 134 + + + + + 136 + + + + + 143 + + + + + 144 + + + + + 145 + + + + + 149 + + + + + 150 + + + + + 236 + + + + + 83 + + + + + + + + 81 + + + + + + + + + + + + + + + + + + 72 + + + + + 73 + + + + + 74 + + + + + 75 + + + + + 77 + + + + + 78 + + + + + 79 + + + + + 80 + + + + + 82 + + + + + 112 + + + + + 124 + + + + + + + + 125 + + + + + + + + 126 + + + + + 103 + + + + + + + + 106 + + + + + + + + 111 + + + + + 217 + + + + + + + + 205 + + + + + + + + + + + + + + + + + + + + 197 + + + + + 198 + + + + + 199 + + + + + 202 + + + + + 203 + + + + + 206 + + + + + 207 + + + + + 211 + + + + + + + + 212 + + + + + + + + + 195 + + + + + 196 + + + + + 214 + + + + + 215 + + + + + 216 + + + + + + + + 200 + + + + + + + + + + 201 + + + + + 204 + + + + + 219 + + + + + 218 + + + + + + + + 220 + + + + + + + + + + + + 208 + + + + + 209 + + + + + 210 + + + + + 213 + + + + + 221 + + + + + 246 + + + + + 261 + + + DeviceTestController + + + 262 + + + Mice + + + 314 + + + MouseButtons + + + 322 + + + BoolFormatter + + + 344 + + + MousePaneController + + + 359 + + + JoystickPaneController + + + 368 + + + Joysticks + + + 382 + + + JoystickButtons + + + 406 + + + AppleRemotePaneController + + + 423 + + + KeyboardPaneController + + + 432 + + + Keyboards + + + 455 + + + KeyboardEvents + + + 462 + + + + + 463 + + + + + + + + 464 + + + + + 465 + + + + + 466 + + + + + 467 + + + + + 468 + + + + + 469 + + + + + 470 + + + + + 471 + + + + + + + + 472 + + + + + 473 + + + + + 474 + + + + + 475 + + + + + 476 + + + + + 477 + + + + + 478 + + + + + 479 + + + + + 480 + + + + + + + + 481 + + + + + 482 + + + + + 483 + + + + + 484 + + + + + 485 + + + + + 486 + + + + + 487 + + + + + 488 + + + + + 489 + + + + + 490 + + + + + 491 + + + + + 492 + + + + + 362 + + + + + + + + + + 365 + + + + + 364 + + + + + 363 + + + + + 257 + + + + + + + + + + 260 + + + + + 259 + + + + + 258 + + + + + 425 + + + + + + + + + + 428 + + + + + 427 + + + + + 426 + + + + + 493 + + + + + 494 + + + + + 495 + + + + + 496 + + + + + 497 + + + + + 498 + + + + + 499 + + + + + 500 + + + + + -3 + + + Application + + + 381 + + + + + 272 + + + + + 449 + + + + + 501 + + + AppleMikeyPaneController + + + 502 + + + mikeys + + + 503 + + + mikeyEvents + + + 506 + + + + + + + + 507 + + + + + + + + + + + + + 513 + + + + + + + + 512 + + + + + + + + 509 + + + + + 508 + + + + + + + + + + 524 + + + + + + + + + 523 + + + + + 522 + + + + + 526 + + + + + + + + 525 + + + + + + + + 528 + + + + + 527 + + + + + 519 + + + + + 514 + + + + + + + + 515 + + + + + + + + + + 518 + + + + + 517 + + + + + 516 + + + + + 510 + + + + + + + + 521 + + + + + 511 + + + + + + + + 520 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 544 + + + + + AppleMikeyPaneController + NSObject + + NSArrayController + NSArrayController + + + + mMikeysController + NSArrayController + + + mMikeysEventsController + NSArrayController + + + + IBProjectSource + ./Classes/AppleMikeyPaneController.h + + + + AppleRemotePaneController + NSObject + + toggleListening: + id + + + toggleListening: + + toggleListening: + id + + + + NSTextField + RemoteFeedbackView + NSButton + + + + mFeedbackText + NSTextField + + + mFeedbackView + RemoteFeedbackView + + + mStartStopButton + NSButton + + + + IBProjectSource + ./Classes/AppleRemotePaneController.h + + + + BoolFormatter + NSFormatter + + IBProjectSource + ./Classes/BoolFormatter.h + + + + DeviceTestController + NSObject + + MousePaneController + NSWindow + + + + mMousePaneController + MousePaneController + + + mWindow + NSWindow + + + + IBProjectSource + ./Classes/DeviceTestController.h + + + + JoystickPaneController + NSObject + + mJoysticksController + NSArrayController + + + mJoysticksController + + mJoysticksController + NSArrayController + + + + IBProjectSource + ./Classes/JoystickPaneController.h + + + + KeyboardPaneController + NSObject + + NSArrayController + NSArrayController + + + + mKeyboardEventsController + NSArrayController + + + mKeyboardsController + NSArrayController + + + + IBProjectSource + ./Classes/KeyboardPaneController.h + + + + MousePaneController + NSObject + + mMiceController + NSArrayController + + + mMiceController + + mMiceController + NSArrayController + + + + IBProjectSource + ./Classes/MousePaneController.h + + + + RemoteFeedbackView + NSView + + IBProjectSource + ./Classes/RemoteFeedbackView.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + YES + 3 + + {11, 11} + {10, 3} + + + diff --git a/device_test/English.lproj/MainMenu.nib/keyedobjects.nib b/device_test/English.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000..8158386 Binary files /dev/null and b/device_test/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/device_test/Info.plist b/device_test/Info.plist new file mode 100644 index 0000000..db90f92 --- /dev/null +++ b/device_test/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.dribin.dave.ddhidlib.HIDDeviceTest + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + CFBundleShortVersionString + ${CURRENT_MARKETING_VERSION} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/device_test/JoystickPaneController.h b/device_test/JoystickPaneController.h new file mode 100644 index 0000000..38015d0 --- /dev/null +++ b/device_test/JoystickPaneController.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidLib.h" + + +@interface JoystickPaneController : NSObject +{ + IBOutlet NSArrayController * mJoysticksController; + + NSArray * mJoysticks; + NSMutableArray * mJoystickButtons; + int mXAxis; + int mYAxis; + unsigned mJoystickIndex; + + // Don't retain these + DDHidJoystick * mCurrentJoystick; +} + +- (NSArray *) joysticks; + +- (NSArray *) joystickButtons; + +- (unsigned) joystickIndex; +- (void) setJoystickIndex: (unsigned) theJoystickIndex; + +- (int) xAxis; +- (int) yAxis; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + xChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + yChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + otherAxis: (unsigned) otherAxis + valueChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonDown: (unsigned) buttonNumber; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonUp: (unsigned) buttonNumber; + +@end diff --git a/device_test/JoystickPaneController.m b/device_test/JoystickPaneController.m new file mode 100644 index 0000000..52dd949 --- /dev/null +++ b/device_test/JoystickPaneController.m @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "JoystickPaneController.h" +#import "DDHidJoystick.h" +#import "ButtonState.h" + +@interface JoystickPaneController (Private) + +- (void) setJoysticks: (NSArray *) theJoysticks; + +@end + +@implementation JoystickPaneController + +- (void) awakeFromNib; +{ + NSArray * joysticks = [DDHidJoystick allJoysticks]; + + mJoystickButtons = [[NSMutableArray alloc] init]; + [joysticks makeObjectsPerformSelector: @selector(setDelegate:) + withObject: self]; + [self setJoysticks: joysticks]; + if ([mJoysticks count] > 0) + [self setJoystickIndex: 0]; + else + [self setJoystickIndex: NSNotFound]; +} + +//=========================================================== +// joysticks +//=========================================================== +- (NSArray *) joysticks +{ + return mJoysticks; +} + +- (NSArray *) joystickButtons; +{ + return mJoystickButtons; +} + +//=========================================================== +// joystickIndex +//=========================================================== +- (unsigned) joystickIndex +{ + return mJoystickIndex; +} + +- (void) setJoystickIndex: (unsigned) theJoystickIndex +{ + if (mCurrentJoystick != nil) + { + [mCurrentJoystick stopListening]; + mCurrentJoystick = nil; + } + mJoystickIndex = theJoystickIndex; + [mJoysticksController setSelectionIndex: mJoystickIndex]; + if (mJoystickIndex != NSNotFound) + { + mCurrentJoystick = [mJoysticks objectAtIndex: mJoystickIndex]; + [mCurrentJoystick startListening]; + + [self willChangeValueForKey: @"joystickButtons"]; + [mJoystickButtons removeAllObjects]; + NSArray * buttons = [mCurrentJoystick buttonElements]; + NSEnumerator * e = [buttons objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + ButtonState * state = [[ButtonState alloc] initWithName: [[element usage] usageName]]; + [state autorelease]; + [mJoystickButtons addObject: state]; + } + [self didChangeValueForKey: @"joystickButtons"]; + } +} + +- (int) xAxis; +{ + return mXAxis; +} + +- (int) yAxis; +{ + return mYAxis; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + xChanged: (int) value; +{ + [self willChangeValueForKey: @"xAxis"]; + mXAxis = value; + [self didChangeValueForKey: @"xAxis"]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + yChanged: (int) value; +{ + [self willChangeValueForKey: @"yAxis"]; + mYAxis = value; + [self didChangeValueForKey: @"yAxis"]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + otherAxis: (unsigned) otherAxis + valueChanged: (int) value; +{ + // Somehow display values here + NSLog(@"Stick: %d, other axis: %d, changed: %d", stick, otherAxis, value); +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + povNumber: (unsigned) povNumber + valueChanged: (int) value; +{ + // Somehow display values here + NSLog(@"Stick: %d, POV number: %d, changed: %d", stick, povNumber, value); +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonDown: (unsigned) buttonNumber; +{ + ButtonState * state = [mJoystickButtons objectAtIndex: buttonNumber]; + [state setPressed: YES]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonUp: (unsigned) buttonNumber; +{ + ButtonState * state = [mJoystickButtons objectAtIndex: buttonNumber]; + [state setPressed: NO]; +} + +@end + +@implementation JoystickPaneController (Private) + +- (void) setJoysticks: (NSArray *) theJoysticks +{ + if (mJoysticks != theJoysticks) + { + [mJoysticks release]; + mJoysticks = [theJoysticks retain]; + } +} + +@end diff --git a/device_test/KeyboardPaneController.h b/device_test/KeyboardPaneController.h new file mode 100644 index 0000000..b42db30 --- /dev/null +++ b/device_test/KeyboardPaneController.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@class DDHidKeyboard; + +@interface KeyboardPaneController : NSObject +{ + IBOutlet NSArrayController * mKeyboardsController; + IBOutlet NSArrayController * mKeyboardEventsController; + + NSArray * mKeyboards; + unsigned mKeyboardIndex; + NSMutableArray * mEvents; + + // Don't retain these + DDHidKeyboard * mCurrentKeyboard; +} + +- (NSArray *) keyboards; +- (void) setKeyboards: (NSArray *) theKeyboards; + +- (unsigned) keyboardIndex; +- (void) setKeyboardIndex: (unsigned) theKeyboardIndex; + +- (NSMutableArray *) events; +- (void) setEvents: (NSMutableArray *) theEvents; +- (void) addEvent: (id)theEvent; +- (void) removeEvent: (id)theEvent; + +@end + +@interface KeyboardPaneController (DDHidKeyboardDelegate) + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyDown: (unsigned) usageId; + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyUp: (unsigned) usageId; + +@end diff --git a/device_test/KeyboardPaneController.m b/device_test/KeyboardPaneController.m new file mode 100644 index 0000000..1f8730e --- /dev/null +++ b/device_test/KeyboardPaneController.m @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "KeyboardPaneController.h" +#import "DDHidLib.h" +#include + +@interface KeyboardPaneController (Private) + +- (void) addEvent: (NSString *) event usageId: (unsigned) usageId; + +@end + +@implementation KeyboardPaneController + +- (id) init; +{ + self = [super init]; + if (self == nil) + return nil; + + mEvents = [[NSMutableArray alloc] init]; + + return self; +} + +- (void) awakeFromNib; +{ + NSArray * keyboards = [DDHidKeyboard allKeyboards]; + + [keyboards makeObjectsPerformSelector: @selector(setDelegate:) + withObject: self]; + [self setKeyboards: keyboards]; + + if ([keyboards count] > 0) + [self setKeyboardIndex: 0]; + else + [self setKeyboardIndex: NSNotFound]; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mKeyboards release]; + [mEvents release]; + + mKeyboards = nil; + mEvents = nil; + [super dealloc]; +} + +//=========================================================== +// keyboards +//=========================================================== +- (NSArray *) keyboards +{ + return mKeyboards; +} + +- (void) setKeyboards: (NSArray *) theKeyboards +{ + if (mKeyboards != theKeyboards) + { + [mKeyboards release]; + mKeyboards = [theKeyboards retain]; + } +} +//=========================================================== +// keyboardIndex +//=========================================================== +- (unsigned) keyboardIndex +{ + return mKeyboardIndex; +} + +- (void) setKeyboardIndex: (unsigned) theKeyboardIndex +{ + if (mCurrentKeyboard != nil) + { + [mCurrentKeyboard stopListening]; + mCurrentKeyboard = nil; + } + mKeyboardIndex = theKeyboardIndex; + [mKeyboardsController setSelectionIndex: mKeyboardIndex]; + [self willChangeValueForKey: @"events"]; + [mEvents removeAllObjects]; + [self didChangeValueForKey: @"events"]; + if (mKeyboardIndex != NSNotFound) + { + mCurrentKeyboard = [mKeyboards objectAtIndex: mKeyboardIndex]; + [mCurrentKeyboard startListening]; + } +} + +//=========================================================== +// events +//=========================================================== +- (NSMutableArray *) events +{ + return mEvents; +} + +- (void) setEvents: (NSMutableArray *) theEvents +{ + if (mEvents != theEvents) + { + [mEvents release]; + mEvents = [theEvents retain]; + } +} +- (void) addEvent: (id)theEvent +{ + [[self events] addObject: theEvent]; +} +- (void) removeEvent: (id)theEvent +{ + [[self events] removeObject: theEvent]; +} + + +@end + +@implementation KeyboardPaneController (DDHidKeyboardDelegate) + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyDown: (unsigned) usageId; +{ + [self addEvent: @"Key Down" usageId: usageId]; +} + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyUp: (unsigned) usageId; +{ + [self addEvent: @"Key Up" usageId: usageId]; +} + +@end + +@implementation KeyboardPaneController (Private) + +- (void) addEvent: (NSString *) event usageId: (unsigned) usageId; +{ + DDHidUsageTables * usageTables = [DDHidUsageTables standardUsageTables]; + NSString * description = [NSString stringWithFormat: @"%@ (0x%04X)", + [usageTables descriptionForUsagePage: kHIDPage_KeyboardOrKeypad + usage: usageId], + usageId]; + + NSMutableDictionary * row = [mKeyboardEventsController newObject]; + [row setObject: event forKey: @"event"]; + [row setObject: description forKey: @"description"]; + [mKeyboardEventsController addObject: row]; +} + +@end + diff --git a/device_test/MousePaneController.h b/device_test/MousePaneController.h new file mode 100644 index 0000000..031aae1 --- /dev/null +++ b/device_test/MousePaneController.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +@class DDHidQueue; +@class DDHidMouse; + +@interface MousePaneController : NSObject +{ + IBOutlet NSArrayController * mMiceController; + NSArray * mMice; + DDHidMouse * mCurrentMouse; + + unsigned mMouseIndex; + int mMouseX; + int mMouseY; + int mMouseWheel; + NSMutableArray * mMouseButtons; +} + +- (BOOL) no; + +- (NSArray *) mice; +- (void) setMice: (NSArray *) newMice; + +- (NSArray *) mouseButtons; + +- (unsigned) mouseIndex; +- (void) setMouseIndex: (unsigned) theMouseIndex; + +- (int) maxValue; + +- (int) mouseX; + +- (int) mouseY; + +- (int) mouseWheel; + +- (void) ddhidMouse: (DDHidMouse *) mouse xChanged: (SInt32) deltaX; +- (void) ddhidMouse: (DDHidMouse *) mouse yChanged: (SInt32) deltaY; +- (void) ddhidMouse: (DDHidMouse *) mouse wheelChanged: (SInt32) deltaWheel; + +- (void) ddhidMouse: (DDHidMouse *) mouse buttonDown: (unsigned) buttonNumber; +- (void) ddhidMouse: (DDHidMouse *) mouse buttonUp: (unsigned) buttonNumber; + +@end diff --git a/device_test/MousePaneController.m b/device_test/MousePaneController.m new file mode 100644 index 0000000..74f1590 --- /dev/null +++ b/device_test/MousePaneController.m @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "MousePaneController.h" +#import "DDHidLib.h" +#import "ButtonState.h" + + +@interface MousePaneController (Private) + +- (void) setMouseX: (int) mouseX; +- (void) setMouseY: (int) mouseY; +- (void) setMouseWheel: (int) mouseWheel; + +@end + +@implementation MousePaneController + +static int sMaxValue = 2500; + +static int applyDelta(int current, int delta) +{ + int newValue = (current + delta) % sMaxValue; + if (newValue < 0) + newValue = sMaxValue + newValue; + return newValue; +} + +- (void) awakeFromNib; +{ + mCurrentMouse = 0; + mMouseButtons = [[NSMutableArray alloc] init]; + + NSArray * mice = [DDHidMouse allMice]; + [mice makeObjectsPerformSelector: @selector(setDelegate:) + withObject: self]; + [self setMice: mice]; + [self setMouseIndex: 0]; +} + +//=========================================================== +// mice +//=========================================================== +- (NSArray *) mice +{ + return mMice; +} + +- (void) setMice: (NSArray *) theMice +{ + if (mMice != theMice) + { + [mMice release]; + mMice = [theMice retain]; + } +} + +- (NSArray *) mouseButtons; +{ + return mMouseButtons; +} + +- (BOOL) no; +{ + return NO; +} + +//=========================================================== +// - mouseIndex +//=========================================================== +- (unsigned) mouseIndex +{ + return mMouseIndex; +} + +//=========================================================== +// - setMouseIndex: +//=========================================================== +- (void) setMouseIndex: (unsigned) theMouseIndex +{ + if (mCurrentMouse != nil) + { + [mCurrentMouse stopListening]; + mCurrentMouse = nil; + } + mMouseIndex = theMouseIndex; + [mMiceController setSelectionIndex: mMouseIndex]; + if (mMouseIndex != NSNotFound) + { + mCurrentMouse = [mMice objectAtIndex: mMouseIndex]; + [mCurrentMouse startListening]; + [self setMouseX: sMaxValue/2]; + [self setMouseY: sMaxValue/2]; + [self setMouseWheel: sMaxValue/2]; + + [self willChangeValueForKey: @"mouseButtons"]; + [mMouseButtons removeAllObjects]; + NSArray * buttons = [mCurrentMouse buttonElements]; + NSEnumerator * e = [buttons objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + ButtonState * state = [[ButtonState alloc] initWithName: [[element usage] usageName]]; + [state autorelease]; + [mMouseButtons addObject: state]; + } + [self didChangeValueForKey: @"mouseButtons"]; + } +} + +- (int) maxValue; +{ + return sMaxValue; +} + +//=========================================================== +// - mouseX +//=========================================================== +- (int) mouseX +{ + return mMouseX; +} + +//=========================================================== +// - mouseY +//=========================================================== +- (int) mouseY +{ + return mMouseY; +} + +//=========================================================== +// - mouseWheel +//=========================================================== +- (int) mouseWheel +{ + return mMouseWheel; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse xChanged: (SInt32) deltaX; +{ + [self setMouseX: applyDelta(mMouseX, deltaX)]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse yChanged: (SInt32) deltaY; +{ + [self setMouseY: applyDelta(mMouseY, deltaY)]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse wheelChanged: (SInt32) deltaWheel; +{ + // Some wheels only output -1 or +1, some output a more analog value. + // Normalize wheel to -1%/+1% movement. + deltaWheel = (deltaWheel/abs(deltaWheel))*(sMaxValue/100); + [self setMouseWheel: applyDelta(mMouseWheel, deltaWheel)]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse buttonDown: (unsigned) buttonNumber; +{ + ButtonState * state = [mMouseButtons objectAtIndex: buttonNumber]; + [state setPressed: YES]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse buttonUp: (unsigned) buttonNumber; +{ + ButtonState * state = [mMouseButtons objectAtIndex: buttonNumber]; + [state setPressed: NO]; +} + +@end + +@implementation MousePaneController (Private) + +- (void) setMouseX: (int) mouseX; +{ + mMouseX = mouseX; +} + +- (void) setMouseY: (int) mouseY; +{ + mMouseY = mouseY; +} + +- (void) setMouseWheel: (int) mouseWheel; +{ + mMouseWheel = mouseWheel; +} + +@end + diff --git a/device_test/RemoteFeedbackView.h b/device_test/RemoteFeedbackView.h new file mode 100644 index 0000000..767e5d6 --- /dev/null +++ b/device_test/RemoteFeedbackView.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +// Based on Martin Kahr's Apple Remote wrapper +// http://www.martinkahr.com/source-code/ + +#import +#import "DDHidAppleRemote.h" + +@interface RemoteFeedbackView : NSView +{ + NSImage* remoteImage; + DDHidAppleRemoteEventIdentifier lastButtonIdentifier; + BOOL drawn; + BOOL clearAfterDraw; +} + +- (void) ddhidAppleRemoteButton: (DDHidAppleRemoteEventIdentifier)buttonIdentifier + pressedDown: (BOOL) pressedDown; + +@end diff --git a/device_test/RemoteFeedbackView.m b/device_test/RemoteFeedbackView.m new file mode 100644 index 0000000..acfdf3c --- /dev/null +++ b/device_test/RemoteFeedbackView.m @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +// Based on Martin Kahr's Apple Remote wrapper +// http://www.martinkahr.com/source-code/ + +#import "RemoteFeedbackView.h" + +@implementation RemoteFeedbackView + +- (id)initWithFrame:(NSRect)frameRect +{ + if ((self = [super initWithFrame:frameRect]) != nil) { + remoteImage = [[NSImage imageNamed:@"AppleRemote"] retain]; + lastButtonIdentifier = -1; + } + return self; +} + +- (void) dealloc { + + [remoteImage release]; + [super dealloc]; +} + +- (void) clearAfterRedraw: (id) sender +{ + clearAfterDraw = NO; + [self ddhidAppleRemoteButton: lastButtonIdentifier pressedDown: NO]; +} + +- (void) ddhidAppleRemoteButton: (DDHidAppleRemoteEventIdentifier)buttonIdentifier + pressedDown: (BOOL) pressedDown; +{ + + clearAfterDraw = NO; + + if (pressedDown) { + lastButtonIdentifier = buttonIdentifier; + } else { + if (drawn) + lastButtonIdentifier = -1; + else { + lastButtonIdentifier = buttonIdentifier; + clearAfterDraw = YES; + } + } + + drawn = NO; + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)rect +{ + drawn = YES; + NSRect imageRect; + NSRect drawingRect; + imageRect.origin = NSZeroPoint; + imageRect.size = [remoteImage size]; + + int x = ([self bounds].size.width - [remoteImage size].width)/2; + int y = ([self bounds].size.height - [remoteImage size].height)/2; + + drawingRect.origin = NSMakePoint(x, y); + drawingRect.size = imageRect.size; + + [remoteImage drawInRect: drawingRect + fromRect: imageRect + operation: NSCompositeSourceOver + fraction: 1.0]; + + + if (lastButtonIdentifier == -1) { + return; + } + + DDHidAppleRemoteEventIdentifier buttonToSelect = lastButtonIdentifier; + + NSPoint buttonPos; + float opacity = 0.5; + + switch(buttonToSelect) { + case kDDHidRemoteButtonVolume_Plus: + buttonPos.x = 53; + buttonPos.y = 240; + break; + case kDDHidRemoteButtonVolume_Minus: + buttonPos.x = 53; + buttonPos.y = 180; + break; + case kDDHidRemoteButtonMenu_Hold: + opacity = 0.8; + case kDDHidRemoteButtonMenu: + buttonPos.x = 53; + buttonPos.y = 137; + clearAfterDraw = YES; + break; + case kDDHidRemoteButtonPlay_Sleep: + opacity = 0.8; + case kDDHidRemoteButtonPlay: + buttonPos.x = 53; + buttonPos.y = 210; + clearAfterDraw = YES; + break; + case kDDHidRemoteButtonRight_Hold: + opacity = 0.8; + buttonPos.x = 83; + buttonPos.y = 210; + break; + case kDDHidRemoteButtonRight: + buttonPos.x = 83; + buttonPos.y = 210; + clearAfterDraw = YES; + break; + case kDDHidRemoteButtonLeft_Hold: + opacity = 0.8; + buttonPos.x = 23; + buttonPos.y = 210; + break; + case kDDHidRemoteButtonLeft: + buttonPos.x = 23; + buttonPos.y = 210; + clearAfterDraw = YES; + break; + default: + break; + } + + float width = 20.0; + float height= 20.0; + NSRect r = NSMakeRect(buttonPos.x + x - (width/2), buttonPos.y + y - (height/2), width, height); + NSBezierPath* bp = [NSBezierPath bezierPathWithOvalInRect:r]; + + [[NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:opacity] set]; + [bp fill]; + if (clearAfterDraw) { + [self performSelector:@selector(clearAfterRedraw:) withObject:self afterDelay:0.1]; + } +} + +@end diff --git a/device_test/main.m b/device_test/main.m new file mode 100644 index 0000000..f05b99f --- /dev/null +++ b/device_test/main.m @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/header.c b/header.c new file mode 100644 index 0000000..ddd2f75 --- /dev/null +++ b/header.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ diff --git a/lib/DDHidAppleMikey.h b/lib/DDHidAppleMikey.h new file mode 100644 index 0000000..c6bea0d --- /dev/null +++ b/lib/DDHidAppleMikey.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" + +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidAppleMikey : DDHidDevice +{ + NSMutableArray * mPressElements; + + id mDelegate; +} + ++ (NSArray *) allMikeys; + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; + +#pragma mark - +#pragma mark Elements + +- (NSArray *) pressElements; + +- (unsigned) numberOfKeys; + +- (void) addElementsToQueue: (DDHidQueue *) queue; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +@end + +@interface NSObject (DDHidAppleMikeyDelegate) + +- (void) ddhidAppleMikey: (DDHidAppleMikey *) mikey + press: (unsigned) usageId + upOrDown:(BOOL)upOrDown; + +@end diff --git a/lib/DDHidAppleMikey.m b/lib/DDHidAppleMikey.m new file mode 100644 index 0000000..b0da05f --- /dev/null +++ b/lib/DDHidAppleMikey.m @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidAppleMikey.h" +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#include + +@interface DDHidAppleMikey (DDHidAppleMikeyDelegate) + +- (void) ddhidAppleMikey: (DDHidAppleMikey *) mikey + press: (unsigned) usageId + upOrDown:(BOOL)upOrDown; + +@end + +@interface DDHidAppleMikey (Private) + +- (void) initPressElements: (NSArray *) elements; +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +@end + +@implementation DDHidAppleMikey + ++ (NSArray *) allMikeys; +{ + //add mikey + CFMutableDictionaryRef hidMatchDictionary = + IOServiceMatching(kIOHIDDeviceKey); + id a2 = [self allDevicesMatchingCFDictionary: hidMatchDictionary + withClass: self + skipZeroLocations: NO]; + a2 = [a2 filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"productName == \"Apple Mikey HID Driver\""]]; + + return a2; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; +{ + self = [super initWithDevice: device error: error_]; + if (self == nil) + return nil; + + mPressElements = [[NSMutableArray alloc] init]; + [self initPressElements: [self elements]]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mPressElements release]; + + mPressElements = nil; + [super dealloc]; +} + +#pragma mark - +#pragma mark Elements + +- (NSArray *) pressElements; +{ + return mPressElements; +} + +- (unsigned) numberOfKeys; +{ + return [mPressElements count]; +} + +- (void) addElementsToQueue: (DDHidQueue *) queue; +{ + [queue addElements: mPressElements]; +} + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [self addElementsToQueue: mDefaultQueue]; +} + +@end + +@implementation DDHidAppleMikey (DDHidAppleMikeyDelegate) + +- (void) ddhidAppleMikey:(DDHidAppleMikey *)mikey press:(unsigned int)usageId upOrDown:(BOOL)upOrDown +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidAppleMikey: mikey press: usageId upOrDown:(BOOL)upOrDown]; +} + +@end + +@implementation DDHidAppleMikey (Private) + +- (void) initPressElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { +// unsigned usagePage = [[element usage] usagePage]; +// unsigned usageId = [[element usage] usageId]; +// if (usagePage == kHIDPage_KeyboardOrKeypad) +// { +// if ((usageId >= 0x04) && (usageId <= 0xA4) || +// (usageId >= 0xE0) && (usageId <= 0xE7)) + { + [mPressElements addObject: element]; + } +// } + NSArray * subElements = [element elements]; + if (subElements != nil) + [self initPressElements: subElements]; + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + DDHidElement * element = [self elementForCookie: [event elementCookie]]; + unsigned usageId = [[element usage] usageId]; + SInt32 value = [event value]; + [self ddhidAppleMikey:self press:usageId upOrDown:value==1]; + } +} + +@end diff --git a/lib/DDHidAppleRemote.h b/lib/DDHidAppleRemote.h new file mode 100644 index 0000000..f6bc8ef --- /dev/null +++ b/lib/DDHidAppleRemote.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + +#import "DDHidDevice.h" + +@class DDHidElement; + +enum DDHidAppleRemoteEventIdentifier +{ + kDDHidRemoteButtonVolume_Plus=0, + kDDHidRemoteButtonVolume_Minus, + kDDHidRemoteButtonMenu, + kDDHidRemoteButtonPlay, + kDDHidRemoteButtonRight, + kDDHidRemoteButtonLeft, + kDDHidRemoteButtonRight_Hold, + kDDHidRemoteButtonLeft_Hold, + kDDHidRemoteButtonMenu_Hold, + kDDHidRemoteButtonPlay_Sleep, + kDDHidRemoteControl_Switched, + kDDHidRemoteControl_Paired, +}; +typedef enum DDHidAppleRemoteEventIdentifier DDHidAppleRemoteEventIdentifier; + +@interface DDHidAppleRemote : DDHidDevice +{ + NSMutableDictionary * mCookieToButtonMapping; + NSArray * mButtonElements; + DDHidElement * mIdElement; + int mRemoteId; + + id mDelegate; +} + ++ (NSArray *) allRemotes; + ++ (DDHidAppleRemote *) firstRemote; + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +#pragma mark - +#pragma mark Properties + +- (int) remoteId; +- (void) setRemoteId: (int) theRemoteId; + +@end + +@interface NSObject (DDHidAppleRemoteDelegate) + +- (void) ddhidAppleRemoteButton: (DDHidAppleRemoteEventIdentifier) buttonIdentifier + pressedDown: (BOOL) pressedDown; + +@end diff --git a/lib/DDHidAppleRemote.m b/lib/DDHidAppleRemote.m new file mode 100644 index 0000000..e8b31b2 --- /dev/null +++ b/lib/DDHidAppleRemote.m @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +// Based on Martin Kahr's Apple Remote wrapper +// http://www.martinkahr.com/source-code/ + +#import "DDHidAppleRemote.h" +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#import "NSDictionary+DDHidExtras.h" + +@interface DDHidAppleRemote (Private) + +- (void) initRemoteElements: (NSArray *) elements; + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +- (void) handleEventWithCookieString: (NSString*) cookieString + sumOfValues: (SInt32) sumOfValues; + +@end + +@implementation DDHidAppleRemote + ++ (NSArray *) allRemotes; +{ + CFMutableDictionaryRef hidMatchDictionary = + IOServiceMatching("AppleIRController"); + + return + [DDHidDevice allDevicesMatchingCFDictionary: hidMatchDictionary + withClass: self + skipZeroLocations: YES]; +} + ++ (DDHidAppleRemote *) firstRemote; +{ + NSArray * allRemotes = [self allRemotes]; + if ([allRemotes count] > 0) + return [allRemotes objectAtIndex: 0]; + else + return nil; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; +{ + self = [super initWithDevice: device error: error_]; + if (self == nil) + return nil; + + mCookieToButtonMapping = [[NSMutableDictionary alloc] init]; + + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonVolume_Plus + forKey: @"14_12_11_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonVolume_Plus + forKey: @"31_29_28_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonVolume_Minus + forKey: @"14_13_11_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonVolume_Minus + forKey: @"31_30_28_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonMenu + forKey: @"14_7_6_5_14_7_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonMenu + forKey: @"31_20_19_18_31_20_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonPlay + forKey: @"14_8_6_5_14_8_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonPlay + forKey: @"31_21_19_18_31_21_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonRight + forKey: @"14_9_6_5_14_9_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonRight + forKey: @"31_22_19_18_31_22_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonLeft + forKey: @"14_10_6_5_14_10_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonLeft + forKey: @"31_23_19_18_31_23_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonRight_Hold + forKey: @"14_6_5_4_2_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonRight_Hold + forKey: @"31_19_18_4_2_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonLeft_Hold + forKey: @"14_6_5_3_2_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonLeft_Hold + forKey: @"31_19_18_3_2_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonMenu_Hold + forKey: @"14_6_5_14_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonMenu_Hold + forKey: @"31_19_18_31_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonPlay_Sleep + forKey: @"18_14_6_5_18_14_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteButtonPlay_Sleep + forKey: @"35_31_19_18_35_31_19_18_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteControl_Switched + forKey: @"19_"]; + //[mCookieToButtonMapping ddhid_setInt: kDDHidRemoteControl_Switched + // forKey: @"??_"]; // unknown for 10.5 + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteControl_Paired + forKey: @"15_14_6_5_15_14_6_5_"]; + [mCookieToButtonMapping ddhid_setInt: kDDHidRemoteControl_Paired + forKey: @"32_31_19_18_32_31_19_18_"]; + + [self initRemoteElements: [self elements]]; + + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mCookieToButtonMapping release]; + [mButtonElements release]; + [mIdElement release]; + + mCookieToButtonMapping = nil; + mButtonElements = nil; + mIdElement = nil; + [super dealloc]; +} + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [mDefaultQueue addElements: mButtonElements]; +} + +#pragma mark - +#pragma mark Properties + +//=========================================================== +// remoteId +//=========================================================== +- (int) remoteId +{ + return mRemoteId; +} + +- (void) setRemoteId: (int) theRemoteId +{ + mRemoteId = theRemoteId; +} + +@end + +@implementation DDHidAppleRemote (Private) + +- (void) initRemoteElements: (NSArray *) elements; +{ + NSAssert([elements count] == 1, @"Assume only 1 top level remote element"); + DDHidElement * consumerControlsElement = [elements objectAtIndex: 0]; + mButtonElements = [[consumerControlsElement elements] retain]; + DDHidElement * element; + NSEnumerator * e = [mButtonElements objectEnumerator]; + while (element = [e nextObject]) + { + if ([[element usage] isEqualToUsagePage: 0x0006 + usageId: 0x0022]) + { + mIdElement = [element retain]; + } + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + NSMutableString * cookieString = [NSMutableString string]; + SInt32 sumOfValues = 0; + + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + if ([event elementCookie] == [mIdElement cookie]) + { + [self setRemoteId: [event value]]; + } + else + { + sumOfValues += [event value]; + [cookieString appendString: + [NSString stringWithFormat: @"%u_", [event elementCookieAsUnsigned]]]; + } + } + [self handleEventWithCookieString: cookieString sumOfValues: sumOfValues]; +} + +- (void) handleEventWithCookieString: (NSString*) cookieString + sumOfValues: (SInt32) sumOfValues; +{ + NSNumber* buttonId = [mCookieToButtonMapping objectForKey: cookieString]; + if (buttonId != nil) + { + if ([mDelegate respondsToSelector: @selector(ddhidAppleRemoteButton:pressedDown:)]) + { + [mDelegate ddhidAppleRemoteButton: [buttonId intValue] + pressedDown: (sumOfValues>0)]; + } + } + else + NSLog(@"Unknown button for cookiestring %@", cookieString); + +} + +@end + diff --git a/lib/DDHidDevice.h b/lib/DDHidDevice.h new file mode 100644 index 0000000..40b9fdb --- /dev/null +++ b/lib/DDHidDevice.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#include +#include +#include +#include + +@class DDHidUsage; +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidDevice : NSObject +{ + io_object_t mHidDevice; + IOHIDDeviceInterface122** mDeviceInterface; + + NSMutableDictionary * mProperties; + DDHidUsage * mPrimaryUsage; + NSMutableArray * mUsages; + NSArray * mElements; + NSMutableDictionary * mElementsByCookie; + BOOL mListenInExclusiveMode; + DDHidQueue * mDefaultQueue; + int mTag; + int mLogicalDeviceNumber; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error; +- (id) initLogicalWithDevice: (io_object_t) device + logicalDeviceNumber: (int) logicalDeviceNumber + error: (NSError **) error; +- (int) logicalDeviceCount; + +#pragma mark - +#pragma mark Finding Devices + ++ (NSArray *) allDevices; + ++ (NSArray *) allDevicesMatchingUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId + withClass: (Class) hidClass + skipZeroLocations: (BOOL) emptyLocation; + ++ (NSArray *) allDevicesMatchingCFDictionary: (CFDictionaryRef) matchDictionary + withClass: (Class) hidClass + skipZeroLocations: (BOOL) emptyLocation; + +#pragma mark - +#pragma mark I/O Kit Objects + +- (io_object_t) ioDevice; +- (IOHIDDeviceInterface122**) deviceInterface; + +#pragma mark - +#pragma mark Operations + +- (void) open; +- (void) openWithOptions: (UInt32) options; +- (void) close; +- (DDHidQueue *) createQueueWithSize: (unsigned) size; +- (long) getElementValue: (DDHidElement *) element; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (BOOL) listenInExclusiveMode; +- (void) setListenInExclusiveMode: (BOOL) flag; + +- (void) startListening; + +- (void) stopListening; + +- (BOOL) isListening; + +#pragma mark - +#pragma mark Properties + +- (NSDictionary *) properties; + +- (NSArray *) elements; +- (DDHidElement *) elementForCookie: (IOHIDElementCookie) cookie; + +- (NSString *) productName; +- (NSString *) manufacturer; +- (NSString *) serialNumber; +- (NSString *) transport; +- (long) vendorId; +- (long) productId; +- (long) version; +- (long) locationId; +- (long) usagePage; +- (long) usage; +- (DDHidUsage *) primaryUsage; +- (NSArray *) usages; + +- (NSComparisonResult) compareByLocationId: (DDHidDevice *) device; + +- (int) tag; +- (void) setTag: (int) theTag; + +@end + +@interface DDHidDevice (Protected) + +- (unsigned) sizeOfDefaultQueue; +- (void) addElementsToDefaultQueue; + +@end diff --git a/lib/DDHidDevice.m b/lib/DDHidDevice.m new file mode 100644 index 0000000..8000185 --- /dev/null +++ b/lib/DDHidDevice.m @@ -0,0 +1,585 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidDevice.h" +#import "DDHidUsage.h" +#import "DDHidElement.h" +#import "DDHidQueue.h" +#import "NSDictionary+DDHidExtras.h" +#import "NSXReturnThrowError.h" + +#include + +@interface DDHidDevice (Private) + ++ (void) addDevice: (io_object_t) hidDevice + withClass: (Class) hidClass + skipZeroLocations: (BOOL) skipZeroLocations + toDeviceList: (NSMutableArray *) devices; + +- (BOOL) initPropertiesWithError: (NSError **) error_; +- (BOOL) createDeviceInterfaceWithError: (NSError **) error_; + +@end + +@implementation DDHidDevice + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error; +{ + return [self initLogicalWithDevice: device + logicalDeviceNumber: 0 + error: error]; +} + +- (id) initLogicalWithDevice: (io_object_t) device + logicalDeviceNumber: (int) logicalDeviceNumber + error: (NSError **) error; +{ + self = [super init]; + if (self == nil) + return nil; + + mHidDevice = device; + IOObjectRetain(mHidDevice); + + if (![self initPropertiesWithError: error]) + { + [self release]; + return nil; + } + + if (![self createDeviceInterfaceWithError: error]) + { + [self release]; + return nil; + } + + mLogicalDeviceNumber = logicalDeviceNumber; + mListenInExclusiveMode = NO; + mDefaultQueue = nil; + mTag = 0; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mDefaultQueue release]; + if (mDeviceInterface != NULL) + { + (*mDeviceInterface)->close(mDeviceInterface); + (*mDeviceInterface)->Release(mDeviceInterface); + } + [mElementsByCookie release]; + [mElements release]; + [mUsages release]; + [mPrimaryUsage release]; + [mProperties release]; + IOObjectRelease(mHidDevice); + + mProperties = nil; + mDeviceInterface = NULL; + [super dealloc]; +} + +#pragma mark - +#pragma mark Finding Devices + ++ (NSArray *) allDevices; +{ + // Set up a matching dictionary to search the I/O Registry by class + // name for all HID class devices + CFMutableDictionaryRef hidMatchDictionary = + IOServiceMatching(kIOHIDDeviceKey); + return [self allDevicesMatchingCFDictionary: hidMatchDictionary + withClass: [DDHidDevice class] + skipZeroLocations: NO]; +} + ++ (NSArray *) allDevicesMatchingUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId + withClass: (Class) hidClass + skipZeroLocations: (BOOL) skipZeroLocations; +{ + // Set up a matching dictionary to search the I/O Registry by class + // name for all HID class devices + CFMutableDictionaryRef hidMatchDictionary = + IOServiceMatching(kIOHIDDeviceKey); + NSMutableDictionary * objcMatchDictionary = + (NSMutableDictionary *) hidMatchDictionary; + [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usagePage] + forString: kIOHIDDeviceUsagePageKey]; + [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usageId] + forString: kIOHIDDeviceUsageKey]; + return [self allDevicesMatchingCFDictionary: hidMatchDictionary + withClass: hidClass + skipZeroLocations: skipZeroLocations]; +} + ++ (NSArray *) allDevicesMatchingCFDictionary: (CFDictionaryRef) matchDictionary + withClass: (Class) hidClass + skipZeroLocations: (BOOL) skipZeroLocations; +{ + // Now search I/O Registry for matching devices. + io_iterator_t hidObjectIterator = MACH_PORT_NULL; + NSMutableArray * devices = [NSMutableArray array]; + @try + { + NSXThrowError(IOServiceGetMatchingServices(kIOMasterPortDefault, + matchDictionary, + &hidObjectIterator)); + + if (hidObjectIterator == 0) + return [NSArray array]; + + io_object_t hidDevice; + while (hidDevice = IOIteratorNext(hidObjectIterator)) + { + [self addDevice: hidDevice + withClass: hidClass + skipZeroLocations: skipZeroLocations + toDeviceList: devices]; + } + + // This makes sure the array return is consistent from run to run, + // assuming no new devices were added. + [devices sortUsingSelector: @selector(compareByLocationId:)]; + } + @finally + { + if (hidObjectIterator != MACH_PORT_NULL) + IOObjectRelease(hidObjectIterator); + } + + return devices; +} + +- (int) logicalDeviceCount; +{ + return 1; +} + +#pragma mark - +#pragma mark I/O Kit Objects + +- (io_object_t) ioDevice; +{ + return mHidDevice; +} + +- (IOHIDDeviceInterface122**) deviceInterface; +{ + return mDeviceInterface; +} + +#pragma mark - +#pragma mark Operations + +- (void) open; +{ + [self openWithOptions: kIOHIDOptionsTypeNone]; +} + +- (void) openWithOptions: (UInt32) options; +{ + NSXThrowError((*mDeviceInterface)->open(mDeviceInterface, options)); +} + +- (void) close; +{ + NSXThrowError((*mDeviceInterface)->close(mDeviceInterface)); +} + +- (DDHidQueue *) createQueueWithSize: (unsigned) size; +{ + IOHIDQueueInterface ** queue = + (*mDeviceInterface)->allocQueue(mDeviceInterface); + if (queue == NULL) + return nil; + return [[[DDHidQueue alloc] initWithHIDQueue: queue + size: size] autorelease]; +} + +- (long) getElementValue: (DDHidElement *) element; +{ + IOHIDEventStruct event; + NSXThrowError((*mDeviceInterface)->getElementValue(mDeviceInterface, + [element cookie], + &event)); + return event.value; +} + +#pragma mark - +#pragma mark Asynchronous Notification + +//=========================================================== +// listenInExclusiveMode +//=========================================================== +- (BOOL) listenInExclusiveMode +{ + return mListenInExclusiveMode; +} + +- (void) setListenInExclusiveMode: (BOOL) flag +{ + mListenInExclusiveMode = flag; +} + +- (void) startListening; +{ + if ([self isListening]) + return; + + UInt32 options = kIOHIDOptionsTypeNone; + if (mListenInExclusiveMode) + options = kIOHIDOptionsTypeSeizeDevice; + [self openWithOptions: options]; + mDefaultQueue = [[self createQueueWithSize: [self sizeOfDefaultQueue]] retain]; + [mDefaultQueue setDelegate: self]; + [self addElementsToDefaultQueue]; + [mDefaultQueue startOnCurrentRunLoop]; +} + +- (void) stopListening; +{ + if (![self isListening]) + return; + + [mDefaultQueue stop]; + [mDefaultQueue release]; + mDefaultQueue = nil; + [self close]; +} + +- (BOOL) isListening; +{ + return (mDefaultQueue != nil); +} + +#pragma mark - +#pragma mark Properties + +- (NSDictionary *) properties; +{ + return mProperties; +} + +//=========================================================== +// - productName +//=========================================================== +- (NSString *) productName +{ + NSString * productName = [mProperties ddhid_stringForString: kIOHIDProductKey]; + if ([self logicalDeviceCount] > 1) + { + productName = [productName stringByAppendingString: + [NSString stringWithFormat:@" #%d", mLogicalDeviceNumber + 1]]; + } + return productName; +} + +//=========================================================== +// - manufacturer +//=========================================================== +- (NSString *) manufacturer +{ + return [mProperties ddhid_stringForString: kIOHIDManufacturerKey]; +} + +//=========================================================== +// - serialNumber +//=========================================================== +- (NSString *) serialNumber +{ + return [mProperties ddhid_stringForString: kIOHIDSerialNumberKey]; +} + +//=========================================================== +// - transport +//=========================================================== +- (NSString *) transport +{ + return [mProperties ddhid_stringForString: kIOHIDTransportKey]; +} + +//=========================================================== +// - vendorId +//=========================================================== +- (long) vendorId +{ + return [mProperties ddhid_longForString: kIOHIDVendorIDKey]; +} + +//=========================================================== +// - productId +//=========================================================== +- (long) productId +{ + return [mProperties ddhid_longForString: kIOHIDProductIDKey]; +} + +//=========================================================== +// - version +//=========================================================== +- (long) version +{ + return [mProperties ddhid_longForString: kIOHIDVersionNumberKey]; +} + +//=========================================================== +// - locationId +//=========================================================== +- (long) locationId +{ + return [mProperties ddhid_longForString: kIOHIDLocationIDKey]; +} + +//=========================================================== +// - usagePage +//=========================================================== +- (long) usagePage +{ + return [mProperties ddhid_longForString: kIOHIDPrimaryUsagePageKey]; +} + +//=========================================================== +// - usage +//=========================================================== +- (long) usage +{ + return [mProperties ddhid_longForString: kIOHIDPrimaryUsageKey]; +} + +- (NSArray *) elements; +{ + return mElements; +} + +- (DDHidElement *) elementForCookie: (IOHIDElementCookie) cookie; +{ + NSNumber * n = [NSNumber numberWithUnsignedInt: (unsigned) cookie]; + return [mElementsByCookie objectForKey: n]; +} + +- (DDHidUsage *) primaryUsage; +{ + return mPrimaryUsage; +} + +- (NSArray *) usages; +{ + return mUsages; +} + +- (NSComparisonResult) compareByLocationId: (DDHidDevice *) device; +{ + long myLocationId = [self locationId]; + long otherLocationId = [device locationId]; + if (myLocationId < otherLocationId) + return NSOrderedAscending; + else if (myLocationId > otherLocationId) + return NSOrderedDescending; + else + return NSOrderedSame; +} + +//=========================================================== +// tag +//=========================================================== +- (int) tag +{ + return mTag; +} + +- (void) setTag: (int) theTag +{ + mTag = theTag; +} + +@end + +@implementation DDHidDevice (Protected) + +- (unsigned) sizeOfDefaultQueue; +{ + return 10; +} + +- (void) addElementsToDefaultQueue; +{ + [mDefaultQueue addElements: [self elements] recursively: YES]; +} + +@end + +@implementation DDHidDevice (Private) + ++ (void) addDevice: (io_object_t) hidDevice + withClass: (Class) hidClass + skipZeroLocations: (BOOL) skipZeroLocations + toDeviceList: (NSMutableArray *) devices; +{ + @try + { + NSError * error = nil; + DDHidDevice * device = [[hidClass alloc] initWithDevice: hidDevice + error: &error]; + if (device == nil) + { + NSXRaiseError(error); + } + [device autorelease]; + + if (([device locationId] == 0) && skipZeroLocations) + return; + + [devices addObject: device]; + + // Add remainnig logical devices + int i; + for (i = 1; i < [device logicalDeviceCount]; i++) + { + device = [[hidClass alloc] initLogicalWithDevice: hidDevice + logicalDeviceNumber: i + error: &error]; + + if (device == nil) + { + NSXRaiseError(error); + } + [device autorelease]; + + [devices addObject: device]; + } + } + @finally + { + IOObjectRelease(hidDevice); + } +} + +- (void) indexElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + NSNumber * n = [NSNumber numberWithUnsignedInt: [element cookieAsUnsigned]]; + [mElementsByCookie setObject: element + forKey: n]; + NSArray * children = [element elements]; + if (children != nil) + [self indexElements: children]; + } +} + +- (BOOL) initPropertiesWithError: (NSError **) error_; +{ + NSError * error = nil; + BOOL result = NO; + + CFMutableDictionaryRef properties; + NSXReturnError(IORegistryEntryCreateCFProperties(mHidDevice, &properties, + kCFAllocatorDefault, kNilOptions)); + if (error) + goto done; + + mProperties = (NSMutableDictionary *) properties; + NSArray * elementProperties = [mProperties ddhid_objectForString: kIOHIDElementKey]; + mElements = [DDHidElement elementsWithPropertiesArray: elementProperties]; + [mElements retain]; + + unsigned usagePage = [mProperties ddhid_unsignedIntForString: kIOHIDPrimaryUsagePageKey]; + unsigned usageId = [mProperties ddhid_unsignedIntForString: kIOHIDPrimaryUsageKey]; + + mPrimaryUsage = [[DDHidUsage alloc] initWithUsagePage: usagePage + usageId: usageId]; + mUsages = [[NSMutableArray alloc] init]; + + NSArray * usagePairs = [mProperties ddhid_objectForString: kIOHIDDeviceUsagePairsKey]; + NSEnumerator * e = [usagePairs objectEnumerator]; + NSDictionary * usagePair; + while (usagePair = [e nextObject]) + { + usagePage = [usagePair ddhid_unsignedIntForString: kIOHIDDeviceUsagePageKey]; + usageId = [usagePair ddhid_unsignedIntForString: kIOHIDDeviceUsageKey]; + DDHidUsage * usage = [DDHidUsage usageWithUsagePage: usagePage + usageId: usageId]; + [mUsages addObject: usage]; + } + + mElementsByCookie = [[NSMutableDictionary alloc] init]; + [self indexElements: mElements]; + result = YES; + +done: + if (error_) + *error_ = error; + return result; +} + +- (BOOL) createDeviceInterfaceWithError: (NSError **) error_; +{ + io_name_t className; + IOCFPlugInInterface ** plugInInterface = NULL; + SInt32 score = 0; + NSError * error = nil; + BOOL result = NO; + + mDeviceInterface = NULL; + + NSXReturnError(IOObjectGetClass(mHidDevice, className)); + if (error) + goto done; + + NSXReturnError(IOCreatePlugInInterfaceForService(mHidDevice, + kIOHIDDeviceUserClientTypeID, + kIOCFPlugInInterfaceID, + &plugInInterface, + &score)); + if (error) + goto done; + + //Call a method of the intermediate plug-in to create the device interface + NSXReturnError((*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &mDeviceInterface)); + if (error) + goto done; + + result = YES; + +done: + if (plugInInterface != NULL) + { + (*plugInInterface)->Release(plugInInterface); + } + if (error_) + *error_ = error; + return result; +} + +@end + diff --git a/lib/DDHidElement.h b/lib/DDHidElement.h new file mode 100644 index 0000000..4e9577c --- /dev/null +++ b/lib/DDHidElement.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#include + +@class DDHidUsage; + +@interface DDHidElement : NSObject +{ + NSDictionary * mProperties; + DDHidUsage * mUsage; + NSArray * mElements; +} + ++ (NSArray *) elementsWithPropertiesArray: (NSArray *) propertiesArray; + ++ (DDHidElement *) elementWithProperties: (NSDictionary *) properties; + +- (id) initWithProperties: (NSDictionary *) properties; + +- (NSDictionary *) properties; + +- (NSString *) stringForKey: (NSString *) key; + +- (NSString *) description; + +- (IOHIDElementCookie) cookie; +- (unsigned) cookieAsUnsigned; + +- (NSArray *) elements; +- (DDHidUsage *) usage; +- (NSString *) name; +- (BOOL) hasNullState; +- (BOOL) hasPreferredState; +- (BOOL) isArray; +- (BOOL) isRelative; +- (BOOL) isWrapping; +- (long) maxValue; +- (long) minValue; + +- (NSComparisonResult) compareByUsage: (DDHidElement *) device; + +@end diff --git a/lib/DDHidElement.m b/lib/DDHidElement.m new file mode 100644 index 0000000..5a00095 --- /dev/null +++ b/lib/DDHidElement.m @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "NSDictionary+DDHidExtras.h" +#include + +@implementation DDHidElement + ++ (NSArray *) elementsWithPropertiesArray: (NSArray *) propertiesArray; +{ + NSMutableArray * elements = [NSMutableArray array]; + + NSDictionary * properties; + NSEnumerator * e = [propertiesArray objectEnumerator]; + while (properties = [e nextObject]) + { + DDHidElement * element = [DDHidElement elementWithProperties: properties]; + [elements addObject: element]; + } + + return elements; +} + ++ (DDHidElement *) elementWithProperties: (NSDictionary *) properties; +{ + DDHidElement * element = [[DDHidElement alloc] initWithProperties: properties]; + return [element autorelease]; +} + +- (id) initWithProperties: (NSDictionary *) properties; +{ + self = [super init]; + if (self == nil) + return nil; + + mProperties = [properties retain]; + unsigned usagePage = [mProperties ddhid_unsignedIntForString: kIOHIDElementUsagePageKey]; + unsigned usageId = [mProperties ddhid_unsignedIntForString: kIOHIDElementUsageKey]; + mUsage = [[DDHidUsage alloc] initWithUsagePage: usagePage + usageId: usageId]; + + NSArray * elementsProperties = + [mProperties ddhid_objectForString: kIOHIDElementKey]; + mElements = [[DDHidElement elementsWithPropertiesArray: elementsProperties] + retain]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mProperties release]; + [mUsage release]; + [mElements release]; + + mProperties = nil; + mUsage = nil; + mElements = nil; + [super dealloc]; +} + +- (NSDictionary *) properties; +{ + return mProperties; +} + +- (NSString *) stringForKey: (NSString *) key; +{ + return [mProperties objectForKey: key]; +} + +- (NSString *) description; +{ + return [[self usage] usageNameWithIds]; +} + +- (IOHIDElementCookie) cookie; +{ + return (IOHIDElementCookie) + [mProperties ddhid_unsignedIntForString: kIOHIDElementCookieKey]; +} + +- (unsigned) cookieAsUnsigned; +{ + return [mProperties ddhid_unsignedIntForString: kIOHIDElementCookieKey]; +} + +- (DDHidUsage *) usage; +{ + return mUsage; +} + +- (NSArray *) elements; +{ + return mElements; +} + +- (NSString *) name; +{ + return [mProperties ddhid_objectForString: kIOHIDElementNameKey]; +} + +- (BOOL) hasNullState; +{ + return [mProperties ddhid_boolForString: kIOHIDElementHasNullStateKey]; +} + +- (BOOL) hasPreferredState; +{ + return [mProperties ddhid_boolForString: kIOHIDElementHasNullStateKey]; +} + +- (BOOL) isArray; +{ + return [mProperties ddhid_boolForString: kIOHIDElementIsArrayKey]; +} + +- (BOOL) isRelative; +{ + return [mProperties ddhid_boolForString: kIOHIDElementIsRelativeKey]; +} + +- (BOOL) isWrapping; +{ + return [mProperties ddhid_boolForString: kIOHIDElementIsWrappingKey]; +} + +- (long) maxValue; +{ + return [mProperties ddhid_longForString: kIOHIDElementMaxKey]; +} + +- (long) minValue; +{ + return [mProperties ddhid_longForString: kIOHIDElementMinKey]; +} + +- (NSComparisonResult) compareByUsage: (DDHidElement *) device; +{ + unsigned myUsagePage = [[self usage] usagePage]; + unsigned myUsageId = [[self usage] usageId]; + + unsigned otherUsagePage = [[device usage] usagePage]; + unsigned otherUsageId = [[device usage] usageId]; + + if (myUsagePage < otherUsagePage) + return NSOrderedAscending; + else if (myUsagePage > otherUsagePage) + return NSOrderedDescending; + + if (myUsageId < otherUsageId) + return NSOrderedAscending; + else if (myUsageId > otherUsageId) + return NSOrderedDescending; + + return NSOrderedSame; +} + +@end diff --git a/lib/DDHidEvent.h b/lib/DDHidEvent.h new file mode 100644 index 0000000..0861cfd --- /dev/null +++ b/lib/DDHidEvent.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#include + +@interface DDHidEvent : NSObject +{ + IOHIDEventStruct mEvent; +} + ++ (DDHidEvent *) eventWithIOHIDEvent: (IOHIDEventStruct *) event; + +- (id) initWithIOHIDEvent: (IOHIDEventStruct *) event; + +- (IOHIDElementType) type; +- (IOHIDElementCookie) elementCookie; +- (unsigned) elementCookieAsUnsigned; +- (SInt32) value; +- (AbsoluteTime) timestamp; +- (UInt32) longValueSize; +- (void *) longValue; + +@end diff --git a/lib/DDHidEvent.m b/lib/DDHidEvent.m new file mode 100644 index 0000000..8b2ab5f --- /dev/null +++ b/lib/DDHidEvent.m @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidEvent.h" + + +@implementation DDHidEvent + ++ (DDHidEvent *) eventWithIOHIDEvent: (IOHIDEventStruct *) event; +{ + return [[[self alloc] initWithIOHIDEvent: event] autorelease]; +} + +- (id) initWithIOHIDEvent: (IOHIDEventStruct *) event; +{ + self = [super init]; + if (self == nil) + return nil; + + mEvent = *event; + + return self; +} + +- (IOHIDElementType) type; +{ + return mEvent.type; +} + +- (IOHIDElementCookie) elementCookie; +{ + return mEvent.elementCookie; +} + +- (unsigned) elementCookieAsUnsigned; +{ + return (unsigned) mEvent.elementCookie; +} + +- (SInt32) value; +{ + return mEvent.value; +} + +- (AbsoluteTime) timestamp; +{ + return mEvent.timestamp; +} + +- (UInt32) longValueSize; +{ + return mEvent.longValueSize; +} + +- (void *) longValue; +{ + return mEvent.longValue; +} + +@end diff --git a/lib/DDHidJoystick.h b/lib/DDHidJoystick.h new file mode 100644 index 0000000..ebf20cc --- /dev/null +++ b/lib/DDHidJoystick.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" + +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidJoystickStick : NSObject +{ + DDHidElement * mXAxisElement; + DDHidElement * mYAxisElement; + NSMutableArray * mStickElements; + // Point of view elements (i.e. hat switches) + NSMutableArray * mPovElements; +} + +- (DDHidElement *) xAxisElement; + +- (DDHidElement *) yAxisElement; + +#pragma mark - +#pragma mark StickElements - indexed accessors + +- (unsigned int) countOfStickElements; +- (DDHidElement *) objectInStickElementsAtIndex: (unsigned int)index; + +#pragma mark - +#pragma mark PovElements - indexed accessors + +- (unsigned int) countOfPovElements; +- (DDHidElement *) objectInPovElementsAtIndex: (unsigned int)index; + +- (NSArray *) allElements; + +- (BOOL) addElement: (DDHidElement *) element; + +@end + +@interface DDHidJoystick : DDHidDevice +{ + NSMutableArray * mSticks; + NSMutableArray * mButtonElements; + NSMutableArray * mLogicalDeviceElements; + + id mDelegate; +} + ++ (NSArray *) allJoysticks; + +- (id) initLogicalWithDevice: (io_object_t) device + logicalDeviceNumber: (int) logicalDeviceNumber + error: (NSError **) error; + +- (int) logicalDeviceCount; + +#pragma mark - +#pragma mark Joystick Elements + +- (unsigned) numberOfButtons; + +- (NSArray *) buttonElements; + +#pragma mark - +#pragma mark Sticks - indexed accessors + +- (unsigned int) countOfSticks; +- (DDHidJoystickStick *) objectInSticksAtIndex: (unsigned int)index; + +- (void) addElementsToQueue: (DDHidQueue *) queue; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +@end + +#define DDHID_JOYSTICK_VALUE_MIN -65536 +#define DDHID_JOYSTICK_VALUE_MAX 65536 + +@interface NSObject (DDHidJoystickDelegate) + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + xChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + yChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + otherAxis: (unsigned) otherAxis + valueChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + povNumber: (unsigned) povNumber + valueChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonDown: (unsigned) buttonNumber; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonUp: (unsigned) buttonNumber; + +@end diff --git a/lib/DDHidJoystick.m b/lib/DDHidJoystick.m new file mode 100644 index 0000000..601f9b3 --- /dev/null +++ b/lib/DDHidJoystick.m @@ -0,0 +1,654 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidLib.h" +#include + +@interface DDHidJoystick (DDHidJoystickDelegate) + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + xChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + yChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + otherAxis: (unsigned) otherAxis + valueChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + povNumber: (unsigned) povNumber + valueChanged: (int) value; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonDown: (unsigned) buttonNumber; + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonUp: (unsigned) buttonNumber; + +@end + +@interface DDHidJoystick (Private) + +- (void) initLogicalDeviceElements; +- (void) initJoystickElements: (NSArray *) elements; +- (void) addStick: (NSArray *) stickElements; +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +- (int) normalizeValue: (int) value + forElement: (DDHidElement *) element; + +- (int) povValue: (int) value + forElement: (DDHidElement *) element; + +- (BOOL) findStick: (unsigned *) stick + element: (DDHidElement **) elementOut + withXAxisCookie: (IOHIDElementCookie) cookie; + +- (BOOL) findStick: (unsigned *) stick + element: (DDHidElement **) elementOut + withYAxisCookie: (IOHIDElementCookie) cookie; + +- (BOOL) findStick: (unsigned *) stickOut + otherAxis: (unsigned *) axisOut + element: (DDHidElement **) elementOut + withCookie: (IOHIDElementCookie) cookie; + +- (BOOL) findStick: (unsigned *) stickOut + povNumber: (unsigned *) povNumber + element: (DDHidElement **) elementOut + withCookie: (IOHIDElementCookie) cookie; + +@end + +@implementation DDHidJoystick + ++ (NSArray *) allJoysticks; +{ + NSArray * joysticks = + [DDHidDevice allDevicesMatchingUsagePage: kHIDPage_GenericDesktop + usageId: kHIDUsage_GD_Joystick + withClass: self + skipZeroLocations: YES]; + NSArray * gamepads = + [DDHidDevice allDevicesMatchingUsagePage: kHIDPage_GenericDesktop + usageId: kHIDUsage_GD_GamePad + withClass: self + skipZeroLocations: YES]; + + NSMutableArray * allJoysticks = [NSMutableArray arrayWithArray: joysticks]; + [allJoysticks addObjectsFromArray: gamepads]; + [allJoysticks sortUsingSelector: @selector(compareByLocationId:)]; + return allJoysticks; +} + +- (id) initLogicalWithDevice: (io_object_t) device + logicalDeviceNumber: (int) logicalDeviceNumber + error: (NSError **) error; +{ + self = [super initLogicalWithDevice: device + logicalDeviceNumber: logicalDeviceNumber + error: error]; + if (self == nil) + return nil; + + mButtonElements = [[NSMutableArray alloc] init]; + mSticks = [[NSMutableArray alloc] init]; + mLogicalDeviceElements = [[NSMutableArray alloc] init]; + + [self initLogicalDeviceElements]; + int logicalDeviceCount = [mLogicalDeviceElements count]; + if (logicalDeviceCount == 0) + { + [self release]; + return nil; + } + + mLogicalDeviceNumber = logicalDeviceNumber; + if (mLogicalDeviceNumber >= logicalDeviceCount) + mLogicalDeviceNumber = logicalDeviceCount - 1; + + [self initJoystickElements: + [mLogicalDeviceElements objectAtIndex: mLogicalDeviceNumber]]; + [mButtonElements sortUsingSelector: @selector(compareByUsage:)]; + mDelegate = nil; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mLogicalDeviceElements release]; + [mSticks release]; + [mButtonElements release]; + + mLogicalDeviceElements = nil; + mSticks = nil; + mButtonElements = nil; + [super dealloc]; +} + +- (int) logicalDeviceCount; +{ + return [mLogicalDeviceElements count]; +} + +#pragma mark - +#pragma mark Joystick Elements + +//=========================================================== +// - buttonElements +//=========================================================== +- (NSArray *) buttonElements; +{ + return mButtonElements; +} + +- (unsigned) numberOfButtons; +{ + return [mButtonElements count]; +} + +#pragma mark - +#pragma mark Sticks - indexed accessors + +- (unsigned int) countOfSticks +{ + return [mSticks count]; +} + +- (DDHidJoystickStick *) objectInSticksAtIndex: (unsigned int)index +{ + return [mSticks objectAtIndex: index]; +} + +- (void) addElementsToQueue: (DDHidQueue *) queue; +{ + NSEnumerator * e = [mSticks objectEnumerator]; + DDHidJoystickStick * stick; + while (stick = [e nextObject]) + { + [queue addElements: [stick allElements]]; + } + + [queue addElements: mButtonElements]; +} + + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [self addElementsToQueue: mDefaultQueue]; +} + +@end + +@implementation DDHidJoystick (Private) + +- (void) initLogicalDeviceElements; +{ + NSArray * topLevelElements = [self elements]; + if ([topLevelElements count] == 0) + { + [mLogicalDeviceElements addObject: topLevelElements]; + return; + } + + NSEnumerator * e = [topLevelElements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + unsigned usagePage = [[element usage] usagePage]; + unsigned usageId = [[element usage] usageId]; + if (usagePage == kHIDPage_GenericDesktop && + (usageId == kHIDUsage_GD_Joystick || usageId == kHIDUsage_GD_GamePad)) + { + [mLogicalDeviceElements addObject: [NSArray arrayWithObject: element]]; + } + } +} + +- (void) initJoystickElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + DDHidJoystickStick * currentStick = [[[DDHidJoystickStick alloc] init] autorelease]; + BOOL stickHasElements = NO; + + while (element = [e nextObject]) + { + unsigned usagePage = [[element usage] usagePage]; + unsigned usageId = [[element usage] usageId]; + NSArray * subElements = [element elements]; + + if ([subElements count] > 0) + { + [self initJoystickElements: subElements]; + } + else if ((usagePage == kHIDPage_GenericDesktop) && + (usageId == kHIDUsage_GD_Pointer)) + { + [self addStick: subElements]; + } + else if ([currentStick addElement: element]) + { + stickHasElements = YES; + } + else if ((usagePage == kHIDPage_Button) && + (usageId > 0)) + { + [mButtonElements addObject: element]; + } + } + if (stickHasElements) + { + [mSticks addObject: currentStick]; + } +} + +- (void) addStick: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + NSLog(@"Stick element: %@", [[element usage] usageName]); + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + IOHIDElementCookie cookie = [event elementCookie]; + SInt32 value = [event value]; + DDHidElement * element; + unsigned stick; + unsigned otherAxis; + unsigned povNumber; + if ([self findStick: &stick element: &element withXAxisCookie: cookie]) + { + int normalizedValue = [self normalizeValue: value forElement: element]; + [self ddhidJoystick: self stick: stick xChanged: normalizedValue]; + } + else if ([self findStick: &stick element: &element withYAxisCookie: cookie]) + { + int normalizedValue = [self normalizeValue: value forElement: element]; + [self ddhidJoystick: self stick: stick yChanged: normalizedValue]; + } + else if ([self findStick: &stick otherAxis: &otherAxis element: &element + withCookie: cookie]) + { + int normalizedValue = [self normalizeValue: value forElement: element]; + [self ddhidJoystick: self stick: stick + otherAxis: otherAxis valueChanged: normalizedValue]; + } + else if ([self findStick: &stick povNumber: &povNumber element: &element + withCookie: cookie]) + { + int povValue = [self povValue: value forElement: element]; + [self ddhidJoystick: self stick: stick + povNumber: povNumber valueChanged: povValue]; + } + else + { + unsigned i = 0; + for (i = 0; i < [[self buttonElements] count]; i++) + { + if (cookie == [[[self buttonElements] objectAtIndex: i] cookie]) + break; + } + + if (value == 1) + { + [self ddhidJoystick: self buttonDown: i]; + } + else if (value == 0) + { + [self ddhidJoystick: self buttonUp: i]; + } + else + { + DDHidElement * element = [self elementForCookie: [event elementCookie]]; + NSLog(@"Element: %@, value: %d", [[element usage] usageName], [event value]); + } + } + } +} + +- (int) normalizeValue: (int) value + forElement: (DDHidElement *) element; +{ + int normalizedUnits = DDHID_JOYSTICK_VALUE_MAX - DDHID_JOYSTICK_VALUE_MIN; + int elementUnits = [element maxValue] - [element minValue]; + + int normalizedValue = (((int64_t)(value - [element minValue]) * normalizedUnits) / + elementUnits) + DDHID_JOYSTICK_VALUE_MIN; + return normalizedValue; +} + +- (int) povValue: (int) value + forElement: (DDHidElement *) element; +{ + long max = [element maxValue]; + long min = [element minValue]; + + // If the value is outside the min/max range, it's probably in a + // centered/NULL state. + if ((value < min) || (value > max)) + { + return -1; + } + + // Do like DirectInput and express the hatswitch value in hundredths of a + // degree, clockwise from north. + return 36000 / (max - min + 1) * (value - min); +} + +- (BOOL) findStick: (unsigned *) stick + element: (DDHidElement **) elementOut + withXAxisCookie: (IOHIDElementCookie) cookie; +{ + unsigned i; + for (i = 0; i < [mSticks count]; i++) + { + DDHidElement * element = [[mSticks objectAtIndex: i] xAxisElement]; + if ((element != nil) && ([element cookie] == cookie)) + { + *stick = i; + *elementOut = element; + return YES; + } + } + return NO; +} + +- (BOOL) findStick: (unsigned *) stick + element: (DDHidElement **) elementOut + withYAxisCookie: (IOHIDElementCookie) cookie; +{ + unsigned i; + for (i = 0; i < [mSticks count]; i++) + { + DDHidElement * element = [[mSticks objectAtIndex: i] yAxisElement]; + if ((element != nil) && ([element cookie] == cookie)) + { + *stick = i; + *elementOut = element; + return YES; + } + } + return NO; +} + +- (BOOL) findStick: (unsigned *) stickOut + otherAxis: (unsigned *) axisOut + element: (DDHidElement **) elementOut + withCookie: (IOHIDElementCookie) cookie; +{ + unsigned i; + for (i = 0; i < [mSticks count]; i++) + { + DDHidJoystickStick * stick = [mSticks objectAtIndex: i]; + unsigned j; + for (j = 0; j < [stick countOfStickElements]; j++) + { + DDHidElement * element = [stick objectInStickElementsAtIndex: j]; + if ((element != nil) && ([element cookie] == cookie)) + { + *stickOut = i; + *axisOut = j; + *elementOut = element; + return YES; + } + } + } + return NO; +} + +- (BOOL) findStick: (unsigned *) stickOut + povNumber: (unsigned *) povNumber + element: (DDHidElement **) elementOut + withCookie: (IOHIDElementCookie) cookie; +{ + unsigned i; + for (i = 0; i < [mSticks count]; i++) + { + DDHidJoystickStick * stick = [mSticks objectAtIndex: i]; + unsigned j; + for (j = 0; j < [stick countOfPovElements]; j++) + { + DDHidElement * element = [stick objectInPovElementsAtIndex: j]; + if ((element != nil) && ([element cookie] == cookie)) + { + *stickOut = i; + *povNumber = j; + *elementOut = element; + return YES; + } + } + } + return NO; +} + +@end + +@implementation DDHidJoystick (DDHidJoystickDelegate) + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + xChanged: (int) value; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick stick: stick xChanged: value]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + yChanged: (int) value; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick stick: stick yChanged: value]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + otherAxis: (unsigned) otherAxis + valueChanged: (int) value; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick stick: stick otherAxis: otherAxis + valueChanged: value]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + stick: (unsigned) stick + povNumber: (unsigned) povNumber + valueChanged: (int) value; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick stick: stick povNumber: povNumber + valueChanged: value]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonDown: (unsigned) buttonNumber; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick buttonDown: buttonNumber]; +} + +- (void) ddhidJoystick: (DDHidJoystick *) joystick + buttonUp: (unsigned) buttonNumber; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidJoystick: joystick buttonUp: buttonNumber]; +} + +@end + +@implementation DDHidJoystickStick + +- (id) init +{ + self = [super init]; + if (self == nil) + return nil; + + mXAxisElement = nil; + mYAxisElement = nil; + mStickElements = [[NSMutableArray alloc] init]; + mPovElements = [[NSMutableArray alloc] init]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mXAxisElement release]; + [mYAxisElement release]; + [mStickElements release]; + [mPovElements release]; + + mXAxisElement = nil; + mYAxisElement = nil; + mStickElements = nil; + mPovElements = nil; + [super dealloc]; +} + +- (BOOL) addElement: (DDHidElement *) element; +{ + DDHidUsage * usage = [element usage]; + if ([usage usagePage] != kHIDPage_GenericDesktop) + return NO; + + BOOL elementAdded = YES; + switch ([usage usageId]) + { + case kHIDUsage_GD_X: + if (mXAxisElement == nil) + mXAxisElement = [element retain]; + else + [mStickElements addObject: element]; + break; + + case kHIDUsage_GD_Y: + if (mYAxisElement == nil) + mYAxisElement = [element retain]; + else + [mStickElements addObject: element]; + break; + + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + [mStickElements addObject: element]; + break; + + case kHIDUsage_GD_Hatswitch: + [mPovElements addObject: element]; + break; + + default: + elementAdded = NO; + + } + + return elementAdded; +} + +- (NSArray *) allElements; +{ + NSMutableArray * elements = [NSMutableArray array]; + if (mXAxisElement != nil) + [elements addObject: mXAxisElement]; + if (mYAxisElement != nil) + [elements addObject: mYAxisElement]; + [elements addObjectsFromArray: mStickElements]; + [elements addObjectsFromArray: mPovElements]; + return elements; +} + +- (DDHidElement *) xAxisElement; +{ + return mXAxisElement; +} + +- (DDHidElement *) yAxisElement; +{ + return mYAxisElement; +} + +#pragma mark - +#pragma mark mStickElements - indexed accessors + +- (unsigned int) countOfStickElements +{ + return [mStickElements count]; +} + +- (DDHidElement *) objectInStickElementsAtIndex: (unsigned int)index +{ + return [mStickElements objectAtIndex: index]; +} + +#pragma mark - +#pragma mark PovElements - indexed accessors + +- (unsigned int) countOfPovElements; +{ + return [mPovElements count]; +} + +- (DDHidElement *) objectInPovElementsAtIndex: (unsigned int)index; +{ + return [mPovElements objectAtIndex: index]; +} + +- (NSString *) description; +{ + return [mStickElements description]; +} + +@end diff --git a/lib/DDHidKeyboard.h b/lib/DDHidKeyboard.h new file mode 100644 index 0000000..fd9200d --- /dev/null +++ b/lib/DDHidKeyboard.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" + +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidKeyboard : DDHidDevice +{ + NSMutableArray * mKeyElements; + + id mDelegate; +} + ++ (NSArray *) allKeyboards; + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; + +#pragma mark - +#pragma mark Keyboards Elements + +- (NSArray *) keyElements; + +- (unsigned) numberOfKeys; + +- (void) addElementsToQueue: (DDHidQueue *) queue; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +@end + +@interface NSObject (DDHidKeyboardDelegate) + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyDown: (unsigned) usageId; + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyUp: (unsigned) usageId; + +@end diff --git a/lib/DDHidKeyboard.m b/lib/DDHidKeyboard.m new file mode 100644 index 0000000..7e37264 --- /dev/null +++ b/lib/DDHidKeyboard.m @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidKeyboard.h" +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#include + +@interface DDHidKeyboard (DDHidKeyboardDelegate) + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyDown: (unsigned) usageId; + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyUp: (unsigned) usageId; + +@end + +@interface DDHidKeyboard (Private) + +- (void) initKeyboardElements: (NSArray *) elements; +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +@end + +@implementation DDHidKeyboard + ++ (NSArray *) allKeyboards; +{ + return + [DDHidDevice allDevicesMatchingUsagePage: kHIDPage_GenericDesktop + usageId: kHIDUsage_GD_Keyboard + withClass: self + skipZeroLocations: YES]; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; +{ + self = [super initWithDevice: device error: error_]; + if (self == nil) + return nil; + + mKeyElements = [[NSMutableArray alloc] init]; + [self initKeyboardElements: [self elements]]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mKeyElements release]; + + mKeyElements = nil; + [super dealloc]; +} + +#pragma mark - +#pragma mark Keyboards Elements + +- (NSArray *) keyElements; +{ + return mKeyElements; +} + +- (unsigned) numberOfKeys; +{ + return [mKeyElements count]; +} + +- (void) addElementsToQueue: (DDHidQueue *) queue; +{ + [queue addElements: mKeyElements]; +} + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [self addElementsToQueue: mDefaultQueue]; +} + +@end + +@implementation DDHidKeyboard (DDHidKeyboardDelegate) + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyDown: (unsigned) usageId; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidKeyboard: keyboard keyDown: usageId]; +} + +- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard + keyUp: (unsigned) usageId; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidKeyboard: keyboard keyUp: usageId]; +} + +@end + +@implementation DDHidKeyboard (Private) + +- (void) initKeyboardElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + unsigned usagePage = [[element usage] usagePage]; + unsigned usageId = [[element usage] usageId]; + if (usagePage == kHIDPage_KeyboardOrKeypad) + { + if ((usageId >= 0x04) && (usageId <= 0xA4) || + (usageId >= 0xE0) && (usageId <= 0xE7)) + { + [mKeyElements addObject: element]; + } + } + NSArray * subElements = [element elements]; + if (subElements != nil) + [self initKeyboardElements: subElements]; + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + DDHidElement * element = [self elementForCookie: [event elementCookie]]; + unsigned usageId = [[element usage] usageId]; + SInt32 value = [event value]; + if (value == 1) + [self ddhidKeyboard: self keyDown: usageId]; + else + [self ddhidKeyboard: self keyUp: usageId]; + } +} + +@end diff --git a/lib/DDHidKeyboardBarcodeScanner.h b/lib/DDHidKeyboardBarcodeScanner.h new file mode 100644 index 0000000..8504343 --- /dev/null +++ b/lib/DDHidKeyboardBarcodeScanner.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007 Dave Dribin, Lucas Newman + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" + +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidKeyboardBarcodeScanner : DDHidDevice +{ + NSMutableArray * mKeyElements; + + NSMutableString * mAccumulatedDigits; + NSTimer *mBarcodeInputTimer; + BOOL mIsLikelyKeyboardBarcodeScanner; + + id mDelegate; +} + ++ (NSArray *) allPossibleKeyboardBarcodeScanners; + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; + +#pragma mark - +#pragma mark Keyboard Elements + +- (NSArray *) keyElements; + +- (unsigned) numberOfKeys; + +- (void) addElementsToQueue: (DDHidQueue *) queue; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +#pragma mark - +#pragma mark Properties + +- (BOOL) isLikelyKeyboardBarcodeScanner; + +@end + +@interface NSObject (DDHidKeyboardBarcodeScannerDelegate) + +- (void) ddhidKeyboardBarcodeScanner: (DDHidKeyboardBarcodeScanner *) keyboardBarcodeScanner + gotBarcode: (NSString *) barcode; + +@end diff --git a/lib/DDHidKeyboardBarcodeScanner.m b/lib/DDHidKeyboardBarcodeScanner.m new file mode 100644 index 0000000..8705cf3 --- /dev/null +++ b/lib/DDHidKeyboardBarcodeScanner.m @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2007 Dave Dribin, Lucas Newman + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidKeyboardBarcodeScanner.h" +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#include + +@interface DDHidKeyboardBarcodeScanner (DDHidKeyboardBarcodeDelegate) + +- (void) ddhidKeyboardBarcodeScanner: (DDHidKeyboardBarcodeScanner *) keyboardBarcodeScanner + gotBarcode: (NSString *) barcode; + +@end + +@interface DDHidKeyboardBarcodeScanner (Private) + +- (void) initKeyboardElements: (NSArray *) elements; +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +- (void) processBarcodeDigit: (unsigned) usageId; +- (void) clearAccumulatedInput; +- (void) invalidateBarcodeInputTimer; + +@end + +@implementation DDHidKeyboardBarcodeScanner + ++ (NSArray *) allPossibleKeyboardBarcodeScanners; +{ + return [DDHidDevice allDevicesMatchingUsagePage: kHIDPage_GenericDesktop + usageId: kHIDUsage_GD_Keyboard + withClass: self + skipZeroLocations: YES]; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; +{ + self = [super initWithDevice: device error: error_]; + if (self == nil) + return nil; + + mKeyElements = [[NSMutableArray alloc] init]; + mAccumulatedDigits = [[NSMutableString alloc] init]; + mBarcodeInputTimer = nil; + + if ([[self productName] rangeOfString:@"Apple"].location != NSNotFound || [[self productName] rangeOfString:@"Internal"].location != NSNotFound) + mIsLikelyKeyboardBarcodeScanner = NO; + else + mIsLikelyKeyboardBarcodeScanner = YES; // if we see invalid barcodes, we can change our mind + + [self initKeyboardElements: [self elements]]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [self invalidateBarcodeInputTimer]; + [mKeyElements release]; + [mAccumulatedDigits release]; + + mKeyElements = nil; + mAccumulatedDigits = nil; + [super dealloc]; +} + +#pragma mark - +#pragma mark Keyboard Elements + +- (NSArray *) keyElements; +{ + return mKeyElements; +} + +- (unsigned) numberOfKeys; +{ + return [mKeyElements count]; +} + +- (void) addElementsToQueue: (DDHidQueue *) queue; +{ + [queue addElements: mKeyElements]; +} + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [self addElementsToQueue: mDefaultQueue]; +} + +#pragma mark - +#pragma mark Properties + +- (BOOL) isLikelyKeyboardBarcodeScanner; +{ + return mIsLikelyKeyboardBarcodeScanner; +} + +@end + +@implementation DDHidKeyboardBarcodeScanner (DDHidKeyboardDelegate) + +- (void) ddhidKeyboardBarcodeScanner: (DDHidKeyboardBarcodeScanner *) keyboardBarcodeScanner + gotBarcode: (NSString *) barcode; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidKeyboardBarcodeScanner: keyboardBarcodeScanner gotBarcode: barcode]; +} + +@end + +@implementation DDHidKeyboardBarcodeScanner (Private) + +- (void) initKeyboardElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while ((element = [e nextObject])) + { + unsigned usagePage = [[element usage] usagePage]; + unsigned usageId = [[element usage] usageId]; + if (usagePage == kHIDPage_KeyboardOrKeypad) + { + if ((usageId >= kHIDUsage_KeyboardA) && (usageId <= kHIDUsage_Keyboard0)) + { + [mKeyElements addObject: element]; + } + } + NSArray * subElements = [element elements]; + if (subElements != nil) + [self initKeyboardElements: subElements]; + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + DDHidEvent * event; + while ((event = [hidQueue nextEvent])) + { + DDHidElement * element = [self elementForCookie: [event elementCookie]]; + unsigned usageId = [[element usage] usageId]; + SInt32 value = [event value]; + if (value == 1) // key down + [self processBarcodeDigit: usageId]; + } +} + +#define UPC_A_BARCODE_LENGTH (12) +#define BARCODE_INPUT_TIMEOUT (0.5) + +- (void) processBarcodeDigit: (unsigned) usageId; +{ + if (usageId <= kHIDUsage_KeyboardZ || usageId >= kHIDUsage_KeyboardCapsLock) { // an alphabetic key was pressed => probably not a barcode scanner + [self willChangeValueForKey:@"isLikelyKeyboardBarcodeScanner"]; + mIsLikelyKeyboardBarcodeScanner = NO; + [self didChangeValueForKey:@"isLikelyKeyboardBarcodeScanner"]; + + [self clearAccumulatedInput]; + return; + } + + if (!mBarcodeInputTimer) // schedule a timer to make sure we get the rest of the digits in a timely manner + mBarcodeInputTimer = [[NSTimer scheduledTimerWithTimeInterval:BARCODE_INPUT_TIMEOUT target:self selector:@selector(fireBarcodeInputTimeout:) userInfo:nil repeats:NO] retain]; + + [mAccumulatedDigits appendString:[NSString stringWithFormat:@"%d", (usageId + 1) % 10]]; +} + +- (void) fireBarcodeInputTimeout: (NSTimer *) timer; +{ + if ([mAccumulatedDigits length] >= UPC_A_BARCODE_LENGTH) + [self ddhidKeyboardBarcodeScanner: self gotBarcode: [[mAccumulatedDigits copy] autorelease]]; + [self clearAccumulatedInput]; +} + +- (void) clearAccumulatedInput; +{ + [mAccumulatedDigits deleteCharactersInRange:NSMakeRange(0, [mAccumulatedDigits length])]; + + [self invalidateBarcodeInputTimer]; +} + +- (void) invalidateBarcodeInputTimer; +{ + [mBarcodeInputTimer invalidate]; + [mBarcodeInputTimer release]; + mBarcodeInputTimer = nil; +} + +@end diff --git a/lib/DDHidLib.h b/lib/DDHidLib.h new file mode 100644 index 0000000..20d8681 --- /dev/null +++ b/lib/DDHidLib.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidDevice.h" +#import "DDHidElement.h" +#import "DDHidUsage.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#import "DDHidUsageTables.h" +#import "DDHidMouse.h" +#import "DDHidJoystick.h" +#import "DDHidKeyboard.h" +#import "DDHidAppleRemote.h" +#import "DDHidAppleMikey.h" +#import "DDHidKeyboardBarcodeScanner.h" diff --git a/lib/DDHidMouse.h b/lib/DDHidMouse.h new file mode 100644 index 0000000..d396aba --- /dev/null +++ b/lib/DDHidMouse.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#import "DDHidDevice.h" + +@class DDHidElement; +@class DDHidQueue; + +@interface DDHidMouse : DDHidDevice +{ + DDHidElement * mXElement; + DDHidElement * mYElement; + DDHidElement * mWheelElement; + NSMutableArray * mButtonElements; + + id mDelegate; +} + ++ (NSArray *) allMice; + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; + +#pragma mark - +#pragma mark Mouse Elements + +- (DDHidElement *) xElement; + +- (DDHidElement *) yElement; + +- (DDHidElement *) wheelElement; + +- (NSArray *) buttonElements; + +- (unsigned) numberOfButtons; + +- (void) addElementsToQueue: (DDHidQueue *) queue; + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; + +- (void) addElementsToDefaultQueue; + +@end + +@interface NSObject (DDHidMouseDelegate) + +- (void) ddhidMouse: (DDHidMouse *) mouse xChanged: (SInt32) deltaX; +- (void) ddhidMouse: (DDHidMouse *) mouse yChanged: (SInt32) deltaY; +- (void) ddhidMouse: (DDHidMouse *) mouse wheelChanged: (SInt32) deltaWheel; +- (void) ddhidMouse: (DDHidMouse *) mouse buttonDown: (unsigned) buttonNumber; +- (void) ddhidMouse: (DDHidMouse *) mouse buttonUp: (unsigned) buttonNumber; + +@end + diff --git a/lib/DDHidMouse.m b/lib/DDHidMouse.m new file mode 100644 index 0000000..7eeb5b3 --- /dev/null +++ b/lib/DDHidMouse.m @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidMouse.h" +#import "DDHidUsage.h" +#import "DDHidElement.h" +#import "DDHidQueue.h" +#import "DDHidEvent.h" +#include + + +// Implement our own delegate methods + +@interface DDHidMouse (DDHidMouseDelegate) + +- (void) ddhidMouse: (DDHidMouse *) mouse xChanged: (SInt32) deltaX; +- (void) ddhidMouse: (DDHidMouse *) mouse yChanged: (SInt32) deltaY; +- (void) ddhidMouse: (DDHidMouse *) mouse wheelChanged: (SInt32) deltaWheel; +- (void) ddhidMouse: (DDHidMouse *) mouse buttonDown: (unsigned) buttonNumber; +- (void) ddhidMouse: (DDHidMouse *) mouse buttonUp: (unsigned) buttonNumber; + +@end + +@interface DDHidMouse (Private) + +- (void) initMouseElements: (NSArray *) elements; +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +@end + +@implementation DDHidMouse + ++ (NSArray *) allMice; +{ + return + [DDHidDevice allDevicesMatchingUsagePage: kHIDPage_GenericDesktop + usageId: kHIDUsage_GD_Mouse + withClass: self + skipZeroLocations: YES]; +} + +- (id) initWithDevice: (io_object_t) device error: (NSError **) error_; +{ + self = [super initWithDevice: device error: error_]; + if (self == nil) + return nil; + + mXElement = mYElement = mWheelElement = nil; + mButtonElements = [[NSMutableArray alloc] init]; + [self initMouseElements: [self elements]]; + + return self; +} + +//=========================================================== +// dealloc +//=========================================================== +- (void) dealloc +{ + [mXElement release]; + [mYElement release]; + [mWheelElement release]; + [mButtonElements release]; + + mXElement = nil; + mYElement = nil; + mWheelElement = nil; + mButtonElements = nil; + [super dealloc]; +} + +#pragma mark - +#pragma mark Mouse Elements + +//=========================================================== +// - xElement +//=========================================================== +- (DDHidElement *) xElement +{ + return mXElement; +} + +//=========================================================== +// - yElement +//=========================================================== +- (DDHidElement *) yElement +{ + return mYElement; +} + +- (DDHidElement *) wheelElement; +{ + return mWheelElement; +} + +//=========================================================== +// - buttonElements +//=========================================================== +- (NSArray *) buttonElements; +{ + return mButtonElements; +} + +- (unsigned) numberOfButtons; +{ + return [mButtonElements count]; +} + +- (void) addElementsToQueue: (DDHidQueue *) queue; +{ + [queue addElement: mXElement]; + [queue addElement: mYElement]; + [queue addElement: mWheelElement]; + [queue addElements: mButtonElements]; +} + + +#pragma mark - +#pragma mark Asynchronous Notification + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) addElementsToDefaultQueue; +{ + [self addElementsToQueue: mDefaultQueue]; +} + +@end + +@implementation DDHidMouse (DDHidMouseDelegate) + +- (void) ddhidMouse: (DDHidMouse *) mouse xChanged: (SInt32) deltaX; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidMouse: mouse xChanged: deltaX]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse yChanged: (SInt32) deltaY; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidMouse: mouse yChanged: deltaY]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse wheelChanged: (SInt32) deltaWheel; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidMouse: mouse wheelChanged: deltaWheel]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse buttonDown: (unsigned) buttonNumber; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidMouse: mouse buttonDown: buttonNumber]; +} + +- (void) ddhidMouse: (DDHidMouse *) mouse buttonUp: (unsigned) buttonNumber; +{ + if ([mDelegate respondsToSelector: _cmd]) + [mDelegate ddhidMouse: mouse buttonUp: buttonNumber]; +} + +@end + +@implementation DDHidMouse (Private) + +- (void) initMouseElements: (NSArray *) elements; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + unsigned usagePage = [[element usage] usagePage]; + unsigned usageId = [[element usage] usageId]; + if ((usagePage == kHIDPage_GenericDesktop) && + (usageId == kHIDUsage_GD_X)) + { + mXElement = [element retain]; + } + else if ((usagePage == kHIDPage_GenericDesktop) && + (usageId == kHIDUsage_GD_Y)) + { + mYElement = [element retain]; + } + else if ((usagePage == kHIDPage_GenericDesktop) && + (usageId == kHIDUsage_GD_Wheel)) + { + mWheelElement = [element retain]; + } + else if ((usagePage == kHIDPage_Button) && + (usageId > 0)) + { + [mButtonElements addObject: element]; + } + NSArray * subElements = [element elements]; + if (subElements != nil) + [self initMouseElements: subElements]; + } +} + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; +{ + DDHidEvent * event; + while (event = [hidQueue nextEvent]) + { + IOHIDElementCookie cookie = [event elementCookie]; + SInt32 value = [event value]; + if (cookie == [[self xElement] cookie]) + { + if (value != 0) + { + [self ddhidMouse: self xChanged: value]; + } + } + else if (cookie == [[self yElement] cookie]) + { + if (value != 0) + { + [self ddhidMouse: self yChanged: value]; + } + } + else if (cookie == [[self wheelElement] cookie]) + { + if (value != 0) + { + [self ddhidMouse: self wheelChanged: value]; + } + } + else + { + unsigned i = 0; + for (i = 0; i < [[self buttonElements] count]; i++) + { + if (cookie == [[[self buttonElements] objectAtIndex: i] cookie]) + break; + } + + if (value == 1) + { + [self ddhidMouse: self buttonDown: i]; + } + else if (value == 0) + { + [self ddhidMouse: self buttonUp: i]; + } + else + { + DDHidElement * element = [self elementForCookie: [event elementCookie]]; + NSLog(@"Element: %@, value: %d", [[element usage] usageName], [event value]); + } + } + } +} + +@end + diff --git a/lib/DDHidQueue.h b/lib/DDHidQueue.h new file mode 100644 index 0000000..315d003 --- /dev/null +++ b/lib/DDHidQueue.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import +#include + +@class DDHidElement; +@class DDHidEvent; + +@interface DDHidQueue : NSObject +{ + IOHIDQueueInterface ** mQueue; + NSRunLoop * mRunLoop; + BOOL mStarted; + + id mDelegate; + CFRunLoopSourceRef mEventSource; +} + +- (id) initWithHIDQueue: (IOHIDQueueInterface **) queue + size: (unsigned) size; + +- (void) addElement: (DDHidElement *) element; + +- (void) addElements: (NSArray *) elements; + +- (void) addElements: (NSArray *) elements recursively: (BOOL) recursively; + +- (void) setDelegate: (id) delegate; + +- (void) startOnCurrentRunLoop; + +- (void) startOnRunLoop: (NSRunLoop *) runLoop; + +- (void) stop; + +- (BOOL) isStarted; + +- (BOOL) getNextEvent: (IOHIDEventStruct *) event; + +- (DDHidEvent *) nextEvent; + +@end + +@interface NSObject (DDHidQueueDelegate) + +- (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue; + +@end diff --git a/lib/DDHidQueue.m b/lib/DDHidQueue.m new file mode 100644 index 0000000..8f44698 --- /dev/null +++ b/lib/DDHidQueue.m @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidQueue.h" +#import "DDHidElement.h" +#import "DDHIdEvent.h" +#import "NSXReturnThrowError.h" + +static void queueCallbackFunction(void* target, IOReturn result, void* refcon, + void* sender); + +@interface DDHidQueue (Private) + +- (void) handleQueueCallback; + +@end + +@implementation DDHidQueue + +- (id) initWithHIDQueue: (IOHIDQueueInterface **) queue + size: (unsigned) size; +{ + self = [super init]; + if (self == nil) + return nil; + + mQueue = queue; + IOReturn result = (*mQueue)->create(mQueue, 0, size); + if (result != kIOReturnSuccess) + { + [self release]; + return nil; + } + + return self; +} + +- (void) dealloc; +{ + [self stop]; + (*mQueue)->dispose(mQueue); + (*mQueue)->Release(mQueue); + [super dealloc]; +} + +- (void) addElement: (DDHidElement *) element; +{ + IOHIDElementCookie cookie = [element cookie]; + (*mQueue)->addElement(mQueue, cookie, 0); +} + +- (void) addElements: (NSArray *) elements; +{ + return [self addElements: elements recursively: NO]; +} + +- (void) addElements: (NSArray *) elements recursively: (BOOL) recursively; +{ + NSEnumerator * e = [elements objectEnumerator]; + DDHidElement * element; + while (element = [e nextObject]) + { + [self addElement: element]; + if (recursively) + [self addElements: [element elements]]; + } +} + +- (void) setDelegate: (id) delegate; +{ + mDelegate = delegate; +} + +- (void) startOnCurrentRunLoop; +{ + [self startOnRunLoop: [NSRunLoop currentRunLoop]]; +} + +- (void) startOnRunLoop: (NSRunLoop *) runLoop; +{ + if (mStarted) + return; + + mRunLoop = [runLoop retain]; + + NSXThrowError((*mQueue)->createAsyncEventSource(mQueue, &mEventSource)); + NSXThrowError((*mQueue)->setEventCallout(mQueue, queueCallbackFunction, self, NULL)); + CFRunLoopAddSource([mRunLoop getCFRunLoop], mEventSource, + kCFRunLoopDefaultMode); + (*mQueue)->start(mQueue); + mStarted = YES; +} + +- (void) stop; +{ + if (!mStarted) + return; + + CFRunLoopRemoveSource([mRunLoop getCFRunLoop], mEventSource, kCFRunLoopDefaultMode); + (*mQueue)->stop(mQueue); + [mRunLoop release]; + mRunLoop = nil; + mStarted = NO; +} + +- (BOOL) isStarted; +{ + return mStarted; +} + +- (BOOL) getNextEvent: (IOHIDEventStruct *) event; +{ + AbsoluteTime zeroTime = {0, 0}; + IOReturn result = (*mQueue)->getNextEvent(mQueue, event, zeroTime, 0); + return (result == kIOReturnSuccess); +} + +- (DDHidEvent *) nextEvent; +{ + AbsoluteTime zeroTime = {0, 0}; + IOHIDEventStruct event; + IOReturn result = (*mQueue)->getNextEvent(mQueue, &event, zeroTime, 0); + if (result != kIOReturnSuccess) + return nil; + else + return [DDHidEvent eventWithIOHIDEvent: &event]; +} + +@end + +@implementation DDHidQueue (Private) + +- (void) handleQueueCallback; +{ + if ([mDelegate respondsToSelector: @selector(ddhidQueueHasEvents:)]) + { + [mDelegate ddhidQueueHasEvents: self]; + } +} + +@end + +static void queueCallbackFunction(void* target, IOReturn result, void* refcon, + void* sender) +{ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + DDHidQueue * queue = (DDHidQueue *) target; + [queue handleQueueCallback]; + [pool release]; + +} diff --git a/lib/DDHidStandardUsages.plist b/lib/DDHidStandardUsages.plist new file mode 100644 index 0000000..84eb663 --- /dev/null +++ b/lib/DDHidStandardUsages.plist @@ -0,0 +1,2327 @@ + + + + + 1 + + description + Generic Desktop + ranges + + + usages + + 0 + Undefined + 1 + Pointer + 2 + Mouse + 3 + Reserved + 4 + Joystick + 5 + Game Pad + 6 + Keyboard + 7 + Keypad + 8 + Multi-axis Controller + 48 + X + 49 + Y + 50 + Z + 51 + Rx + 52 + Ry + 53 + Rz + 54 + Slider + 55 + Dial + 56 + Wheel + 57 + Hat Switch + 58 + Counted Buffer + 59 + Byte Count + 60 + Motion Wakeup + 64 + Vx + 65 + Vy + 66 + Vz + 67 + Vbrx + 68 + Vbry + 69 + Vbrx + 70 + Vno + 128 + System Control + 129 + System Power Down + 130 + System Sleep + 131 + System Wake Up + 132 + System Context Menu + 133 + System Main Menu + 134 + System App Menu + 135 + System Menu Help + 136 + System Menu Exit + 137 + System Menu Select + 138 + System Menu Right + 139 + System Menu Left + 140 + System Menu Up + 141 + System Menu Down + 144 + D-pad Up + 145 + D-pad Down + 146 + D-pad Right + 147 + D-pad Left + + + 2 + + description + Simulation Controls + ranges + + + usages + + 0 + Undefined + 1 + Flight Simulation Device + 2 + Automobile Simulation Device + 3 + Tank Simulation Device + 4 + Spaceship Simulation Device + 5 + Submarine Simulation Device + 6 + Sailing Simulation Device + 7 + Motorcycle Simulation Device + 8 + Sports Simulation Device + 9 + Airplane Simulation Device + 10 + Helicopter Simulation Device + 11 + Magic Carpet Simulation Device + 12 + Bicycle + 32 + Flight Control Stick + 33 + Flight Stick + 34 + Cyclic Control + 35 + Cyclic Trim + 36 + Flight Yoke + 37 + Track Control + 38 + Driving Control + 176 + Aileron + 177 + Aileron Trim + 178 + Anti-Torque Control + 179 + Auto-pilot Enable + 180 + Chaff Release + 181 + Collective Control + 182 + Dive Brake + 183 + Electronic Counter Measures + 184 + Elevator + 185 + Elevator Trim + 186 + Rudder + 187 + Throttle + 188 + Flight Communication + 189 + Flare Release + 190 + Landing Gear + 191 + Toe Brake + 192 + Trigger + 193 + Weapons Arm + 194 + Weapons Select + 195 + Wing Flaps + 196 + Accelerator + 197 + Brake + 198 + Clutch + 199 + Shifter + 200 + Steering + 201 + Turret Direction + 202 + Barrel Elevation + 203 + Dive Plane + 204 + Ballast + 205 + Bicycle Crank + 206 + Handle Bars + 207 + Front Brake + 208 + Rear Brake + + + 3 + + description + VR Controls + ranges + + + usages + + 0 + Unidentified + 1 + Belt + 2 + Body Suit + 3 + Flexor + 4 + Glove + 5 + Head Tracker + 6 + Head Mounted Display + 7 + Hand Tracker + 8 + Oculometer + 9 + Vest + 10 + Animatronic Device + 32 + Stereo Enable + 33 + Display Enable + + + 4 + + description + Sports Controls + ranges + + + usages + + 0 + Unidentified + 1 + Baseball Bat + 2 + Golf Club + 3 + Rowing Machine + 4 + Treadmill + 48 + Oar + 49 + Slope + 50 + Rate + 51 + Stick Speed + 52 + Stick Face Angle + 53 + Stick Heel/Toe + 54 + Stick Follow Through + 55 + Stick Tempo + 56 + Stick Type + 57 + Stick Height + 80 + Putter + 81 + 1 Iron + 82 + 2 Iron + 83 + 3 Iron + 84 + 4 Iron + 85 + 5 Iron + 86 + 6 Iron + 87 + 7 Iron + 88 + 8 Iron + 89 + 9 Iron + 90 + 10 Iron + 91 + 11 Iron + 92 + Sand Wedge + 93 + Loft Wedge + 94 + Power Wedge + 95 + 1 Wood + 96 + 3 Wood + 97 + 5 Wood + 98 + 7 Wood + 99 + 9 Wood + + + 5 + + description + Game Controls + ranges + + + usages + + 0 + Undefined + 1 + 3D Game Controller + 2 + Pinball Device + 3 + Gun Device + 32 + Point of View + 33 + Turn Right/Left + 34 + Pitch Right/Left + 35 + Roll Forward/Backward + 36 + Move Right/Left + 37 + Move Forward/Backward + 38 + Move Up/Down + 39 + Lean Right/Left + 40 + Lean Forward/Backward + 41 + Height of POV + 42 + Flipper + 43 + Secondary Flipper + 44 + Bump + 45 + New Game + 46 + Shoot Ball + 47 + Player + 48 + Gun Bolt + 49 + Gun Clip + 50 + Gun Selector + 51 + Gun Single Shot + 52 + Gun Burst + 53 + Gun Automatic + 54 + Gun Safety + 55 + Gamepad Fire/Jump + 57 + Gamepad Trigger + + + 7 + + description + Keyboard + ranges + + + usages + + 0 + No Event + 1 + Keyboard ErrorRollOver + 2 + Keyboard POSTFail + 3 + Keyboard ErrorUndefined + 4 + Keyboard a and A + 5 + Keyboard b and B + 6 + Keyboard c and C + 7 + Keyboard d and D + 8 + Keyboard e and E + 9 + Keyboard f and F + 10 + Keyboard g and G + 11 + Keyboard h and H + 12 + Keyboard i and I + 13 + Keyboard j and J + 14 + Keyboard k and K + 15 + Keyboard l and L + 16 + Keyboard m and M + 17 + Keyboard n and N + 18 + Keyboard o and O + 19 + Keyboard p and P + 20 + Keyboard q and Q + 21 + Keyboard r and R + 22 + Keyboard s and S + 23 + Keyboard t and T + 24 + Keyboard u and U + 25 + Keyboard v and V + 26 + Keyboard w and W + 27 + Keyboard x and X + 28 + Keyboard y and Y + 29 + Keyboard z and Z + 30 + Keyboard 1 and ! + 31 + Keyboard 2 and @ + 32 + Keyboard 3 and # + 33 + Keyboard 4 and $ + 34 + Keyboard 5 and % + 35 + Keyboard 6 and ^ + 36 + Keyboard 7 and & + 37 + Keyboard 8 and * + 38 + Keyboard 9 and ( + 39 + Keyboard 0 and ) + 40 + Keyboard Return (ENTER) + 41 + Keyboard ESCAPE + 42 + Keyboard DELETE (Backspace) + 43 + Keyboard Tab + 44 + Keyboard Spacebar + 45 + Keyboard - and (underscore) + 46 + Keyboard = and + + 47 + Keyboard [ and { + 48 + Keyboard ] and } + 49 + Keyboard \ and | + 50 + Keyboard Non-US # and ~ + 51 + Keyboard ; and : + 52 + Keyboard ' and " + 53 + Keyboard Grave Accent and Tilde + 54 + Keyboard, and < + 55 + Keyboard . and > + 56 + Keyboard / and ? + 57 + Keyboard Caps Lock + 58 + Keyboard F1 + 59 + Keyboard F2 + 60 + Keyboard F3 + 61 + Keyboard F4 + 62 + Keyboard F5 + 63 + Keyboard F6 + 64 + Keyboard F7 + 65 + Keyboard F8 + 66 + Keyboard F9 + 67 + Keyboard F10 + 68 + Keyboard F11 + 69 + Keyboard F12 + 70 + Keyboard PrintScreen + 71 + Keyboard Scroll Lock + 72 + Keyboard Pause + 73 + Keyboard Insert + 74 + Keyboard Home + 75 + Keyboard PageUp + 76 + Keyboard Delete Forward + 77 + Keyboard End + 78 + Keyboard PageDown + 79 + Keyboard RightArrow + 80 + Keyboard LeftArrow + 81 + Keyboard DownArrow + 82 + Keyboard UpArrow + 83 + Keypad Num Lock and Clear + 84 + Keypad / + 85 + Keypad * + 86 + Keypad - + 87 + Keypad + + 88 + Keypad ENTER + 89 + Keypad 1 and End + 90 + Keypad 2 and Down Arrow + 91 + Keypad 3 and PageDn + 92 + Keypad 4 and Left Arrow + 93 + Keypad 5 + 94 + Keypad 6 and Right Arrow + 95 + Keypad 7 and Home + 96 + Keypad 8 and Up Arrow + 97 + Keypad 9 and PageUp + 98 + Keypad 0 and Insert + 99 + Keypad . and Delete + 100 + Keyboard Non-US \ and | + 101 + Keyboard Application + 102 + Keyboard Power + 103 + Keypad = + 104 + Keyboard F13 + 105 + Keyboard F14 + 106 + Keyboard F15 + 107 + Keyboard F16 + 108 + Keyboard F17 + 109 + Keyboard F18 + 110 + Keyboard F19 + 111 + Keyboard F20 + 112 + Keyboard F21 + 113 + Keyboard F22 + 114 + Keyboard F23 + 115 + Keyboard F24 + 116 + Keyboard Execute + 117 + Keyboard Help + 118 + Keyboard Menu + 119 + Keyboard Select + 120 + Keyboard Stop + 121 + Keyboard Again + 122 + Keyboard Undo + 123 + Keyboard Cut + 124 + Keyboard Copy + 125 + Keyboard Paste + 126 + Keyboard Find + 127 + Keyboard Mute + 128 + Keyboard Volume Up + 129 + Keyboard Volume Down + 130 + Keyboard Locking Caps Lock + 131 + Keyboard Locking Num Lock + 132 + Keyboard Locking Scroll Lock + 133 + Keypad Comma + 134 + Keypad Equal Sign + 135 + Keyboard International1 + 136 + Keyboard International2 + 137 + Keyboard International3 + 138 + Keyboard International4 + 139 + Keyboard International5 + 140 + Keyboard International6 + 141 + Keyboard International7 + 142 + Keyboard International8 + 143 + Keyboard International9 + 144 + Keyboard LANG1 + 145 + Keyboard LANG2 + 146 + Keyboard LANG3 + 147 + Keyboard LANG4 + 148 + Keyboard LANG5 + 149 + Keyboard LANG6 + 150 + Keyboard LANG7 + 151 + Keyboard LANG8 + 152 + Keyboard LANG9 + 153 + Keyboard Alternate Erase + 154 + Keyboard SysReq/Attention + 155 + Keyboard Cancel + 156 + Keyboard Clear + 157 + Keyboard Prior + 158 + Keyboard Return + 159 + Keyboard Separator + 160 + Keyboard Out + 161 + Keyboard Oper + 162 + Keyboard Clear/Again + 163 + Keyboard CrSel/Props + 164 + Keyboard ExSel + 224 + Keyboard LeftControl + 225 + Keyboard LeftShift + 226 + Keyboard LeftAlt + 227 + Keyboard Left GUI + 228 + Keyboard RightControl + 229 + Keyboard RightShift + 230 + Keyboard RightAlt + 231 + Keyboard Right GUI + + + 8 + + description + LEDs + ranges + + {76, 65535} + Reserved + + usages + + 0 + Undefined + 1 + Num Lock + 2 + Caps Lock + 3 + Scroll Lock + 4 + Compose + 5 + Kana + 6 + Power + 7 + Shift + 8 + Do Not Disturb + 9 + Mute + 10 + Tone Enable + 11 + High Cut Filter + 12 + Low Cut Filter + 13 + Equalizer Enable + 14 + Sound Field On + 15 + Surround Field On + 16 + Repeat + 17 + Stereo + 18 + Sampling Rate Detect + 19 + Spinning + 20 + CAV + 21 + CLV + 22 + Recording Format Detect + 23 + Off-Hook + 24 + Ring + 25 + Message Waiting + 26 + Data Mode + 27 + Battery Operation + 28 + Battery OK + 29 + Battery Low + 30 + Speaker + 31 + Head Set + 32 + Hold + 33 + Microphone + 34 + Coverage + 35 + Night Mode + 36 + Send Calls + 37 + Call Pickup + 38 + Conference + 39 + Stand-by + 40 + Camera On + 41 + Camera Off + 42 + On-Line + 43 + Off-Line + 44 + Busy + 45 + Ready + 46 + Paper-Out + 47 + Paper-Jam + 48 + Remote + 49 + Forward + 50 + Reverse + 51 + Stop + 52 + Rewind + 53 + Fast Forward + 54 + Play + 55 + Pause + 56 + Record + 57 + Error + 58 + Usage Selected Indicator + 59 + Usage In Use Indicator + 60 + Usage Multi Mode Indicator + 61 + Indicator On + 62 + Indicator Flash + 63 + Indicator Slow Blink + 64 + Indicator Fast Blink + 65 + Indicator Off + 66 + Flash On Time + 67 + Slow Blink On Time + 68 + Slow Blink Off Time + 69 + Fast Blink On Time + 70 + Fast Blink Off Time + 71 + Usage Indicator Color + 72 + Red + 73 + Green + 74 + Amber + 75 + Generic Indicator + 76 + System Suspend + 77 + External Power Connected + + + 9 + + default + Button %d + description + Button + ranges + + + usages + + 0 + No Button Pressed + + + 10 + + default + Instance %d + description + Ordinal + ranges + + + usages + + 0 + Unused + + + 11 + + description + Telephony + ranges + + + usages + + 0 + Unassigned + 1 + Phone + 2 + Answering Machine + 3 + Message Controls + 4 + Handset + 5 + Headset + 6 + Telephony Key Pad + 7 + Programmable Button + 32 + Hook Switch + 33 + Flash + 34 + Feature + 35 + Hold + 36 + Redial + 37 + Transfer + 38 + Drop + 39 + Park + 40 + Forward Calls + 41 + Alternate Function + 42 + Line + 43 + Speaker Phone + 44 + Conference + 45 + Ring Enable + 46 + Ring Select + 47 + Phone Mute + 48 + Caller ID + 80 + Speed Dial + 81 + Store Number + 82 + Recall Number + 83 + Phone Directory + 112 + Voice Mail + 113 + Screen Calls + 114 + Do Not Disturb + 115 + Message + 116 + Answer On/Off + 144 + Inside Dial Tone + 145 + Outside Dial Tone + 146 + Inside Ring Tone + 147 + Outside Ring Tone + 148 + Priority Ring Tone + 149 + Inside Ringback + 150 + Priority Ringback + 151 + Line Busy Tone + 152 + Reorder Tone + 153 + Call Waiting Tone + 154 + Confirmation Tone 1 + 155 + Confirmation Tone 2 + 156 + Tones Off + 176 + Phone Key 0 + 177 + Phone Key 1 + 178 + Phone Key 2 + 179 + Phone Key 3 + 180 + Phone Key 4 + 181 + Phone Key 5 + 182 + Phone Key 6 + 183 + Phone Key 7 + 184 + Phone Key 8 + 185 + Phone Key 9 + 186 + Phone Key Star + 187 + Phone Key Pound + 188 + Phone Key A + 189 + Phone Key B + 190 + Phone Key C + 191 + Phone Key D + + + 12 + + description + Consumer + ranges + + + usages + + 0 + Unassigned + 1 + Consumer Control + 2 + Numeric Key Pad + 3 + Programmable Buttons + 32 + +10 + 33 + +100 + 34 + AM/PM + 48 + Power + 49 + Reset + 50 + Sleep + 51 + Sleep After + 52 + Sleep Mode + 53 + Illumination + 54 + Function Buttons + 64 + Menu + 65 + Menu Pick + 66 + Menu Up + 67 + Menu Down + 68 + Menu Left + 69 + Menu Right + 70 + Menu Escape + 71 + Menu Value Increase + 72 + Menu Value Decrease + 96 + Data On Screen + 97 + Closed Caption + 98 + Closed Caption Select + 99 + VCR/TV + 100 + Broadcast Mode + 101 + Snapshot + 102 + Still + 128 + Selection + 129 + Assign Selection + 130 + Mode Step + 131 + Recall Last + 132 + Enter Channel + 133 + Order Movie + 134 + Channel + 135 + Media Selection + 136 + Media Select Computer + 137 + Media Select TV + 138 + Media Select WWW + 139 + Media Select DVD + 140 + Media Select Telephone + 141 + Media Select Program Guide + 142 + Media Select Video Phone + 143 + Media Select Games + 144 + Media Select Messages + 145 + Media Select CD + 146 + Media Select VCR + 147 + Media Select Tuner + 148 + Quit + 149 + Help + 150 + Media Select Tape + 151 + Media Select Cable + 152 + Media Select Satellite + 153 + Media Select Security + 154 + Media Select Home + 155 + Media Select Call + 156 + Channel Increment + 157 + Channel Decrement + 158 + Media Select SAP + 160 + VCR Plus + 161 + Once + 162 + Daily + 163 + Weekly + 164 + Monthly + 176 + Play + 177 + Pause + 178 + Record + 179 + Fast Forward + 180 + Rewind + 181 + Scan Next Track + 182 + Scan Previous Track + 183 + Stop + 184 + Eject + 185 + Random Play + 186 + Select DisC + 187 + Enter Disc + 188 + Repeat + 189 + Tracking + 190 + Track Normal + 191 + Slow Tracking + 192 + Frame Forward + 193 + Frame Back + 194 + Mark + 195 + Clear Mark + 196 + Repeat From Mark + 197 + Return To Mark + 198 + Search Mark Forward + 199 + Search Mark Backwards + 200 + Counter Reset + 201 + Show Counter + 202 + Tracking Increment + 203 + Tracking Decrement + 205 + Pause/Play + 224 + Volume + 225 + Balance + 226 + Mute + 227 + Bass + 228 + Treble + 229 + Bass Boost + 230 + Surround Mode + 231 + Loudness + 232 + MPX + 233 + Volume Up + 234 + Volume Down + 240 + Speed Select + 241 + Playback Speed + 242 + Standard Play + 243 + Long Play + 244 + Extended Play + 245 + Slow + 256 + Fan Enable + 257 + Fan Speed + 258 + Light + 259 + Light Illumination Level + 260 + Climate Control Enable + 261 + Room Temperature + 262 + Security Enable + 263 + Fire Alarm + 264 + Police Alarm + 336 + Balance Right + 337 + Balance Left + 338 + Bass Increment + 339 + Bass Decrement + 340 + Treble Increment + 341 + Treble Decrement + 352 + Speaker System + 353 + Channel Left + 354 + Channel Right + 355 + Channel Center + 356 + Channel Front + 357 + Channel Center Front + 358 + Channel Side + 359 + Channel Surround + 360 + Channel Low Frequency Enhancement + 361 + Channel Top + 362 + Channel Unknown + 368 + Sub-channel + 369 + Sub-channel Increment + 370 + Sub-channel Decrement + 371 + Alternate Audio Increment + 372 + Alternate Audio Decrement + 384 + Application Launch Buttons + 385 + AL Launch Button Configuration Tool + 386 + AL Programmable Button Configuration + 387 + AL Consumer Control Configuration + 388 + AL Word Processor + 389 + AL Text Editor + 390 + AL Spreadsheet + 391 + AL Graphics Editor + 392 + AL Presentation App + 393 + AL Database App + 394 + AL Email Reader + 395 + AL Newsreader + 396 + AL Voicemail + 397 + AL Contacts/Address Book + 398 + AL Calendar/Schedule + 399 + AL Task/Project Manager + 400 + AL Log/Journal/Timecard + 401 + AL Checkbook/Finance + 402 + AL Calculator + 403 + AL A/V Capture/Playback + 404 + AL Local Machine Browser + 405 + AL LAN/WAN Browser + 406 + AL Internet Browser + 407 + AL Remote Networking/ISP Connect + 408 + AL Network Conference + 409 + AL Network Chat + 410 + AL Telephony/Dialer + 411 + AL Logon + 412 + AL Logoff + 413 + AL Logon/Logoff + 414 + AL Terminal Lock/Screensaver + 415 + AL Control Panel + 416 + AL Command Line Processor/Run + 417 + AL Process/Task Manager + 418 + AL Select Tast/Application + 419 + AL Next Task/Application + 420 + AL Previous Task/Application + 421 + AL Preemptive Halt Task/Application + 423 + AL My Documents + 427 + AC Spell + 438 + AL My Pictures + 439 + AL My Music + 512 + Generic GUI Application Controls + 513 + AC New + 514 + AC Open + 515 + AC Close + 516 + AC Exit + 517 + AC Maximize + 518 + AC Minimize + 519 + AC Save + 520 + AC Print + 521 + AC Properties + 538 + AC Undo + 539 + AC Copy + 540 + AC Cut + 541 + AC Paste + 542 + AC Select All + 543 + AC Find + 544 + AC Find and Replace + 545 + AC Search + 546 + AC Go To + 547 + AC Home + 548 + AC Back + 549 + AC Forward + 550 + AC Stop + 551 + AC Refresh + 552 + AC Previous Link + 553 + AC Next Link + 554 + AC Bookmarks + 555 + AC History + 556 + AC Subscriptions + 557 + AC Zoom In + 558 + AC Zoom Out + 559 + AC Zoom + 560 + AC Full Screen View + 561 + AC Normal View + 562 + AC View Toggle + 563 + AC Scroll Up + 564 + AC Scroll Down + 565 + AC Scroll + 566 + AC Pan Left + 567 + AC Pan Right + 568 + AC Pan + 569 + AC New Window + 570 + AC Tile Horizontally + 571 + AC Tile Vertically + 572 + AC Format + 633 + AC Redo + 649 + AC Reply + 651 + AC Fwd + 652 + AC Send + + + 13 + + description + Digitizer + ranges + + + usages + + 0 + Undefined + 1 + Digitizer + 2 + Pen + 3 + Light Pen + 4 + Touch Screen + 5 + Touch Pad + 6 + White Board + 7 + Coordinate Measuring Machine + 8 + 3-D Digitizer + 9 + Stereo Plotter + 10 + Articulated Arm + 11 + Armature + 12 + Multiple Point Digitizer + 13 + Free Space Wand + 32 + Stylus + 33 + Puck + 34 + Finger + 48 + Tip Pressure + 49 + Barrel Pressure + 50 + In Range + 51 + Touch + 52 + Untouch + 53 + Tap + 54 + Quality + 55 + Data Valid + 56 + Transducer Index + 57 + Tablet Function Keys + 58 + Program Change Keys + 59 + Battery Strength + 60 + Invert + 61 + X Tilt + 62 + Y Tilt + 63 + Azimuth + 64 + Altitude + 65 + Twist + 66 + Tip Switch + 67 + Secondary Tip Switch + 68 + Barrel Switch + 69 + Eraser + 70 + Tablet Pick + + + 15 + + description + Physical Interface Device + ranges + + + usages + + + + 16 + + default + Unicode Char u%04x + description + Unicode + ranges + + + usages + + + + 20 + + description + Alphnumeric Display + ranges + + + usages + + 0 + Undefined + 1 + Alphanumeric Display + 32 + Display Attributes Report + 33 + ASCII Character Set + 34 + Data Read Back + 35 + Font Read Back + 36 + Display Control Report + 37 + Clear Display + 38 + Display Enable + 39 + Screen Saver Delay + 40 + Screen Saver Enable + 41 + Vertical Scroll + 42 + Horizontal Scroll + 43 + Character Report + 44 + Display Data + 45 + Display Status + 46 + Stat Not Ready + 47 + Stat Ready + 48 + Err Not a loadable character + 49 + Err Font data cannot be read + 50 + Cursor Position Report + 51 + Row + 52 + Column + 53 + Rows + 54 + Columns + 55 + Cursor Pixel Positioning + 56 + Cursor Mode + 57 + Cursor Enable + 58 + Cursor Blink + 59 + Font Report + 60 + Font Data + 61 + Character Width + 62 + Character Height + 63 + Character Spacing Horizontal + 64 + Character Spacing Vertical + 65 + Unicode Character Set + + + 128 + + description + Monitor + ranges + + + usages + + 0 + Undefined + 1 + Monitor Control + 2 + EDID Information + 3 + VDIF Information + 4 + VESA Version + 5 + On Screen Display + 6 + Auto Size Center + 7 + Polarity Horz Synch + 8 + Polarity Vert Synch + 9 + Sync Type + 10 + Screen Position + 11 + Horizontal Frequency + 12 + Vertical Frequency + + + 129 + + default + ENUM %d + description + Monitor Enumerated Values + ranges + + + usages + + 0 + unassigned + + + 130 + + description + VESA Virtual Controls + ranges + + + usages + + 16 + Brightness + 18 + Contrast + 22 + Video Gain Red + 24 + Video Gain Green + 26 + Video Gain Blue + 28 + Focus + 32 + Horizontal Position + 34 + Horizontal Size + 36 + Horizontal Pincushion + 38 + Horizontal Pincushion Balance + 40 + Horizontal Misconvergence + 42 + Horizontal Linearity + 44 + Horizontal Linearity Balance + 48 + Vertical Position + 50 + Vertical Size + 52 + Vertical Pincushion + 54 + Vertical Pincushion Balance + 56 + Vertical Misconvergence + 58 + Vertical Linearity + 60 + Vertical Linearity Balance + 64 + Parallelogram Distortion + 66 + Trapezoidal Distortion + 68 + Tilt + 70 + Top Corner Distortion Control + 72 + Top Corner Distortion Balance + 74 + Bottom Corner Distortion Control + 76 + Bottom Corner Distortion Balance + 86 + MoirHorizontal + 88 + MoirVertical + 94 + Input Level Select + 96 + Input Source Select + 98 + Stereo Mode + 108 + Video Black Level Red + 110 + Video Black Level Green + 112 + Video Black Level Blue + + + 131 + + description + VESA Command + ranges + + + usages + + 0 + Undefined + 1 + Settings + 2 + Degauss + + + 132 + + description + Power Device + ranges + + + usages + + 0 + Undefined + 1 + iName + 2 + PresentStatus + 3 + ChangedStatus + 4 + UPS + 5 + PowerSupply + 16 + BatterySystem + 17 + BatterySystemID + 18 + Battery + 19 + BatteryID + 20 + Charger + 21 + ChargerID + 22 + PowerConverter + 23 + PowerConverterID + 24 + OutletSystem + 25 + OutletSystemID + 26 + Input + 27 + InputID + 28 + Output + 29 + OutputID + 30 + Flow + 31 + FlowID + 32 + Outlet + 33 + OutletID + 34 + Gang + 35 + GangID + 36 + Sink + 37 + SinkID + 48 + Voltage + 49 + Current + 50 + Frequency + 51 + ApparentPower + 52 + ActivePower + 53 + PercentLoad + 54 + Temperature + 55 + Humidity + 64 + ConfigVoltage + 65 + ConfigCurrent + 66 + ConfigFrequency + 67 + ConfigApparentPower + 68 + ConfigActivePower + 69 + ConfigPercentLoad + 70 + ConfigTemperature + 71 + ConfigHumidity + 80 + SwitchOnControl + 81 + SwitchOffControl + 82 + ToggleControl + 83 + LowVoltageTransfer + 84 + HighVoltageTransfer + 85 + DelayBeforeReboot + 86 + DelayBeforeStartup + 87 + DelayBeforeShutdown + 88 + Test + 89 + Vendorspecificcommand + 96 + Present + 97 + Good + 98 + InternalFailure + 99 + VoltageOutOfRange + 100 + FrequencyOutOfRange + 101 + Overload + 102 + OverCharged + 103 + OverTemperature + 104 + ShutdownRequested + 105 + ShutdownImminent + 106 + VendorSpecificAnswerValid + 107 + SwitchOn/Off + 108 + Switcheble + 109 + Used + 110 + Boost + 111 + Buck + 112 + Initialized + 113 + Tested + + + 133 + + description + Battery System + ranges + + + usages + + 0 + Undefined + 1 + SMBBatteryMode + 2 + SMBBatteryStatus + 3 + SMBAlarmWarning + 4 + SMBChargerMode + 5 + SMBChargerStatus + 6 + SMBChargerSpecInfo + 7 + SMBSelectorState + 8 + SMBSelectorPreset + 9 + SMBSelectorInfo + 16 + OptionalMfgFunction1 + 17 + OptionalMfgFunction2 + 18 + OptionalMfgFunction3 + 19 + OptionalMfgFunction4 + 20 + OptionalMfgFunction5 + 21 + ConnectionToSMBus + 22 + OutputConnection + 23 + ChargerConnection + 24 + BatteryInsertion + 25 + Usenext + 26 + OKToUse + 40 + ManufacturerAccess + 41 + RemainingCapacityLimit + 42 + RemainingTimeLimit + 43 + AtRate + 44 + CapacityMode + 45 + BroadcastToCharger + 46 + PrimaryBattery + 47 + ChargeController + 64 + TerminateCharge + 65 + TermminateDischarge + 66 + BelowRemainingCapacityLimit + 67 + RemainingTimeLimitExpired + 68 + Charging + 69 + Discharging + 70 + FullyCharged + 71 + FullyDischarged + 72 + ConditionningFlag + 73 + AtRateOK + 74 + SMBErrorCode + 75 + NeedReplacement + 96 + AtRateTimeToFull + 97 + AtRateTimeToEmpty + 98 + AverageCurrent + 99 + Maxerror + 100 + RelativeStateOfCharge + 101 + AbsoluteStateOfCharge + 102 + RemainingCapacity + 103 + FullChargeCapacity + 104 + RunTimeToEmpty + 105 + AverageTimeToEmpty + 106 + AverageTimeToFull + 107 + CycleCount + 128 + BattPackModelLevel + 129 + InternalChargeController + 130 + PrimaryBatterySupport + 131 + DesignCapacity + 132 + SpecificationInfo + 133 + ManufacturerDate + 134 + SerialNumber + 135 + iManufacturerName + 136 + iDevicename + 137 + iDeviceChemistery + 138 + iManufacturerData + 139 + Rechargeable + 140 + WarningCapacityLimit + 141 + CapacityGranularity1 + 142 + CapacityGranularity2 + 192 + InhibitCharge + 193 + EnablePolling + 194 + ResetToZero + 208 + ACPresent + 209 + BatteryPresent + 210 + PowerFail + 211 + AlarmInhibited + 212 + ThermistorUnderRange + 213 + ThermistorHot + 214 + ThermistorCold + 215 + ThermistorOverRange + 216 + VoltageOutOfRange + 217 + CurrentOutOfRange + 218 + CurrentNotRegulated + 219 + VoltageNotRegulated + 220 + MasterMode + 221 + ChargerBattery/HostControlled + 240 + ChargerSpecInfo + 241 + ChargerSpecRef + 242 + Level2 + 243 + Level3 + + + 140 + + description + Bar Code Scanner + ranges + + + usages + + + + 141 + + description + Scale Device + ranges + + + usages + + + + 144 + + description + Camera Control + ranges + + + usages + + + + 145 + + description + Arcade Device + ranges + + + usages + + 233 + Base Up + 234 + Base Down + + + + diff --git a/lib/DDHidUsage.h b/lib/DDHidUsage.h new file mode 100644 index 0000000..8dc5654 --- /dev/null +++ b/lib/DDHidUsage.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface DDHidUsage : NSObject +{ + unsigned mUsagePage; + unsigned mUsageId; +} + ++ (DDHidUsage *) usageWithUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId; + +- (id) initWithUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId; + +- (unsigned) usagePage; + +- (unsigned) usageId; + +- (NSString *) usageName; + +- (NSString *) usageNameWithIds; + +- (NSString *) description; + +- (BOOL) isEqualToUsagePage: (unsigned) usagePage usageId: (unsigned) usageId; + +@end diff --git a/lib/DDHidUsage.m b/lib/DDHidUsage.m new file mode 100644 index 0000000..8fe2c11 --- /dev/null +++ b/lib/DDHidUsage.m @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidUsage.h" +#import "DDHidUsageTables.h" + +@implementation DDHidUsage + ++ (DDHidUsage *) usageWithUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId; +{ + return [[[self alloc] initWithUsagePage: usagePage usageId: usageId] + autorelease]; +} + +- (id) initWithUsagePage: (unsigned) usagePage + usageId: (unsigned) usageId; +{ + self = [super init]; + if (self == nil) + return nil; + + mUsagePage = usagePage; + mUsageId = usageId; + + return self; +} + +- (unsigned) usagePage; +{ + return mUsagePage; +} + +- (unsigned) usageId; +{ + return mUsageId; +} + +- (NSString *) usageName; +{ + DDHidUsageTables * usageTables = [DDHidUsageTables standardUsageTables]; + return + [usageTables descriptionForUsagePage: mUsagePage + usage: mUsageId]; +} + +- (NSString *) usageNameWithIds; +{ + return [NSString stringWithFormat: @"%@ (0x%04x : 0x%04x)", + [self usageName], mUsagePage, mUsageId]; +} + +- (NSString *) description; +{ + return [NSString stringWithFormat: @"HID Usage: %@", [self usageName]]; +} + +- (BOOL) isEqualToUsagePage: (unsigned) usagePage usageId: (unsigned) usageId; +{ + return ((mUsagePage == usagePage) && (mUsageId == usageId)); +} + +@end diff --git a/lib/DDHidUsageTables.h b/lib/DDHidUsageTables.h new file mode 100644 index 0000000..be8d46e --- /dev/null +++ b/lib/DDHidUsageTables.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface DDHidUsageTables : NSObject +{ + NSDictionary * mLookupTables; +} + ++ (DDHidUsageTables *) standardUsageTables; + +- (id) initWithLookupTables: (NSDictionary *) lookupTables; + +- (NSString *) descriptionForUsagePage: (unsigned) usagePage + usage: (unsigned) usage; + +@end diff --git a/lib/DDHidUsageTables.m b/lib/DDHidUsageTables.m new file mode 100644 index 0000000..9e7703a --- /dev/null +++ b/lib/DDHidUsageTables.m @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "DDHidUsageTables.h" + +@implementation DDHidUsageTables + +static DDHidUsageTables * sStandardUsageTables = nil; + ++ (DDHidUsageTables *) standardUsageTables; +{ + if (sStandardUsageTables == nil) + { + NSBundle * myBundle = [NSBundle bundleForClass: self]; + NSString * usageTablesPath = + [myBundle pathForResource: @"DDHidStandardUsages" ofType: @"plist"]; + NSDictionary * lookupTables = + [NSDictionary dictionaryWithContentsOfFile: usageTablesPath]; + sStandardUsageTables = + [[DDHidUsageTables alloc] initWithLookupTables: lookupTables]; + [sStandardUsageTables retain]; + } + + return sStandardUsageTables; +} + +- (id) initWithLookupTables: (NSDictionary *) lookupTables; +{ + self = [super init]; + if (self == nil) + return nil; + + mLookupTables = [lookupTables retain]; + + return self; +} + +- (NSString *) descriptionForUsagePage: (unsigned) usagePage + usage: (unsigned) usage +{ + NSString * usagePageString = [NSString stringWithFormat: @"%u", usagePage]; + NSString * usageString = [NSString stringWithFormat: @"%u", usage]; + // NSNumber * usagePageNumber = [NSNumber numberWithUnsignedInt: usagePage]; + + NSDictionary * usagePageLookup = [mLookupTables objectForKey: usagePageString]; + if (usagePageLookup == nil) + return @"Unknown usage page"; + + NSDictionary * usageLookup = [usagePageLookup objectForKey: @"usages"]; + NSString * description = [usageLookup objectForKey: usageString]; + if (description != nil) + return description; + + NSString * defaultUsage = [usagePageLookup objectForKey: @"default"]; + if (defaultUsage != nil) + { + description = [NSString stringWithFormat: defaultUsage, usage]; + return description; + } + + return @"Unknown usage"; +} + +@end diff --git a/lib/NSDictionary+DDHidExtras.h b/lib/NSDictionary+DDHidExtras.h new file mode 100644 index 0000000..750d0d4 --- /dev/null +++ b/lib/NSDictionary+DDHidExtras.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import + + +@interface NSDictionary (DDHidExtras) + +- (unsigned) ddhid_unsignedForKey: (NSString *) key; + +- (id) ddhid_objectForString: (const char *) key; + +- (NSString *) ddhid_stringForString: (const char *) key; +- (long) ddhid_longForString: (const char *) key; +- (unsigned int) ddhid_unsignedIntForString: (const char *) key; +- (BOOL) ddhid_boolForString: (const char *) key; + +@end + +@interface NSMutableDictionary (DDHidExtras) + +- (void) ddhid_setObject: (id) object forString: (const char *) key; +- (void) ddhid_setInt: (int) i forKey: (id) key; + +@end diff --git a/lib/NSDictionary+DDHidExtras.m b/lib/NSDictionary+DDHidExtras.m new file mode 100644 index 0000000..4864a48 --- /dev/null +++ b/lib/NSDictionary+DDHidExtras.m @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2007 Dave Dribin + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#import "NSDictionary+DDHidExtras.h" + + +@implementation NSDictionary (DDHidExtras) + +- (unsigned) ddhid_unsignedForKey: (NSString *) key; +{ + NSNumber * number = [self objectForKey: key]; + return [number unsignedIntValue]; +} + +- (id) ddhid_objectForString: (const char *) key; +{ + NSString * objcKey = [NSString stringWithUTF8String: key]; + return [self objectForKey: objcKey]; +} + +- (NSString *) ddhid_stringForString: (const char *) key; +{ + return [self ddhid_objectForString: key]; +} + +- (long) ddhid_longForString: (const char *) key; +{ + NSNumber * number = [self ddhid_objectForString: key]; + return [number longValue]; +} + +- (unsigned int) ddhid_unsignedIntForString: (const char *) key; +{ + NSNumber * number = [self ddhid_objectForString: key]; + return [number unsignedIntValue]; +} + +- (BOOL) ddhid_boolForString: (const char *) key; +{ + NSNumber * number = [self ddhid_objectForString: key]; + return [number boolValue]; +} + +@end + +@implementation NSMutableDictionary (DDHidExtras) + +- (void) ddhid_setObject: (id) object forString: (const char *) key; +{ + NSString * objcKey = [NSString stringWithUTF8String: key]; + [self setObject: object forKey: objcKey]; +} + +- (void) ddhid_setInt: (int) i forKey: (id) key; +{ + NSNumber * number = [NSNumber numberWithInt: i]; + [self setObject: number forKey: key]; +} + +@end diff --git a/usb_hid_usages.txt b/usb_hid_usages.txt new file mode 100644 index 0000000..93ae0ed --- /dev/null +++ b/usb_hid_usages.txt @@ -0,0 +1,1086 @@ +# $NetBSD: usb_hid_usages,v 1.2 2004/05/16 13:22:23 lukem Exp $ +# +# USB HID usage table +# Syntax: +# - lines that do not start with a white space give the number and name of +# a usage page. +# - lines that start with a white space give the number and name of +# a usage with the last given page. +# If the number is * then the line matches all usages and the name +# is a printf formatting string that will be given the usage number. +# +1 Generic Desktop + 0x00 Undefined + 0x01 Pointer + 0x02 Mouse + 0x03 Reserved + 0x04 Joystick + 0x05 Game Pad + 0x06 Keyboard + 0x07 Keypad + 0x08 Multi-axis Controller + 0x30 X + 0x31 Y + 0x32 Z + 0x33 Rx + 0x34 Ry + 0x35 Rz + 0x36 Slider + 0x37 Dial + 0x38 Wheel + 0x39 Hat Switch + 0x3A Counted Buffer + 0x3B Byte Count + 0x3C Motion Wakeup + 0x40 Vx + 0x41 Vy + 0x42 Vz + 0x43 Vbrx + 0x44 Vbry + 0x45 Vbrx + 0x46 Vno + 0x80 System Control + 0x81 System Power Down + 0x82 System Sleep + 0x83 System Wake Up + 0x84 System Context Menu + 0x85 System Main Menu + 0x86 System App Menu + 0x87 System Menu Help + 0x88 System Menu Exit + 0x89 System Menu Select + 0x8A System Menu Right + 0x8B System Menu Left + 0x8C System Menu Up + 0x8D System Menu Down + 0x90 D-pad Up + 0x91 D-pad Down + 0x92 D-pad Right + 0x93 D-pad Left + +2 Simulation Controls + 0x00 Undefined + 0x01 Flight Simulation Device + 0x02 Automobile Simulation Device + 0x03 Tank Simulation Device + 0x04 Spaceship Simulation Device + 0x05 Submarine Simulation Device + 0x06 Sailing Simulation Device + 0x07 Motorcycle Simulation Device + 0x08 Sports Simulation Device + 0x09 Airplane Simulation Device + 0x0A Helicopter Simulation Device + 0x0B Magic Carpet Simulation Device + 0x0C Bicycle + 0x20 Flight Control Stick + 0x21 Flight Stick + 0x22 Cyclic Control + 0x23 Cyclic Trim + 0x24 Flight Yoke + 0x25 Track Control + 0x26 Driving Control + 0xB0 Aileron + 0xB1 Aileron Trim + 0xB2 Anti-Torque Control + 0xB3 Auto-pilot Enable + 0xB4 Chaff Release + 0xB5 Collective Control + 0xB6 Dive Brake + 0xB7 Electronic Counter Measures + 0xB8 Elevator + 0xB9 Elevator Trim + 0xBA Rudder + 0xBB Throttle + 0xBC Flight Communication + 0xBD Flare Release + 0xBE Landing Gear + 0xBF Toe Brake + 0xC0 Trigger + 0xC1 Weapons Arm + 0xC2 Weapons Select + 0xC3 Wing Flaps + 0xC4 Accelerator + 0xC5 Brake + 0xC6 Clutch + 0xC7 Shifter + 0xC8 Steering + 0xC9 Turret Direction + 0xCA Barrel Elevation + 0xCB Dive Plane + 0xCC Ballast + 0xCD Bicycle Crank + 0xCE Handle Bars + 0xCF Front Brake + 0xD0 Rear Brake + +3 VR Controls + 0x00 Unidentified + 0x01 Belt + 0x02 Body Suit + 0x03 Flexor + 0x04 Glove + 0x05 Head Tracker + 0x06 Head Mounted Display + 0x07 Hand Tracker + 0x08 Oculometer + 0x09 Vest + 0x0A Animatronic Device + 0x20 Stereo Enable + 0x21 Display Enable + +4 Sports Controls + 0x00 Unidentified + 0x01 Baseball Bat + 0x02 Golf Club + 0x03 Rowing Machine + 0x04 Treadmill + 0x30 Oar + 0x31 Slope + 0x32 Rate + 0x33 Stick Speed + 0x34 Stick Face Angle + 0x35 Stick Heel/Toe + 0x36 Stick Follow Through + 0x37 Stick Tempo + 0x38 Stick Type + 0x39 Stick Height + 0x50 Putter + 0x51 1 Iron + 0x52 2 Iron + 0x53 3 Iron + 0x54 4 Iron + 0x55 5 Iron + 0x56 6 Iron + 0x57 7 Iron + 0x58 8 Iron + 0x59 9 Iron + 0x5A 10 Iron + 0x5B 11 Iron + 0x5C Sand Wedge + 0x5D Loft Wedge + 0x5E Power Wedge + 0x5F 1 Wood + 0x60 3 Wood + 0x61 5 Wood + 0x62 7 Wood + 0x63 9 Wood + +5 Game Controls + 0x00 Undefined + 0x01 3D Game Controller + 0x02 Pinball Device + 0x03 Gun Device + 0x20 Point of View + 0x21 Turn Right/Left + 0x22 Pitch Right/Left + 0x23 Roll Forward/Backward + 0x24 Move Right/Left + 0x25 Move Forward/Backward + 0x26 Move Up/Down + 0x27 Lean Right/Left + 0x28 Lean Forward/Backward + 0x29 Height of POV + 0x2A Flipper + 0x2B Secondary Flipper + 0x2C Bump + 0x2D New Game + 0x2E Shoot Ball + 0x2F Player + 0x30 Gun Bolt + 0x31 Gun Clip + 0x32 Gun Selector + 0x33 Gun Single Shot + 0x34 Gun Burst + 0x35 Gun Automatic + 0x36 Gun Safety + 0x37 Gamepad Fire/Jump + 0x39 Gamepad Trigger + +7 Keyboard + 0x00 No Event + 0x01 Keyboard ErrorRollOver + 0x02 Keyboard POSTFail + 0x03 Keyboard ErrorUndefined + 0x04 Keyboard a and A + 0x05 Keyboard b and B + 0x06 Keyboard c and C + 0x07 Keyboard d and D + 0x08 Keyboard e and E + 0x09 Keyboard f and F + 0x0A Keyboard g and G + 0x0B Keyboard h and H + 0x0C Keyboard i and I + 0x0D Keyboard j and J + 0x0E Keyboard k and K + 0x0F Keyboard l and L + 0x10 Keyboard m and M + 0x11 Keyboard n and N + 0x12 Keyboard o and O + 0x13 Keyboard p and P + 0x14 Keyboard q and Q + 0x15 Keyboard r and R + 0x16 Keyboard s and S + 0x17 Keyboard t and T + 0x18 Keyboard u and U + 0x19 Keyboard v and V + 0x1A Keyboard w and W + 0x1B Keyboard x and X + 0x1C Keyboard y and Y + 0x1D Keyboard z and Z + 0x1E Keyboard 1 and ! + 0x1F Keyboard 2 and @ + 0x20 Keyboard 3 and # + 0x21 Keyboard 4 and $ + 0x22 Keyboard 5 and % + 0x23 Keyboard 6 and ^ + 0x24 Keyboard 7 and & + 0x25 Keyboard 8 and * + 0x26 Keyboard 9 and ( + 0x27 Keyboard 0 and ) + 0x28 Keyboard Return (ENTER) + 0x29 Keyboard ESCAPE + 0x2A Keyboard DELETE (Backspace) + 0x2B Keyboard Tab + 0x2C Keyboard Spacebar + 0x2D Keyboard - and (underscore) + 0x2E Keyboard = and + + 0x2F Keyboard [ and { + 0x30 Keyboard ] and } + 0x31 Keyboard \ and | + 0x32 Keyboard Non-US # and ~ + 0x33 Keyboard ; and : + 0x34 Keyboard ' and " + 0x35 Keyboard Grave Accent and Tilde + 0x36 Keyboard, and < + 0x37 Keyboard . and > + 0x38 Keyboard / and ? + 0x39 Keyboard Caps Lock + 0x3A Keyboard F1 + 0x3B Keyboard F2 + 0x3C Keyboard F3 + 0x3D Keyboard F4 + 0x3E Keyboard F5 + 0x3F Keyboard F6 + 0x40 Keyboard F7 + 0x41 Keyboard F8 + 0x42 Keyboard F9 + 0x43 Keyboard F10 + 0x44 Keyboard F11 + 0x45 Keyboard F12 + 0x46 Keyboard PrintScreen + 0x47 Keyboard Scroll Lock + 0x48 Keyboard Pause + 0x49 Keyboard Insert + 0x4A Keyboard Home + 0x4B Keyboard PageUp + 0x4C Keyboard Delete Forward + 0x4D Keyboard End + 0x4E Keyboard PageDown + 0x4F Keyboard RightArrow + 0x50 Keyboard LeftArrow + 0x51 Keyboard DownArrow + 0x52 Keyboard UpArrow + 0x53 Keypad Num Lock and Clear + 0x54 Keypad / + 0x55 Keypad * + 0x56 Keypad - + 0x57 Keypad + + 0x58 Keypad ENTER + 0x59 Keypad 1 and End + 0x5A Keypad 2 and Down Arrow + 0x5B Keypad 3 and PageDn + 0x5C Keypad 4 and Left Arrow + 0x5D Keypad 5 + 0x5E Keypad 6 and Right Arrow + 0x5F Keypad 7 and Home + 0x60 Keypad 8 and Up Arrow + 0x61 Keypad 9 and PageUp + 0x62 Keypad 0 and Insert + 0x63 Keypad . and Delete + 0x64 Keyboard Non-US \ and | + 0x65 Keyboard Application + 0x66 Keyboard Power + 0x67 Keypad = + 0x68 Keyboard F13 + 0x69 Keyboard F14 + 0x6A Keyboard F15 + 0x6B Keyboard F16 + 0x6C Keyboard F17 + 0x6D Keyboard F18 + 0x6E Keyboard F19 + 0x6F Keyboard F20 + 0x70 Keyboard F21 + 0x71 Keyboard F22 + 0x72 Keyboard F23 + 0x73 Keyboard F24 + 0x74 Keyboard Execute + 0x75 Keyboard Help + 0x76 Keyboard Menu + 0x77 Keyboard Select + 0x78 Keyboard Stop + 0x79 Keyboard Again + 0x7A Keyboard Undo + 0x7B Keyboard Cut + 0x7C Keyboard Copy + 0x7D Keyboard Paste + 0x7E Keyboard Find + 0x7F Keyboard Mute + 0x80 Keyboard Volume Up + 0x81 Keyboard Volume Down + 0x82 Keyboard Locking Caps Lock + 0x83 Keyboard Locking Num Lock + 0x84 Keyboard Locking Scroll Lock + 0x85 Keypad Comma + 0x86 Keypad Equal Sign + 0x87 Keyboard International1 + 0x88 Keyboard International2 + 0x89 Keyboard International3 + 0x8A Keyboard International4 + 0x8B Keyboard International5 + 0x8C Keyboard International6 + 0x8D Keyboard International7 + 0x8E Keyboard International8 + 0x8F Keyboard International9 + 0x90 Keyboard LANG1 + 0x91 Keyboard LANG2 + 0x92 Keyboard LANG3 + 0x93 Keyboard LANG4 + 0x94 Keyboard LANG5 + 0x95 Keyboard LANG6 + 0x96 Keyboard LANG7 + 0x97 Keyboard LANG8 + 0x98 Keyboard LANG9 + 0x99 Keyboard Alternate Erase + 0x9A Keyboard SysReq/Attention + 0x9B Keyboard Cancel + 0x9C Keyboard Clear + 0x9D Keyboard Prior + 0x9E Keyboard Return + 0x9F Keyboard Separator + 0xA0 Keyboard Out + 0xA1 Keyboard Oper + 0xA2 Keyboard Clear/Again + 0xA3 Keyboard CrSel/Props + 0xA4 Keyboard ExSel + 0xE0 Keyboard LeftControl + 0xE1 Keyboard LeftShift + 0xE2 Keyboard LeftAlt + 0xE3 Keyboard Left GUI + 0xE4 Keyboard RightControl + 0xE5 Keyboard RightShift + 0xE6 Keyboard RightAlt + 0xE7 Keyboard Right GUI + +8 LEDs + 0x00 Undefined + 0x01 Num Lock + 0x02 Caps Lock + 0x03 Scroll Lock + 0x04 Compose + 0x05 Kana + 0x06 Power + 0x07 Shift + 0x08 Do Not Disturb + 0x09 Mute + 0x0A Tone Enable + 0x0B High Cut Filter + 0x0C Low Cut Filter + 0x0D Equalizer Enable + 0x0E Sound Field On + 0x0F Surround Field On + 0x10 Repeat + 0x11 Stereo + 0x12 Sampling Rate Detect + 0x13 Spinning + 0x14 CAV + 0x15 CLV + 0x16 Recording Format Detect + 0x17 Off-Hook + 0x18 Ring + 0x19 Message Waiting + 0x1A Data Mode + 0x1B Battery Operation + 0x1C Battery OK + 0x1D Battery Low + 0x1E Speaker + 0x1F Head Set + 0x20 Hold + 0x21 Microphone + 0x22 Coverage + 0x23 Night Mode + 0x24 Send Calls + 0x25 Call Pickup + 0x26 Conference + 0x27 Stand-by + 0x28 Camera On + 0x29 Camera Off + 0x2A On-Line + 0x2B Off-Line + 0x2C Busy + 0x2D Ready + 0x2E Paper-Out + 0x2F Paper-Jam + 0x30 Remote + 0x31 Forward + 0x32 Reverse + 0x33 Stop + 0x34 Rewind + 0x35 Fast Forward + 0x36 Play + 0x37 Pause + 0x38 Record + 0x39 Error + 0x3A Usage Selected Indicator + 0x3B Usage In Use Indicator + 0x3C Usage Multi Mode Indicator + 0x3D Indicator On + 0x3E Indicator Flash + 0x3F Indicator Slow Blink + 0x40 Indicator Fast Blink + 0x41 Indicator Off + 0x42 Flash On Time + 0x43 Slow Blink On Time + 0x44 Slow Blink Off Time + 0x45 Fast Blink On Time + 0x46 Fast Blink Off Time + 0x47 Usage Indicator Color + 0x48 Red + 0x49 Green + 0x4A Amber + 0x4B Generic Indicator + 0x4C System Suspend + 0x4D External Power Connected + 0x4C-FFFF Reserved + +9 Button + 0x00 No Button Pressed + * Button %d + +10 Ordinal + 0x00 Unused + * Instance %d + +11 Telephony + 0x00 Unassigned + 0x01 Phone + 0x02 Answering Machine + 0x03 Message Controls + 0x04 Handset + 0x05 Headset + 0x06 Telephony Key Pad + 0x07 Programmable Button + 0x20 Hook Switch + 0x21 Flash + 0x22 Feature + 0x23 Hold + 0x24 Redial + 0x25 Transfer + 0x26 Drop + 0x27 Park + 0x28 Forward Calls + 0x29 Alternate Function + 0x2A Line + 0x2B Speaker Phone + 0x2C Conference + 0x2D Ring Enable + 0x2E Ring Select + 0x2F Phone Mute + 0x30 Caller ID + 0x50 Speed Dial + 0x51 Store Number + 0x52 Recall Number + 0x53 Phone Directory + 0x70 Voice Mail + 0x71 Screen Calls + 0x72 Do Not Disturb + 0x73 Message + 0x74 Answer On/Off + 0x90 Inside Dial Tone + 0x91 Outside Dial Tone + 0x92 Inside Ring Tone + 0x93 Outside Ring Tone + 0x94 Priority Ring Tone + 0x95 Inside Ringback + 0x96 Priority Ringback + 0x97 Line Busy Tone + 0x98 Reorder Tone + 0x99 Call Waiting Tone + 0x9A Confirmation Tone 1 + 0x9B Confirmation Tone 2 + 0x9C Tones Off + 0xB0 Phone Key 0 + 0xB1 Phone Key 1 + 0xB2 Phone Key 2 + 0xB3 Phone Key 3 + 0xB4 Phone Key 4 + 0xB5 Phone Key 5 + 0xB6 Phone Key 6 + 0xB7 Phone Key 7 + 0xB8 Phone Key 8 + 0xB9 Phone Key 9 + 0xBA Phone Key Star + 0xBB Phone Key Pound + 0xBC Phone Key A + 0xBD Phone Key B + 0xBE Phone Key C + 0xBF Phone Key D + +12 Consumer + 0x00 Unassigned + 0x01 Consumer Control + 0x02 Numeric Key Pad + 0x03 Programmable Buttons + 0x20 +10 + 0x21 +100 + 0x22 AM/PM + 0x30 Power + 0x31 Reset + 0x32 Sleep + 0x33 Sleep After + 0x34 Sleep Mode + 0x35 Illumination + 0x36 Function Buttons + 0x40 Menu + 0x41 Menu Pick + 0x42 Menu Up + 0x43 Menu Down + 0x44 Menu Left + 0x45 Menu Right + 0x46 Menu Escape + 0x47 Menu Value Increase + 0x48 Menu Value Decrease + 0x60 Data On Screen + 0x61 Closed Caption + 0x62 Closed Caption Select + 0x63 VCR/TV + 0x64 Broadcast Mode + 0x65 Snapshot + 0x66 Still + 0x80 Selection + 0x81 Assign Selection + 0x82 Mode Step + 0x83 Recall Last + 0x84 Enter Channel + 0x85 Order Movie + 0x86 Channel + 0x87 Media Selection + 0x88 Media Select Computer + 0x89 Media Select TV + 0x8A Media Select WWW + 0x8B Media Select DVD + 0x8C Media Select Telephone + 0x8D Media Select Program Guide + 0x8E Media Select Video Phone + 0x8F Media Select Games + 0x90 Media Select Messages + 0x91 Media Select CD + 0x92 Media Select VCR + 0x93 Media Select Tuner + 0x94 Quit + 0x95 Help + 0x96 Media Select Tape + 0x97 Media Select Cable + 0x98 Media Select Satellite + 0x99 Media Select Security + 0x9A Media Select Home + 0x9B Media Select Call + 0x9C Channel Increment + 0x9D Channel Decrement + 0x9E Media Select SAP + 0xA0 VCR Plus + 0xA1 Once + 0xA2 Daily + 0xA3 Weekly + 0xA4 Monthly + 0xB0 Play + 0xB1 Pause + 0xB2 Record + 0xB3 Fast Forward + 0xB4 Rewind + 0xB5 Scan Next Track + 0xB6 Scan Previous Track + 0xB7 Stop + 0xB8 Eject + 0xB9 Random Play + 0xBA Select DisC + 0xBB Enter Disc + 0xBC Repeat + 0xBD Tracking + 0xBE Track Normal + 0xBF Slow Tracking + 0xC0 Frame Forward + 0xC1 Frame Back + 0xC2 Mark + 0xC3 Clear Mark + 0xC4 Repeat From Mark + 0xC5 Return To Mark + 0xC6 Search Mark Forward + 0xC7 Search Mark Backwards + 0xC8 Counter Reset + 0xC9 Show Counter + 0xCA Tracking Increment + 0xCB Tracking Decrement + 0xCD Pause/Play + 0xE0 Volume + 0xE1 Balance + 0xE2 Mute + 0xE3 Bass + 0xE4 Treble + 0xE5 Bass Boost + 0xE6 Surround Mode + 0xE7 Loudness + 0xE8 MPX + 0xE9 Volume Up + 0xEA Volume Down + 0xF0 Speed Select + 0xF1 Playback Speed + 0xF2 Standard Play + 0xF3 Long Play + 0xF4 Extended Play + 0xF5 Slow + 0x100 Fan Enable + 0x101 Fan Speed + 0x102 Light + 0x103 Light Illumination Level + 0x104 Climate Control Enable + 0x105 Room Temperature + 0x106 Security Enable + 0x107 Fire Alarm + 0x108 Police Alarm + 0x150 Balance Right + 0x151 Balance Left + 0x152 Bass Increment + 0x153 Bass Decrement + 0x154 Treble Increment + 0x155 Treble Decrement + 0x160 Speaker System + 0x161 Channel Left + 0x162 Channel Right + 0x163 Channel Center + 0x164 Channel Front + 0x165 Channel Center Front + 0x166 Channel Side + 0x167 Channel Surround + 0x168 Channel Low Frequency Enhancement + 0x169 Channel Top + 0x16A Channel Unknown + 0x170 Sub-channel + 0x171 Sub-channel Increment + 0x172 Sub-channel Decrement + 0x173 Alternate Audio Increment + 0x174 Alternate Audio Decrement + 0x180 Application Launch Buttons + 0x181 AL Launch Button Configuration Tool + 0x182 AL Programmable Button Configuration + 0x183 AL Consumer Control Configuration + 0x184 AL Word Processor + 0x185 AL Text Editor + 0x186 AL Spreadsheet + 0x187 AL Graphics Editor + 0x188 AL Presentation App + 0x189 AL Database App + 0x18A AL Email Reader + 0x18B AL Newsreader + 0x18C AL Voicemail + 0x18D AL Contacts/Address Book + 0x18E AL Calendar/Schedule + 0x18F AL Task/Project Manager + 0x190 AL Log/Journal/Timecard + 0x191 AL Checkbook/Finance + 0x192 AL Calculator + 0x193 AL A/V Capture/Playback + 0x194 AL Local Machine Browser + 0x195 AL LAN/WAN Browser + 0x196 AL Internet Browser + 0x197 AL Remote Networking/ISP Connect + 0x198 AL Network Conference + 0x199 AL Network Chat + 0x19A AL Telephony/Dialer + 0x19B AL Logon + 0x19C AL Logoff + 0x19D AL Logon/Logoff + 0x19E AL Terminal Lock/Screensaver + 0x19F AL Control Panel + 0x1A0 AL Command Line Processor/Run + 0x1A1 AL Process/Task Manager + 0x1A2 AL Select Tast/Application + 0x1A3 AL Next Task/Application + 0x1A4 AL Previous Task/Application + 0x1A5 AL Preemptive Halt Task/Application + 0x1A7 AL My Documents + 0x1AB AC Spell + 0x1B6 AL My Pictures + 0x1B7 AL My Music + 0x200 Generic GUI Application Controls + 0x201 AC New + 0x202 AC Open + 0x203 AC Close + 0x204 AC Exit + 0x205 AC Maximize + 0x206 AC Minimize + 0x207 AC Save + 0x208 AC Print + 0x209 AC Properties + 0x21A AC Undo + 0x21B AC Copy + 0x21C AC Cut + 0x21D AC Paste + 0x21E AC Select All + 0x21F AC Find + 0x220 AC Find and Replace + 0x221 AC Search + 0x222 AC Go To + 0x223 AC Home + 0x224 AC Back + 0x225 AC Forward + 0x226 AC Stop + 0x227 AC Refresh + 0x228 AC Previous Link + 0x229 AC Next Link + 0x22A AC Bookmarks + 0x22B AC History + 0x22C AC Subscriptions + 0x22D AC Zoom In + 0x22E AC Zoom Out + 0x22F AC Zoom + 0x230 AC Full Screen View + 0x231 AC Normal View + 0x232 AC View Toggle + 0x233 AC Scroll Up + 0x234 AC Scroll Down + 0x235 AC Scroll + 0x236 AC Pan Left + 0x237 AC Pan Right + 0x238 AC Pan + 0x239 AC New Window + 0x23A AC Tile Horizontally + 0x23B AC Tile Vertically + 0x23C AC Format + 0x279 AC Redo + 0x289 AC Reply + 0x28B AC Fwd + 0x28C AC Send + +13 Digitizer + 0x00 Undefined + 0x01 Digitizer + 0x02 Pen + 0x03 Light Pen + 0x04 Touch Screen + 0x05 Touch Pad + 0x06 White Board + 0x07 Coordinate Measuring Machine + 0x08 3-D Digitizer + 0x09 Stereo Plotter + 0x0A Articulated Arm + 0x0B Armature + 0x0C Multiple Point Digitizer + 0x0D Free Space Wand + 0x20 Stylus + 0x21 Puck + 0x22 Finger + 0x30 Tip Pressure + 0x31 Barrel Pressure + 0x32 In Range + 0x33 Touch + 0x34 Untouch + 0x35 Tap + 0x36 Quality + 0x37 Data Valid + 0x38 Transducer Index + 0x39 Tablet Function Keys + 0x3A Program Change Keys + 0x3B Battery Strength + 0x3C Invert + 0x3D X Tilt + 0x3E Y Tilt + 0x3F Azimuth + 0x40 Altitude + 0x41 Twist + 0x42 Tip Switch + 0x43 Secondary Tip Switch + 0x44 Barrel Switch + 0x45 Eraser + 0x46 Tablet Pick + +15 Physical Interface Device + +16 Unicode + * Unicode Char u%04x + +20 Alphnumeric Display + 0x00 Undefined + 0x01 Alphanumeric Display + 0x20 Display Attributes Report + 0x21 ASCII Character Set + 0x22 Data Read Back + 0x23 Font Read Back + 0x24 Display Control Report + 0x25 Clear Display + 0x26 Display Enable + 0x27 Screen Saver Delay + 0x28 Screen Saver Enable + 0x29 Vertical Scroll + 0x2A Horizontal Scroll + 0x2B Character Report + 0x2C Display Data + 0x2D Display Status + 0x2E Stat Not Ready + 0x2F Stat Ready + 0x30 Err Not a loadable character + 0x31 Err Font data cannot be read + 0x32 Cursor Position Report + 0x33 Row + 0x34 Column + 0x35 Rows + 0x36 Columns + 0x37 Cursor Pixel Positioning + 0x38 Cursor Mode + 0x39 Cursor Enable + 0x3A Cursor Blink + 0x3B Font Report + 0x3C Font Data + 0x3D Character Width + 0x3E Character Height + 0x3F Character Spacing Horizontal + 0x40 Character Spacing Vertical + 0x41 Unicode Character Set + +128 Monitor + 0x00 Undefined + 0x01 Monitor Control + 0x02 EDID Information + 0x03 VDIF Information + 0x04 VESA Version + 0x05 On Screen Display + 0x06 Auto Size Center + 0x07 Polarity Horz Synch + 0x08 Polarity Vert Synch + 0x09 Sync Type + 0x0A Screen Position + 0x0B Horizontal Frequency + 0x0C Vertical Frequency + +129 Monitor Enumerated Values + 0x00 unassigned + * ENUM %d + +130 VESA Virtual Controls + 0x10 Brightness + 0x12 Contrast + 0x16 Video Gain Red + 0x18 Video Gain Green + 0x1A Video Gain Blue + 0x1C Focus + 0x20 Horizontal Position + 0x22 Horizontal Size + 0x24 Horizontal Pincushion + 0x26 Horizontal Pincushion Balance + 0x28 Horizontal Misconvergence + 0x2A Horizontal Linearity + 0x2C Horizontal Linearity Balance + 0x30 Vertical Position + 0x32 Vertical Size + 0x34 Vertical Pincushion + 0x36 Vertical Pincushion Balance + 0x38 Vertical Misconvergence + 0x3A Vertical Linearity + 0x3C Vertical Linearity Balance + 0x40 Parallelogram Distortion + 0x42 Trapezoidal Distortion + 0x44 Tilt + 0x46 Top Corner Distortion Control + 0x48 Top Corner Distortion Balance + 0x4A Bottom Corner Distortion Control + 0x4C Bottom Corner Distortion Balance + 0x56 MoirHorizontal + 0x58 MoirVertical + 0x5E Input Level Select + 0x60 Input Source Select + 0x62 Stereo Mode + 0x6C Video Black Level Red + 0x6E Video Black Level Green + 0x70 Video Black Level Blue + +131 VESA Command + 0x00 Undefined + 0x01 Settings + 0x02 Degauss + +132 Power Device + 0x00 Undefined + 0x01 iName + 0x02 PresentStatus + 0x03 ChangedStatus + 0x04 UPS + 0x05 PowerSupply + 0x10 BatterySystem + 0x11 BatterySystemID + 0x12 Battery + 0x13 BatteryID + 0x14 Charger + 0x15 ChargerID + 0x16 PowerConverter + 0x17 PowerConverterID + 0x18 OutletSystem + 0x19 OutletSystemID + 0x1A Input + 0x1B InputID + 0x1C Output + 0x1D OutputID + 0x1E Flow + 0x1F FlowID + 0x20 Outlet + 0x21 OutletID + 0x22 Gang + 0x23 GangID + 0x24 Sink + 0x25 SinkID + 0x30 Voltage + 0x31 Current + 0x32 Frequency + 0x33 ApparentPower + 0x34 ActivePower + 0x35 PercentLoad + 0x36 Temperature + 0x37 Humidity + 0x40 ConfigVoltage + 0x41 ConfigCurrent + 0x42 ConfigFrequency + 0x43 ConfigApparentPower + 0x44 ConfigActivePower + 0x45 ConfigPercentLoad + 0x46 ConfigTemperature + 0x47 ConfigHumidity + 0x50 SwitchOnControl + 0x51 SwitchOffControl + 0x52 ToggleControl + 0x53 LowVoltageTransfer + 0x54 HighVoltageTransfer + 0x55 DelayBeforeReboot + 0x56 DelayBeforeStartup + 0x57 DelayBeforeShutdown + 0x58 Test + 0x59 Vendorspecificcommand + 0x60 Present + 0x61 Good + 0x62 InternalFailure + 0x63 VoltageOutOfRange + 0x64 FrequencyOutOfRange + 0x65 Overload + 0x66 OverCharged + 0x67 OverTemperature + 0x68 ShutdownRequested + 0x69 ShutdownImminent + 0x6A VendorSpecificAnswerValid + 0x6B SwitchOn/Off + 0x6C Switcheble + 0x6D Used + 0x6E Boost + 0x6F Buck + 0x70 Initialized + 0x71 Tested + +133 Battery System + 0x00 Undefined + 0x01 SMBBatteryMode + 0x02 SMBBatteryStatus + 0x03 SMBAlarmWarning + 0x04 SMBChargerMode + 0x05 SMBChargerStatus + 0x06 SMBChargerSpecInfo + 0x07 SMBSelectorState + 0x08 SMBSelectorPreset + 0x09 SMBSelectorInfo + 0x10 OptionalMfgFunction1 + 0x11 OptionalMfgFunction2 + 0x12 OptionalMfgFunction3 + 0x13 OptionalMfgFunction4 + 0x14 OptionalMfgFunction5 + 0x15 ConnectionToSMBus + 0x16 OutputConnection + 0x17 ChargerConnection + 0x18 BatteryInsertion + 0x19 Usenext + 0x1A OKToUse + 0x28 ManufacturerAccess + 0x29 RemainingCapacityLimit + 0x2A RemainingTimeLimit + 0x2B AtRate + 0x2C CapacityMode + 0x2D BroadcastToCharger + 0x2E PrimaryBattery + 0x2F ChargeController + 0x40 TerminateCharge + 0x41 TermminateDischarge + 0x42 BelowRemainingCapacityLimit + 0x43 RemainingTimeLimitExpired + 0x44 Charging + 0x45 Discharging + 0x46 FullyCharged + 0x47 FullyDischarged + 0x48 ConditionningFlag + 0x49 AtRateOK + 0x4A SMBErrorCode + 0x4B NeedReplacement + 0x60 AtRateTimeToFull + 0x61 AtRateTimeToEmpty + 0x62 AverageCurrent + 0x63 Maxerror + 0x64 RelativeStateOfCharge + 0x65 AbsoluteStateOfCharge + 0x66 RemainingCapacity + 0x67 FullChargeCapacity + 0x68 RunTimeToEmpty + 0x69 AverageTimeToEmpty + 0x6A AverageTimeToFull + 0x6B CycleCount + 0x80 BattPackModelLevel + 0x81 InternalChargeController + 0x82 PrimaryBatterySupport + 0x83 DesignCapacity + 0x84 SpecificationInfo + 0x85 ManufacturerDate + 0x86 SerialNumber + 0x87 iManufacturerName + 0x88 iDevicename + 0x89 iDeviceChemistery + 0x8A iManufacturerData + 0x8B Rechargeable + 0x8C WarningCapacityLimit + 0x8D CapacityGranularity1 + 0x8E CapacityGranularity2 + 0xC0 InhibitCharge + 0xC1 EnablePolling + 0xC2 ResetToZero + 0xD0 ACPresent + 0xD1 BatteryPresent + 0xD2 PowerFail + 0xD3 AlarmInhibited + 0xD4 ThermistorUnderRange + 0xD5 ThermistorHot + 0xD6 ThermistorCold + 0xD7 ThermistorOverRange + 0xD8 VoltageOutOfRange + 0xD9 CurrentOutOfRange + 0xDA CurrentNotRegulated + 0xDB VoltageNotRegulated + 0xDC MasterMode + 0xDD ChargerBattery/HostControlled + 0xF0 ChargerSpecInfo + 0xF1 ChargerSpecRef + 0xF2 Level2 + 0xF3 Level3 + +140 Bar Code Scanner + +141 Scale Device + +144 Camera Control + +145 Arcade Device + +# Some Microsoft non-standard extensions +0xff00 Microsoft + 0xe9 Base Up + 0xea Base Down diff --git a/usb_hid_usages2plist b/usb_hid_usages2plist new file mode 100755 index 0000000..f50c5b9 --- /dev/null +++ b/usb_hid_usages2plist @@ -0,0 +1,46 @@ +#!/usr/bin/env ruby + +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "vendor")) +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib")) + +require 'pp' +require 'plist' + +usb_hid_usages = ARGV[0] + +usage_tables = {} +current_usage = 0; +current_usage_table = nil + +File.open(usb_hid_usages).each_line do |line| + next if line =~ /^\s*#/ + next if line =~ /^\s*$/ + + if (line =~ /^(\d+)\s+(.*)\s*$/) + current_usage = $1.to_i + usage_description = $2 + current_usage_table = {'usages' => {}, 'ranges' => {}} + current_usage_table['description'] = usage_description + usage_tables[current_usage] = current_usage_table + elsif (line =~ /^\s+(\S+)\s+(.*)\s*$/) + usage_page = $1 + usage_page_description = $2 + + if (usage_page =~ /^0x((?:\d|[a-fA-F])+)$/) + usage_page = $1.hex + current_usage_table['usages'][usage_page] = usage_page_description + elsif (usage_page =~ /^0x((?:\d|[a-fA-F])+)-((?:\d|[a-fA-F])+)$/) + range_start = $1.hex + range_end = $2.hex + range = "{#{range_start}, #{range_end}}"; + current_usage_table['ranges'][range] = usage_page_description + elsif (usage_page == '*') + current_usage_table['default'] = usage_page_description + else + puts "Uknown page: #{usage_page}" + end + + end +end + +puts Plist.dump(usage_tables) \ No newline at end of file diff --git a/vendor/NSXReturnThrowError/NSXReturnThrowError.h b/vendor/NSXReturnThrowError/NSXReturnThrowError.h new file mode 100644 index 0000000..b8aa11a --- /dev/null +++ b/vendor/NSXReturnThrowError/NSXReturnThrowError.h @@ -0,0 +1,103 @@ +/***************************************************************************//** + NSXReturnThrowError.h + Copyright (c) 2007 Jonathan 'Wolf' Rentzsch: + Some rights reserved: + + @section Overview + + NSXReturnThrowError does two things: + + 1. Eases wrapping error codes into NSError objects. + + 2. Enhances NSError by adding origin information to the error instance. + Origin information includes the actual line of code that returned + the error, as well as the file+line+function/method name. + + A big NSXReturnThrowError feature is that it deduces the correct NSError + error domain based on the wrapped code's return type+value. Bonus: it + does so without requiring ObjC++, relying on \@encode acrobatics + instead. + + NSXReturnThrowError was coded against 10.4, but should be compatible + with 10.3 as well. However that's currently untested. + + @section Usage + + NSXReturnThrowError handles both types of error handling: explicit + returning of NSError objects and raising NSExceptions. + + Use NSXReturnError() if you're returning NSError objects explicitly: + + @code + - (id)demoReturnError:(NSError**)error_ { + id result = nil; + NSError *error = nil; + + NSXReturnError(SomeCarbonFunction()); + if (!error) + NSXReturnError(someposixfunction()); + if (!error) + NSXReturnError(some_mach_function()); + if (!error) + NSXReturnError([SomeCocoaClass sharedInstance]); + + if (error_) *error_ = error; + return result; + } + @endcode + + Use NSXThrowError() if you'd prefer to raise NSException objects: + + @code + - (id)demo { + id result = nil; + + NSXThrowError(SomeCarbonFunction()); + NSXThrowError(someposixfunction()); + NSXThrowError(some_mach_function()); + NSXThrowError([SomeCocoaClass newObject]); + + return result; + } + @endcode + + The current structure of the raised NSException object is that it's a + normal NSException whose name is "NSError". The actual error object is + hung off the exception's userInfo dictionary with the key of @"error". + + @mainpage NSXReturnThrowError + @todo Add a compile-time flag for whether to stuff __FILE__+friends + info into the generated NSError or not. + + + ***************************************************************************/ + +#import + +extern NSString *NSXErrorExceptionName; +extern NSString *NULLPointerErrorDomain; +extern NSString *BOOLErrorDomain; + +void NSXMakeErrorImp(const char *objCType_, intptr_t result_, const char *file_, unsigned line_, const char *function_, const char *code_, NSError **error_); + +#define NSXMakeError(ERROR, CODE) \ + do{ \ + typeof(CODE) codeResult = (CODE); \ + NSXMakeErrorImp(@encode(typeof(CODE)), (intptr_t)codeResult, __FILE__, __LINE__, __PRETTY_FUNCTION__, #CODE, &ERROR); \ + }while(0) + +#define NSXReturnError(CODE) NSXMakeError(error, CODE) + +#define NSXRaiseError(ERROR) \ + [[NSException exceptionWithName:NSXErrorExceptionName \ + reason:[error description] \ + userInfo:[NSDictionary dictionaryWithObject:error forKey:@"error"]] raise]; + +#define NSXThrowError(CODE) \ + do{ \ + NSError *error = nil; \ + NSXReturnError(CODE); \ + if (error) { \ + NSXRaiseError(ERROR); \ + } \ + }while(0) diff --git a/vendor/NSXReturnThrowError/NSXReturnThrowError.m b/vendor/NSXReturnThrowError/NSXReturnThrowError.m new file mode 100644 index 0000000..22f31a5 --- /dev/null +++ b/vendor/NSXReturnThrowError/NSXReturnThrowError.m @@ -0,0 +1,106 @@ +/******************************************************************************* + NSXReturnThrowError.m + Copyright (c) 2007 Jonathan 'Wolf' Rentzsch: + Some rights reserved: + + ***************************************************************************/ + +#import "NSXReturnThrowError.h" + +NSString *NSXErrorExceptionName = @"NSXError"; +NSString *NULLPointerErrorDomain = @"NULLPointerErrorDomain"; +NSString *BOOLErrorDomain = @"BOOLErrorDomain"; + +typedef enum { + NSXErrorCodeType_Unknown, + NSXErrorCodeType_Cocoa, // "@" + NSXErrorCodeType_PosixOrMach, // "i" (-1 == posix+errno, otherwise mach) + NSXErrorCodeType_Carbon, // "s" || "l" + NSXErrorCodeType_ptr, // "r*" || "*" || "^" + NSXErrorCodeType_BOOL // "c" +} NSXErrorCodeType; + +static NSXErrorCodeType NSXErrorCodeTypeFromObjCType(const char *objCType) { + switch (objCType[0]) { + case 's': + case 'l': + return NSXErrorCodeType_Carbon; + case 'i': + return NSXErrorCodeType_PosixOrMach; + case '@': + return NSXErrorCodeType_Cocoa; + case '^': + case '*': + return NSXErrorCodeType_ptr; + case 'r': + return '*' == objCType[1] ? NSXErrorCodeType_ptr : NSXErrorCodeType_Unknown; + case 'c': + return NSXErrorCodeType_BOOL; + default: + return NSXErrorCodeType_Unknown; + } +} + +void NSXMakeErrorImp(const char *objCType_, intptr_t result_, const char *file_, unsigned line_, const char *function_, const char *code_, NSError **error_) { + NSString *errorDomain = nil; + int errorCode = (int)result_; + + switch (NSXErrorCodeTypeFromObjCType(objCType_)) { + case NSXErrorCodeType_Cocoa: + // codeResult's type is an id/NSObject* pointer. 0 == nil == failure. + if (0 == result_) { + errorDomain = @"NSCocoaErrorDomain"; // Could use NSCocoaErrorDomain symbol, but that would force us to 10.4. + errorCode = -1; + } + break; + case NSXErrorCodeType_Carbon: + // codeResult's type is OSErr (short) or OSStatus (long). 0 == noErr == success. + if (0 != result_) { + errorDomain = NSOSStatusErrorDomain; + } + break; + case NSXErrorCodeType_PosixOrMach: + // codeResult's type is int, which is used for both posix error codes and mach_error_t/kern_return_t. + // 0 means success for both, and we can differentiate posix error codes since they're always -1 (the + // actual posix code stored in errno). + if (0 != result_) { + if (-1 == result_) { + // Posix error code. + errorDomain = NSPOSIXErrorDomain; + errorCode = errno; + } else { + // Mach error code. + errorDomain = NSMachErrorDomain; + } + } + break; + case NSXErrorCodeType_ptr: + // codeResult's type is some sort of non-id/non-NSObject* pointer. 0 == NULL == failure. + if (0 == result_) { + errorDomain = NULLPointerErrorDomain; + errorCode = -1; + } + break; + case NSXErrorCodeType_BOOL: + // codeResult's type is a BOOL. 0 == NO == failure. + if (0 == result_) { + errorDomain = BOOLErrorDomain; + errorCode = -1; + } + break; + default: + NSCAssert1(NO, @"NSXErrorCodeType_Unknown: \"%s\"", objCType_); + break; + } + + if (errorDomain) { + *error_ = [NSError errorWithDomain:errorDomain + code:errorCode + userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [NSString stringWithUTF8String:file_], @"reportingFile", + [NSNumber numberWithInt:line_], @"reportingLine", + [NSString stringWithUTF8String:function_], @"reportingMethod", + [NSString stringWithUTF8String:code_], @"origin", + nil]]; + } +} diff --git a/versions.xcconfig b/versions.xcconfig new file mode 100644 index 0000000..b0e1427 --- /dev/null +++ b/versions.xcconfig @@ -0,0 +1,2 @@ +CURRENT_MARKETING_VERSION = 1.1 +CURRENT_PROJECT_VERSION = 1010.9.0 -- cgit v1.2.3