Changeset d087284c9fe3be67c74edd495b443683ce4ce6af
- Timestamp:
- 07/29/07 18:08:00 (5 years ago)
- Author:
- dsmith <dsmith@…>
- git-author:
- L. Donnie Smith <donnie.smith@gatech.edu> / 2007-07-29T18:08:00Z+0000
- Parents:
- 8dfafdd3df12e09ce36b9d0018fbf3718b14c9a5
- Children:
- f74d95ef1b141f63caaf55d5f29bd5df1ff9cdb0
- git-committer:
- dsmith <dsmith@918edb2d-ff29-0410-9de2-eb38e7f22bc7> / 2007-07-29T18:08:00Z+0000
- Message:
-
fixed wait forever logic
git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@138 918edb2d-ff29-0410-9de2-eb38e7f22bc7
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r8dfafdd
|
rd087284
|
|
| | 1 | 2007-07-29 L. Donnie Smith <cwiid@abstrakraft.org> |
| | 2 | wminput |
| | 3 | * fixed wait forever logic |
| | 4 | |
| 1 | 5 | 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org> |
| 2 | 6 | configure.ac |
-
|
r8dfafdd
|
rd087284
|
|
| 16 | 16 | * |
| 17 | 17 | * ChangeLog: |
| | 18 | * 2007-07-29 L. Donnie Smith <cwiid@abstrakraft.org> |
| | 19 | * * fixed wait forever logic |
| | 20 | * |
| 18 | 21 | * 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org> |
| 19 | 22 | * * added config.h include |
| … |
… |
|
| 232 | 235 | printf("Put Wiimote in discoverable mode now (press 1+2)...\n"); |
| 233 | 236 | if (wait_forever) { |
| 234 | | if (cwiid_find_wiimote(&bdaddr, -1)) { |
| 235 | | wminput_err("error finding wiimote"); |
| | 237 | if (!bacmp(&bdaddr, BDADDR_ANY)) { |
| | 238 | if (cwiid_find_wiimote(&bdaddr, -1)) { |
| | 239 | wminput_err("error finding wiimote"); |
| | 240 | conf_unload(&conf); |
| | 241 | return -1; |
| | 242 | } |
| | 243 | } |
| | 244 | /* TODO: avoid continuously calling cwiid_open */ |
| | 245 | /* TODO: kill error messages on failed cwiid_open calls */ |
| | 246 | while (!(wiimote = cwiid_open(&bdaddr, CWIID_FLAG_MESG_IFC))); |
| | 247 | } |
| | 248 | else { |
| | 249 | if ((wiimote = cwiid_open(&bdaddr, CWIID_FLAG_MESG_IFC)) == NULL) { |
| | 250 | wminput_err("unable to connect"); |
| 236 | 251 | conf_unload(&conf); |
| 237 | 252 | return -1; |
| 238 | 253 | } |
| 239 | | } |
| 240 | | if ((wiimote = cwiid_open(&bdaddr, CWIID_FLAG_MESG_IFC)) == NULL) { |
| 241 | | wminput_err("unable to connect"); |
| 242 | | conf_unload(&conf); |
| 243 | | return -1; |
| 244 | 254 | } |
| 245 | 255 | if (cwiid_set_mesg_callback(wiimote, &cwiid_callback)) { |
| … |
… |
|
| 310 | 320 | sigaddset(&sigset, SIGTERM); |
| 311 | 321 | sigaddset(&sigset, SIGINT); |
| | 322 | sigaddset(&sigset, SIGUSR1); |
| 312 | 323 | sigprocmask(SIG_BLOCK, &sigset, NULL); |
| 313 | 324 | sigwait(&sigset, &signum); |
| … |
… |
|
| 388 | 399 | break; |
| 389 | 400 | case CWIID_MESG_ERROR: |
| 390 | | if (kill(getpid(),SIGINT)) { |
| 391 | | wminput_err("Error sending SIGINT"); |
| | 401 | if (kill(getpid(),SIGUSR1)) { |
| | 402 | wminput_err("Error sending SIGUSR1"); |
| 392 | 403 | } |
| 393 | 404 | break; |