Which keyboard (barcode scanner) did the event come from?
Which keyboard (barcode scanner) did the event come from?
- Subject: Which keyboard (barcode scanner) did the event come from?
- From: Gerd Knops <email@hidden>
- Date: Mon, 9 Feb 2009 16:47:24 -0600
Assuming I have two identical USB keyboards (actually barcode
scanners) connected to a mac, is there any way to tell which of them a
keyboard event came from?
I can get to the keyboard type easily enough, but that only helps when
I have different keyboards:
- (void)sendEvent:(NSEvent *)anEvent {
NSEventType type=[anEvent type];
if(type==NSKeyDown)
{
EventRef ce=(EventRef)[anEvent eventRef];
if(ce)
{
unsigned kbt;
GetEventParameter(
ce,
kEventParamKeyboardType,
typeUInt32, NULL,
sizeof kbt,
NULL,
&kbt
);
NSLog(@"Keyboard type: %d",kbt);
}
}
[super sendEvent:anEvent];
}
Is there some way to, say, get a unique USB device ID or something
like that from an NSEvent or a EventRef?
Thanks
Gerd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden