Dаrren Kitchen Posted May 19, 2010 Share Posted May 19, 2010 This is hit or miss, since it depends on the numlock key changing states. If you put: #include "usb_private.h" #include "usb_api.h" in your code, you can then look at the variable keyboard_leds, which has a tendency to change as someone logs in. Nifty. http://www.irongeek.com/i.php?page=securit...eystroke-dongle Quote Link to comment Share on other sites More sharing options...
KennyG Posted May 20, 2010 Share Posted May 20, 2010 I had this idea as well, but haven't implemented it yet. 1. See if caps is on and if it isn't put it on. 2. Wait for it to get turned off. 3. Give the user some time to log in. 4. Run some code. Quote Link to comment Share on other sites More sharing options...
Dаrren Kitchen Posted May 21, 2010 Author Share Posted May 21, 2010 Good idea, capslock can be annoying enough to force the users to send a message that says "Hey, I'm here". Quote Link to comment Share on other sites More sharing options...
KennyG Posted May 28, 2010 Share Posted May 28, 2010 Here is the method I came up with. Seems to work on my laptop. Let me know what you think. //Attempt to detect when a user logs in. void WaitForUserToLogin(uint16_t timeToLogin) { //Get value of keyboard leds just for caps lock. uint8_t caps = keyboard_leds & 0b00000010; //Second bit is for caps lock //If caps lock isn't on, turn it on. if(caps == 0) { usb_keyboard_press(KEY_CAPS_LOCK, 0); } //Wait a second before we begin checking. PDDelay(1000); //Wait for caps to be turned off. do { //Get value of keyboard leds just for caps lock. caps = keyboard_leds & 0b00000010; //Second bit is for caps lock } while(caps == 2); //Delay to allow time for the user to login. PDDelay(timeToLogin); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.