[chuck-users] KBHit vs Hid

Spencer Salazar ssalazar at CS.Princeton.EDU
Mon Nov 27 01:21:59 EST 2006

Hi Atte,
Yes, thats the main difference.  Here are a few extra details that I  
can think of, if you are interested:

- provides ASCII value for printable characters
- operates the same across all platforms
- tells you that a key was pressed, but not when it is released
- continually sends the key press if you hold down a key
- on most systems, only one key is reported when multiple keys are  
held down
- only reports key presses when associated terminal is in focus

HidIn keyboard
- provides os-dependent key code for almost all keys
- potentially different codes on different platforms
- tells you when a key was pressed + when it was released
- reports accurately when multiple keys are pressed simultaneously
- reports key presses regardless of window focus
- can handle multiple connected keyboards on Linux/Mac
- is known to not always (not ever?) recognize PS/2 keyboards on Linux

hope this helps!


On Nov 26, 2006, at 3:39 PM, Atte André Jensen wrote:

> Hi
> I just discovered KBHit, and it seems to fit better with my needs than
> Hid. I played around with both, and think I get the difference somehow
> (KBHit reads through the os, Hid is raw from device, + KBHit only  
> reads
> chars). Is this correctly understood?
> -- 
> peace, love & harmony
> Atte
> http://www.atte.dk      | quintet:      http://www.anagrammer.dk
>                          | compositions: http://www.atte.dk/ 
> compositions
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

More information about the chuck-users mailing list