Changeset b9d3519c7596052b1c2ea0dfe2d5c927219baaa7
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r3a8a3e9
|
rb9d3519
|
|
| 62 | 62 | Show summary of options. |
| 63 | 63 | .TP |
| | 64 | .B \-w |
| | 65 | On startup, wait (without timing) out until a wiimote is found. |
| | 66 | .TP |
| 64 | 67 | .B \-c config |
| 65 | 68 | Specify the configuration file to load. |
-
|
r630069c
|
rb9d3519
|
|
| 21 | 21 | EXECUTION |
| 22 | 22 | ------------------------------------------------------------------------------------------------ |
| 23 | | wminput [-h] [-c config] [bdaddr] |
| | 23 | wminput [-h] [-w] [-c config] [bdaddr] |
| 24 | 24 | |
| 25 | 25 | -h: print usage and exit |
| | 26 | -w: on startup, wait (without timing) out until a wiimote is found |
| 26 | 27 | -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. |
| 27 | 28 | bdaddr: 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. |
-
|
ra8b4be2
|
rb9d3519
|
|
| 38 | 38 | |
| 39 | 39 | /* GetOpt */ |
| 40 | | #define OPTSTRING "hc:" |
| | 40 | #define OPTSTRING "hwc:" |
| 41 | 41 | extern char *optarg; |
| 42 | 42 | extern int optind, opterr, optopt; |
| … |
… |
|
| 56 | 56 | #define DEFAULT_CONFIG_FILE "default" |
| 57 | 57 | |
| 58 | | #define USAGE "usage:%s [-h] [-c config] [bdaddr]\n" |
| | 58 | #define USAGE "usage:%s [-h] [-w] [-c config] [bdaddr]\n" |
| 59 | 59 | |
| 60 | 60 | #define HOME_DIR_LEN 128 |
| 61 | 61 | int main(int argc, char *argv[]) |
| 62 | 62 | { |
| | 63 | char wait_forever = 0; |
| 63 | 64 | char *config_search_dirs[3], *plugin_search_dirs[3]; |
| 64 | 65 | char *config_filename = DEFAULT_CONFIG_FILE; |
| … |
… |
|
| 83 | 84 | return 0; |
| 84 | 85 | break; |
| | 86 | case 'w': |
| | 87 | wait_forever = 1; |
| | 88 | break; |
| 85 | 89 | case 'c': |
| 86 | 90 | config_filename = optarg; |
| … |
… |
|
| 88 | 92 | case '?': |
| 89 | 93 | default: |
| 90 | | wminput_err("unknown command-line option: -%c", c); |
| | 94 | return -1; |
| 91 | 95 | break; |
| 92 | 96 | } |
| … |
… |
|
| 141 | 145 | /* Wiimote connect */ |
| 142 | 146 | 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 | } |
| 143 | 154 | if ((wiimote = wiimote_connect(&bdaddr, wiimote_callback, NULL)) == NULL) { |
| 144 | 155 | wminput_err("unable to connect"); |