mirror of
https://github.com/zhigang1992/OS-X-Voodoo-PS2-Controller.git
synced 2026-04-30 04:55:41 +08:00
add support for keyboard with keys that fail to send break codes
This commit is contained in:
@@ -77,6 +77,7 @@
|
||||
84243AD91698783A00BC5AEB /* org.voodoo.driver.synapticsconfigload.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = org.voodoo.driver.synapticsconfigload.plist; path = synapticsconfigload/org.voodoo.driver.synapticsconfigload.plist; sourceTree = SOURCE_ROOT; };
|
||||
842730461698E2FB00E91910 /* org.rehabman.voodoo.driver.Daemon.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = org.rehabman.voodoo.driver.Daemon.plist; sourceTree = "<group>"; };
|
||||
8437048016284F66005B3C76 /* VoodooPS2Keyboard-RemapFN-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "VoodooPS2Keyboard-RemapFN-Info.plist"; sourceTree = "<group>"; };
|
||||
8441070016D4F68A0063F063 /* VoodooPS2Keyboard-Breakless-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "VoodooPS2Keyboard-Breakless-Info.plist"; sourceTree = "<group>"; };
|
||||
844952F1169A2696003DA49F /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; };
|
||||
84833F9D161B627D00845294 /* ApplePS2Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ApplePS2Device.h; path = VoodooPS2Controller/ApplePS2Device.h; sourceTree = "<group>"; };
|
||||
84833F9E161B627D00845294 /* ApplePS2KeyboardDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePS2KeyboardDevice.cpp; sourceTree = "<group>"; };
|
||||
@@ -268,6 +269,7 @@
|
||||
84045661161E3AD800D74D7F /* InfoPlist.strings */,
|
||||
84167830161B5613002C60E6 /* VoodooPS2Keyboard-Info.plist */,
|
||||
8437048016284F66005B3C76 /* VoodooPS2Keyboard-RemapFN-Info.plist */,
|
||||
8441070016D4F68A0063F063 /* VoodooPS2Keyboard-Breakless-Info.plist */,
|
||||
84167837161B5613002C60E6 /* VoodooPS2Keyboard-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
|
||||
165
VoodooPS2Keyboard/VoodooPS2Keyboard-Breakless-Info.plist
Normal file
165
VoodooPS2Keyboard/VoodooPS2Keyboard-Breakless-Info.plist
Normal file
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Source Code</key>
|
||||
<string>https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>1.7.15, Copyright Apple Computer, Inc. 2000-2003, RehabMan 2012-2013</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>VoodooPS2Keyboard</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.rehabman.voodoo.driver.PS2Keyboard</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Voodoo PS/2 Keyboard</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>KEXT</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.7.15</string>
|
||||
<key>IOKitPersonalities</key>
|
||||
<dict>
|
||||
<key>ApplePS2Keyboard</key>
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.rehabman.voodoo.driver.PS2Keyboard</string>
|
||||
<key>IOClass</key>
|
||||
<string>ApplePS2Keyboard</string>
|
||||
<key>IOProviderClass</key>
|
||||
<string>ApplePS2KeyboardDevice</string>
|
||||
<key>Make Application key into Apple Fn key</key>
|
||||
<true/>
|
||||
<key>Make Application key into right windows</key>
|
||||
<false/>
|
||||
<key>Make right modifier keys into Hangul and Hanja</key>
|
||||
<false/>
|
||||
<key>Swap capslock and left control</key>
|
||||
<false/>
|
||||
<key>Swap command and option</key>
|
||||
<true/>
|
||||
<key>Use ISO layout keyboard</key>
|
||||
<false/>
|
||||
<key>alt_handler_id</key>
|
||||
<integer>3</integer>
|
||||
<key>SleepPressTime</key>
|
||||
<integer>3000</integer>
|
||||
<key>Breakless PS2</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of breaklessscan (in hex)</string>
|
||||
<string>e05f</string>
|
||||
<string>e012</string>
|
||||
<string>e017</string>
|
||||
<string>e06e</string>
|
||||
<string>e00a</string>
|
||||
<string>e009</string>
|
||||
<string>e020</string>
|
||||
<string>e02e</string>
|
||||
<string>e030</string>
|
||||
<string>e010</string>
|
||||
<string>e022</string>
|
||||
<string>e019</string>
|
||||
</array>
|
||||
<key>Function Keys Standard</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
<string>;The following 12 items map Fn+fkeys to Fn+fkeys</string>
|
||||
<string>e05f=e05f</string>
|
||||
<string>e012=e012</string>
|
||||
<string>e017=e017</string>
|
||||
<string>e06e=e06e</string>
|
||||
<string>e00a=e00a</string>
|
||||
<string>e009=e009</string>
|
||||
<string>e020=e020</string>
|
||||
<string>e02e=e02e</string>
|
||||
<string>e030=e030</string>
|
||||
<string>e010=e010</string>
|
||||
<string>e022=e022</string>
|
||||
<string>e019=e019</string>
|
||||
<string>;The following 12 items map fkeys to fkeys</string>
|
||||
<string>3b=3b</string>
|
||||
<string>3c=3c</string>
|
||||
<string>3d=3d</string>
|
||||
<string>3e=3e</string>
|
||||
<string>3f=3f</string>
|
||||
<string>40=40</string>
|
||||
<string>41=41</string>
|
||||
<string>42=42</string>
|
||||
<string>43=43</string>
|
||||
<string>44=44</string>
|
||||
<string>57=57</string>
|
||||
<string>58=58</string>
|
||||
</array>
|
||||
<key>Function Keys Special</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
<string>;The following 12 items map Fn+fkeys to fkeys</string>
|
||||
<string>e05f=3b</string>
|
||||
<string>e012=3c</string>
|
||||
<string>e017=3d</string>
|
||||
<string>e06e=3e</string>
|
||||
<string>e00a=3f</string>
|
||||
<string>e009=40</string>
|
||||
<string>e020=41</string>
|
||||
<string>e02e=42</string>
|
||||
<string>e030=43</string>
|
||||
<string>e010=44</string>
|
||||
<string>e022=57</string>
|
||||
<string>e019=58</string>
|
||||
<string>;The following 12 items map fkeys to Fn+fkeys</string>
|
||||
<string>3b=e05f</string>
|
||||
<string>3c=e012</string>
|
||||
<string>3d=e017</string>
|
||||
<string>3e=e06e</string>
|
||||
<string>3f=e00a</string>
|
||||
<string>40=e009</string>
|
||||
<string>41=e020</string>
|
||||
<string>42=e02e</string>
|
||||
<string>43=e030</string>
|
||||
<string>44=e010</string>
|
||||
<string>57=e022</string>
|
||||
<string>58=e019</string>
|
||||
</array>
|
||||
<key>Custom PS2 Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
</array>
|
||||
<key>Custom ADB Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=adbto (in hex)</string>
|
||||
</array>
|
||||
<key>ActionSwipeUp</key>
|
||||
<string>3b d, 37 d, 7e d, 7e u, 37 u, 3b u</string>
|
||||
<key>ActionSwipeDown</key>
|
||||
<string>3b d, 37 d, 7d d, 7d u, 37 u, 3b u</string>
|
||||
<key>ActionSwipeLeft</key>
|
||||
<string>3b d, 37 d, 7b d, 7b u, 37 u, 3b u</string>
|
||||
<key>ActionSwipeRight</key>
|
||||
<string>3b d, 37 d, 7c d, 7c u, 37 u, 3b u</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>OSBundleLibraries</key>
|
||||
<dict>
|
||||
<key>com.apple.iokit.IOHIDSystem</key>
|
||||
<string>1.1</string>
|
||||
<key>com.apple.kpi.bsd</key>
|
||||
<string>8.0.0</string>
|
||||
<key>com.apple.kpi.iokit</key>
|
||||
<string>8.0.0</string>
|
||||
<key>com.apple.kpi.libkern</key>
|
||||
<string>8.0.0</string>
|
||||
<key>com.apple.kpi.mach</key>
|
||||
<string>8.0.0</string>
|
||||
<key>com.apple.kpi.unsupported</key>
|
||||
<string>8.0.0</string>
|
||||
<key>org.rehabman.voodoo.driver.PS2Controller</key>
|
||||
<string>1.7.15</string>
|
||||
</dict>
|
||||
<key>OSBundleRequired</key>
|
||||
<string>Console</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -48,13 +48,17 @@
|
||||
<integer>3</integer>
|
||||
<key>SleepPressTime</key>
|
||||
<integer>0</integer>
|
||||
<key>Breakless PS2</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of breaklessscan (in hex)</string>
|
||||
</array>
|
||||
<key>Custom PS2 Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
</array>
|
||||
<key>Custom ADB Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=adbto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=adbto (in hex)</string>
|
||||
</array>
|
||||
<key>ActionSwipeUp</key>
|
||||
<string>3b d, 37 d, 7e d, 7e u, 37 u, 3b u</string>
|
||||
|
||||
@@ -48,9 +48,13 @@
|
||||
<integer>3</integer>
|
||||
<key>SleepPressTime</key>
|
||||
<integer>3000</integer>
|
||||
<key>Breakless PS2</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of breaklessscan (in hex)</string>
|
||||
</array>
|
||||
<key>Function Keys Standard</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
<string>;The following 12 items map Fn+fkeys to Fn+fkeys</string>
|
||||
<string>e05f=e05f</string>
|
||||
<string>e012=e012</string>
|
||||
@@ -80,7 +84,7 @@
|
||||
</array>
|
||||
<key>Function Keys Special</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
<string>;The following 12 items map Fn+fkeys to fkeys</string>
|
||||
<string>e05f=3b</string>
|
||||
<string>e012=3c</string>
|
||||
@@ -110,11 +114,11 @@
|
||||
</array>
|
||||
<key>Custom PS2 Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=scanto (in hex)</string>
|
||||
</array>
|
||||
<key>Custom ADB Map</key>
|
||||
<array>
|
||||
<string>;Items must be strings in the form of scanfrom=adbto</string>
|
||||
<string>;Items must be strings in the form of scanfrom=adbto (in hex)</string>
|
||||
</array>
|
||||
<key>ActionSwipeUp</key>
|
||||
<string>3b d, 37 d, 7e d, 7e u, 37 u, 3b u</string>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// enable for keyboard debugging
|
||||
#ifdef DEBUG_MSG
|
||||
//#define DEBUG_VERBOSE
|
||||
#define DEBUG_VERBOSE
|
||||
#define DEBUG_LITE
|
||||
#endif
|
||||
|
||||
@@ -192,6 +192,7 @@ bool ApplePS2Keyboard::init(OSDictionary * dict)
|
||||
// first half of map is normal scan codes, second half is extended scan codes (e0)
|
||||
_PS2ToPS2Map[i] = i;
|
||||
}
|
||||
bzero(_PS2flags, sizeof(_PS2flags));
|
||||
|
||||
// Setup default swipe actions
|
||||
parseAction("3b d, 37 d, 7e d, 7e u, 37 u, 3b u", _actionSwipeUp, countof(_actionSwipeUp));
|
||||
@@ -201,6 +202,7 @@ bool ApplePS2Keyboard::init(OSDictionary * dict)
|
||||
|
||||
// now load PS2 -> PS2 configuration data
|
||||
loadCustomPS2Map(dict, "Custom PS2 Map");
|
||||
loadBreaklessPS2(dict, "Breakless PS2");
|
||||
|
||||
// now load PS2 -> ADB configuration data
|
||||
loadCustomADBMap(dict, "Custom ADB Map");
|
||||
@@ -528,6 +530,42 @@ void ApplePS2Keyboard::loadCustomPS2Map(OSDictionary* dict, const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
void ApplePS2Keyboard::loadBreaklessPS2(OSDictionary* dict, const char* name)
|
||||
{
|
||||
OSArray* pArray = OSDynamicCast(OSArray, dict->getObject(name));
|
||||
if (NULL != pArray)
|
||||
{
|
||||
for (int i = 0; i < pArray->getCount(); i++)
|
||||
{
|
||||
OSString* pString = OSDynamicCast(OSString, pArray->getObject(i));
|
||||
if (NULL == pString)
|
||||
continue;
|
||||
const char* psz = pString->getCStringNoCopy();
|
||||
// check for comment
|
||||
if (';' == *psz)
|
||||
continue;
|
||||
// otherwise, try to parse it
|
||||
unsigned scanIn;
|
||||
if (!parseHex(psz, '\n', ';', scanIn))
|
||||
{
|
||||
IOLog("VoodooPS2Keyboard: invalid breakless PS2 entry: \"%s\"\n", psz);
|
||||
continue;
|
||||
}
|
||||
// must be normal scan code or extended, nothing else
|
||||
UInt8 exIn = scanIn >> 8;
|
||||
if ((exIn != 0 && exIn != 0xe0))
|
||||
{
|
||||
IOLog("VoodooPS2Keyboard: scan code invalid for breakless PS2 entry: \"%s\"\n", psz);
|
||||
continue;
|
||||
}
|
||||
// modify PS2 to PS2 map per remap entry
|
||||
int index = (scanIn & 0xff) + (exIn == 0xe0 ? KBV_NUM_SCANCODES : 0);
|
||||
assert(index < countof(_PS2flags));
|
||||
_PS2flags[index] |= kBreaklessKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApplePS2Keyboard::loadCustomADBMap(OSDictionary* dict, const char* name)
|
||||
{
|
||||
OSArray* pArray = OSDynamicCast(OSArray, dict->getObject(name));
|
||||
@@ -1138,6 +1176,7 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(UInt8* packet, UInt32 pac
|
||||
// allow PS2 -> PS2 map to work, look in extended part of the table
|
||||
keyCodeRaw += KBV_NUM_SCANCODES;
|
||||
keyCode = _PS2ToPS2Map[keyCodeRaw];
|
||||
|
||||
#ifdef DEBUG_VERBOSE
|
||||
if (keyCode != keyCodeRaw)
|
||||
DEBUG_LOG("%s: keycode translated from=0xe0%02x to=0x%04x\n", getName(), keyCodeRaw, keyCode);
|
||||
@@ -1274,7 +1313,10 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(UInt8* packet, UInt32 pac
|
||||
_device->dispatchMouseMessage(kPS2M_notifyKeyPressed, &info);
|
||||
|
||||
// dispatch to HID system
|
||||
dispatchKeyboardEventX(adbKeyCode, goingDown, now_abs);
|
||||
if (goingDown || !(_PS2flags[keyCode] & kBreaklessKey))
|
||||
dispatchKeyboardEventX(adbKeyCode, goingDown, now_abs);
|
||||
if (goingDown && (_PS2flags[keyCode] & kBreaklessKey))
|
||||
dispatchKeyboardEventX(adbKeyCode, false, now_abs);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (0x38 == keyCode && !goingDown && -1 != genADB) // Alt going up
|
||||
|
||||
@@ -54,6 +54,10 @@
|
||||
|
||||
#define KBV_NUM_SCANCODES 256
|
||||
|
||||
// Special bits for _PS2ToPS2Map
|
||||
|
||||
#define kBreaklessKey 0x01 // keys with this flag don't generate break codes
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// ApplePS2Keyboard Class Declaration
|
||||
//
|
||||
@@ -78,6 +82,7 @@ private:
|
||||
|
||||
// for keyboard remapping
|
||||
UInt16 _PS2ToPS2Map[KBV_NUM_SCANCODES*2];
|
||||
UInt8 _PS2flags[KBV_NUM_SCANCODES*2];
|
||||
UInt8 _PS2ToADBMap[ADB_CONVERTER_LEN];
|
||||
UInt8 _PS2ToADBMapMapped[ADB_CONVERTER_LEN];
|
||||
UInt32 _fkeymode;
|
||||
@@ -114,6 +119,7 @@ private:
|
||||
void modifyScreenBrightness(int adbKeyCode, bool goingDown);
|
||||
|
||||
void loadCustomPS2Map(OSDictionary* dict, const char* name);
|
||||
void loadBreaklessPS2(OSDictionary* dict, const char* name);
|
||||
void loadCustomADBMap(OSDictionary* dict, const char* name);
|
||||
IOReturn setParamPropertiesGated(OSDictionary* dict);
|
||||
void onSleepTimer(void);
|
||||
|
||||
Reference in New Issue
Block a user