Changeset b9d3519c7596052b1c2ea0dfe2d5c927219baaa7

Show
Ignore:
Timestamp:
04/02/07 22:06:45 (6 years ago)
Author:
dsmith <dsmith@…>
Children:
90e23d09f4c914833ede12ca93aaafb6b787fdc0
Parents:
3ecbd0f2b2b00434fb3782d56e4e73f462bf07be
git-author:
L. Donnie Smith <donnie.smith@…> (04/02/07 22:06:45)
git-committer:
dsmith <dsmith@…> (04/02/07 22:06:45)
Message:

Added wait option to wminput (fixed ticket #11)

git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@58 918edb2d-ff29-0410-9de2-eb38e7f22bc7

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • man/man1/wminput.1

    r3a8a3e9 rb9d3519  
    6262Show summary of options. 
    6363.TP 
     64.B \-w 
     65On startup, wait (without timing) out until a wiimote is found. 
     66.TP 
    6467.B \-c config 
    6568Specify the configuration file to load.  
  • wminput/README

    r630069c rb9d3519  
    2121EXECUTION 
    2222------------------------------------------------------------------------------------------------ 
    23 wminput [-h] [-c config] [bdaddr] 
     23wminput [-h] [-w] [-c config] [bdaddr] 
    2424 
    2525-h: print usage and exit 
     26-w: on startup, wait (without timing) out until a wiimote is found 
    2627-c config: specifies the configuration file to load.  "default" is the default configuration file (on install, a symlink is created to the acc_ptr configuration.  The search directories are specified below in the section on configuration files, or an absolute or relative pathname may be given. 
    2728bdaddr: specifies the bluetooth device address of the wiimote.  If unspecified, the environment variable WIIMOTE_BDADDR is used.  If this variable does not exist, a connection is made with the first wiimote found. 
  • wminput/main.c

    ra8b4be2 rb9d3519  
    3838 
    3939/* GetOpt */ 
    40 #define OPTSTRING       "hc:" 
     40#define OPTSTRING       "hwc:" 
    4141extern char *optarg; 
    4242extern int optind, opterr, optopt; 
     
    5656#define DEFAULT_CONFIG_FILE     "default" 
    5757 
    58 #define USAGE "usage:%s [-h] [-c config] [bdaddr]\n" 
     58#define USAGE "usage:%s [-h] [-w] [-c config] [bdaddr]\n" 
    5959 
    6060#define HOME_DIR_LEN    128 
    6161int main(int argc, char *argv[]) 
    6262{ 
     63        char wait_forever = 0; 
    6364        char *config_search_dirs[3], *plugin_search_dirs[3]; 
    6465        char *config_filename = DEFAULT_CONFIG_FILE; 
     
    8384                        return 0; 
    8485                        break; 
     86                case 'w': 
     87                        wait_forever = 1; 
     88                        break; 
    8589                case 'c': 
    8690                        config_filename = optarg; 
     
    8892                case '?': 
    8993                default: 
    90                         wminput_err("unknown command-line option: -%c", c); 
     94                        return -1; 
    9195                        break; 
    9296                } 
     
    141145        /* Wiimote connect */ 
    142146        printf("Put Wiimote in discoverable mode now (press 1+2)...\n"); 
     147        if (wait_forever) { 
     148                if (wiimote_find_wiimote(&bdaddr, -1)) { 
     149                        wminput_err("error finding wiimote"); 
     150                        conf_unload(&conf); 
     151                        return -1; 
     152                } 
     153        } 
    143154        if ((wiimote = wiimote_connect(&bdaddr, wiimote_callback, NULL)) == NULL) { 
    144155                wminput_err("unable to connect");