/* reset_stinkpad_mouse.c Finally fixed the mouse stuck problem after suspend. How could this be so simple? ;-) This program fixes the (in)famous Thinkpad mouse stuck problem, which occurs after suspend. Keyboard works fine, but keyboard connected auxiliary mouse (the clit ;-) is jammed. Read days and days to find out the problem .. even had once my X on, but unfunctionable for days, because I did not want to reboot - my all projects (10s) and WWW environment (50+ pages) was on it. Finally surrended. Tab size is 4, as within all my code. Tabs are useful. 120 char wide page. @ arl // 2004 // (c) Linux/aow [www.aow.fi] */ #include #include //#include // enable when pc_keyb.h is fixed. /** Defining the name of this program. */ #define MYNAME "reset_stinkpad_mouse" /** By default we use /dev/psaux. */ char * psaux_device = "/dev/psaux"; /** Reset sequence/message to be sent psaux device i.e. written to it.

Please use always proper header file with its definitions and _not_ try to invent the wheel again (and make the world more like spaghetti). OK - it should be like this, but some C coders really like to put everything into one single header file, and that everything needs other everything header files included (like pc_keyb.h). Please, please, use constants only header files for separating DEFINITIONS (constants) and FUNCTIONALITY (like structures).

Still trying to figure out the correct sequence of commands, and do we need to read AUX_ACKs? At least on my machine this still hangs keyboard, and I would like to avoid needed extra suspend cycle.

pc_keyb.h should naturally be named pc_keyboard.h or something better. Also AUX_ should be named KEYBOARD_AUXILIARY_DEVICE_, long words but saves thinking and acts as a document by itself. It took couple of days just to figure out the stupid namespace used. */ char psaux_initMessage [] = { // AUX_RESET, // 0xFF // enable when pc_keyb.h is fixed. 0xFF, // disable when pc_keyb.h is fixed. // AUX_ACK, // 0xFA // enable when pc_keyb.h is fixed. // 0xFA, // disable when pc_keyb.h is fixed. }; int main( int argc, char **argv ) { int psaux_port = open( psaux_device, O_RDWR ); if ( psaux_port >= 0 ) { int wrote = write( psaux_port, psaux_initMessage, sizeof( psaux_initMessage ) ); if ( wrote != sizeof( psaux_initMessage ) ) { fprintf( stderr, MYNAME ": Failed to write to psaux (expecting:%d,wrote:%d)\n", sizeof( psaux_initMessage ), wrote ); return( 1 ); } } else { fprintf( stderr, MYNAME ": Failed to open psaux (no rights?)\n" ); return( 2 ); } return( 0 ); } /* EOF */