Re: I fixed the EXC_BAD_ACCESS issue with IOHIDValueGetIntegerValue()
Re: I fixed the EXC_BAD_ACCESS issue with IOHIDValueGetIntegerValue()
- Subject: Re: I fixed the EXC_BAD_ACCESS issue with IOHIDValueGetIntegerValue()
- From: JongAm Park <email@hidden>
- Date: Sat, 05 Mar 2016 14:45:28 -0800
Ok. Let me write about what was wrong in my case.
In the code below, the device, which is returned by IOHIDElementGetDevice(element) was null.
I still don’t understand why it retrieves NULL when the element was an actual value for a keyboard key.
I tried to initiate screen saver and entered my password to unlock the screen.
When I check the NULL value and skipped the interested code, it didn’t cause any problem, and there was no problem in handling key stroke. So, probably it’s temporary result with the same ‘element’ value.
I wondered if keyboard layout was considered to be changed, but it didn’t seem to be so.
bool isPressed = false;
// An individual key
NSArray *keyArray = [gIOKitKeyElementToCarbonVirtualKeyDict allKeysForObject:[NSNumber numberWithUnsignedShort:carbonVirtualKey]];
for( NSValue *key in keyArray ) {
IOHIDElementRef element = (IOHIDElementRef)[key pointerValue];
IOHIDValueRef value = 0;
IOHIDDeviceRef device = IOHIDElementGetDevice(element);
// device is NULL
IOHIDDeviceGetValue(device, element, &value);
try {
// EXC_BAD_ACCESS HERE!!!!!
if( IOHIDValueGetIntegerValue(value) == 1) {
isPressed = true;
break;
}
}
catch(...) {
ZLOG("IOHIDValueGetIntegerValue() failed.\n”);
}
}
return isPressed;
> On Mar 4, 2016, at 7:24 AM, Daniel J. Luke <email@hidden> wrote:
>
> For someone searching in the future who may have the same problem, it's nice if in your follow-up post to the list you can include the solution to the problem.
>
>> On Mar 3, 2016, at 7:16 PM, JongAm Park <email@hidden> wrote:
>> This morning, I figured out the problem and fixed it for myself.
>> So, please disregard my previous post.
>
> --
> Daniel J. Luke
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden