67 #include "rnr/rnrconfig.h" 117 "Xbox360 diagnostic tool.",
120 "The %P tool debugs the libhid interface to Xbox360 controllers.\n" 121 " Button states are 0 or 1.\n" 122 " Triggers are 0 - 255.\n" 123 " Joysticks are -32767 - 32767.\n" 124 " LEDs and rumble motors are outputs to the Xbox360.\n" 125 " Link is determined by the libhid and is true or false.\n" 126 " Status is sent by the dongle when wireless link wth Xbox360 has changed.\n" 127 " Battery status is sent by Xbox360 occasionally.\n" 129 " ERTO consecutive Receive Error TimeOut count.\n" 130 " ER consecutive Receive Error count.\n" 131 " ES consecutive Send Error count.\n" 132 " ETOT Total Error count.",
153 "Use error threshold defaults." 169 int main(
int argc,
char* argv[])
179 Argv0 = basename(argv[0]);
193 if( (rc = xbox.
open()) < 0 )
195 LOGERROR(
"Failed to open Xbox360 controller. Is it connected?");
206 fprintf(stderr,
" left trigger -> left rumble;" 207 " right trigger -> right rumble;" 208 " B button -> next LED pattern;" 209 " right bumper -> refresh;" 210 " X button -> exit\n");
220 if( state != leftTrigger )
223 xbox.
setRumble(leftTrigger, rightTrigger);
228 if( state != rightTrigger )
230 rightTrigger = state;
231 xbox.
setRumble(leftTrigger, rightTrigger);
236 if( state && !BButton )
256 fprintf(stderr,
"\n\n");
267 fprintf(stderr,
"\n\nEnd Diagnostics\n");
#define APP_EC_OK
success exit code
virtual int close()
Close connection to an opened USB Xbox360 controller.
virtual int open()
Open connection to an USB Xbox360 controller.
void debugPrintState()
Simple debug print state.
Xbox360 Controller C interface.
int main(int argc, char *argv[])
Main.
Common Human Interface Device Interface.
void setErrorThresholds(int nErrorRcvTimeoutTh=NErrorRcvTimeoutThDft, int nErrorRcvTh=NErrorRcvThDft, int nErrorTotalTh=NErrorTotalThDft)
Set error count thresholds.
void debugPrintHdr()
Simple debug print header.
int setRumble(int nLeftMot, int nRightMot)
Set the rumble instensity.
virtual int getFeatureVal(int iMnem)
Get the value associated with the mapped user mnemonic.
Xbox360 controller HID input class.
static const PkgInfo_T PkgInfo
int setLED(int nPattern)
Set the LED pattern.
Package version information.
static bool OptsDftThresholds
do [not] use error thresholding
#define APP_EC_EXEC
execution exit code
virtual int run(float hz=30.0)
Create and run USB update in thread.
right bump (right shoulder) [0,1]
static char * Argv0
the command
#define XBOX360_LED_PAT_NUMOF
number of patterns
static OptsPgmInfo_T AppPgmInfo
Program information.
RoadNarrows Robotics standard namespace.
static OptsInfo_T AppOptsInfo[]
Command line options information.