USB or Keyboard Polling Rate

Hi,

I am curious if anyone knows of a way of changing how often the internal keyboard or external USB keyboards are polled/sampled on a macbook. I would like to be able to sample from these devices at 1Khz (i.e. once per millisecond). Is there a straightforward way to do this? Many thanks!

Divyezheg

Macbook early 2008, Mac OS X (10.5.5)

Posted on Oct 18, 2008 11:33 AM

Reply
2 replies

Oct 18, 2008 4:14 PM in response to divyezheg

Hi,

The OS X kernel is designed to be preemptable, so it is possible to possible to schedule a low-latency real-time thread that can run in a quasi-realtime deterministic manner.

I have a feeling you're going to have to do some of the coding yourself to do what you want to do. This article, though old, gives some hints in sections 5.4 and 6: http://www.usenix.org/events/bsdcon/fullpapers/gerbarg/gerbarghtml/

You might want to take a look at OS X programming relating to MIDI I/O since that requires accurate timing.

Other things to keep in mind if you are measuring response times of someone pressing a key in response to a stimulus - what is your display's refresh rate and latency. Also, how deterministic is the keyboard scanning inside the keyboard? If your doing a psych experiment, using MIDI to trigger a stimulus presentation and read a button press may be the best way to get the timing accuracy you want.

Oct 18, 2008 4:21 PM in response to divyezheg

(Apologies for the re-post. My cat stepped on the keyboard and posted the previous article before I could make grammar corrections -Bill)

Hi,

The OS X kernel is designed to be preemptable, so it is possible to schedule a low-latency real-time thread that can run in a quasi-realtime deterministic manner.

I have a feeling you're going to have to do some of the coding yourself to do what you want to do. This article, though old, gives some hints in sections 5.4 and 6: http://www.usenix.org/events/bsdcon/fullpapers/gerbarg/gerbarghtml/

You might want to take a look at OS X programming relating to MIDI I/O since that requires accurate timing.

Keep in mind when measuring response times of someone pressing a key in response to a stimulus: 1. What is your display's refresh rate and latency. 2. How deterministic is the keyboard scanning inside the keyboard? If your doing a psych experiment, using MIDI to trigger a stimulus presentation and read a button press may be an easy way to get the timing accuracy you want.

-Bill

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

USB or Keyboard Polling Rate

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.