Changeset 3c99e2c9568a84f9e8bb60549c145d3f03d73716
- Timestamp:
- 08/15/07 04:06:03 (5 years ago)
- Author:
- dsmith <dsmith@…>
- git-author:
- L. Donnie Smith <donnie.smith@gatech.edu> / 2007-08-15T04:06:03Z+0000
- Parents:
- 7e5f213decff36c62421b1b3d02d02b3037c79a2
- Children:
- 1f9dd8c8de2bc38d5c4869baf313a732feb248ad
- git-committer:
- dsmith <dsmith@918edb2d-ff29-0410-9de2-eb38e7f22bc7> / 2007-08-15T04:06:03Z+0000
- Message:
-
stifled cwiid_connect errors on wminput reconnect
git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@143 918edb2d-ff29-0410-9de2-eb38e7f22bc7
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r7e5f213
|
r3c99e2c
|
|
| 1 | 1 | 2007-08-14 L. Donnie Smith <cwiid@abstrakraft.org> |
| | 2 | libcwiid |
| | 3 | * make cwiid_err_default public |
| | 4 | |
| 2 | 5 | wminput |
| 3 | 6 | * added {c,py}_wiimote_deinit functions |
-
|
ra09a4ee
|
r3c99e2c
|
|
| 16 | 16 | * |
| 17 | 17 | * ChangeLog: |
| | 18 | * 2008-08-14 L. Donnie Smith <cwiid@abstrakraft.org> |
| | 19 | * * make cwiid_err_default public |
| | 20 | * |
| 18 | 21 | * 2007-05-16 L. Donnie Smith <cwiid@abstrakraft.org> |
| 19 | 22 | * * changed cwiid_connect, cwiid_disconnect to cwiid_open, cwiid_close |
| … |
… |
|
| 301 | 304 | /* Error reporting (library wide) */ |
| 302 | 305 | int cwiid_set_err(cwiid_err_t *err); |
| | 306 | void cwiid_err_default(struct wiimote *wiimote, const char *str, va_list ap); |
| 303 | 307 | |
| 304 | 308 | /* Connection */ |
-
|
rcc40e6c
|
r3c99e2c
|
|
| 16 | 16 | * |
| 17 | 17 | * ChangeLog: |
| | 18 | * 2008-08-14 L. Donnie Smith <cwiid@abstrakraft.org> |
| | 19 | * * make cwiid_err_default public |
| | 20 | * * clean up cwiid_err |
| | 21 | * |
| 18 | 22 | * 2007-04-24 L. Donnie Smith <cwiid@abstrakraft.org> |
| 19 | 23 | * * rewrite for API overhaul |
| … |
… |
|
| 55 | 59 | #include "cwiid_internal.h" |
| 56 | 60 | |
| 57 | | static cwiid_err_t cwiid_err_default; |
| | 61 | cwiid_err_t cwiid_err_default; |
| 58 | 62 | |
| 59 | 63 | static cwiid_err_t *cwiid_err_func = &cwiid_err_default; |
| … |
… |
|
| 68 | 72 | } |
| 69 | 73 | |
| 70 | | static void cwiid_err_default(struct wiimote *wiimote, const char *str, |
| 71 | | va_list ap) |
| | 74 | void cwiid_err_default(struct wiimote *wiimote, const char *str, va_list ap) |
| 72 | 75 | { |
| 73 | 76 | vfprintf(stderr, str, ap); |
| … |
… |
|
| 81 | 84 | if (cwiid_err_func) { |
| 82 | 85 | va_start(ap, str); |
| 83 | | if (wiimote) { |
| 84 | | (*cwiid_err_func)(wiimote, str, ap); |
| 85 | | } |
| 86 | | else { |
| 87 | | (*cwiid_err_func)(NULL, str, ap); |
| 88 | | } |
| | 86 | (*cwiid_err_func)(wiimote, str, ap); |
| 89 | 87 | va_end(ap); |
| 90 | 88 | } |
-
|
r7e5f213
|
r3c99e2c
|
|
| 65 | 65 | #endif |
| 66 | 66 | |
| | 67 | #include <errno.h> |
| 67 | 68 | #include <stdint.h> |
| 68 | 69 | #include <stdio.h> |
| … |
… |
|
| 114 | 115 | printf("\t-d, --daemon\t\tImplies -q, -r, and -w.\n"); |
| 115 | 116 | printf("\t-q, --quiet\t\tReduce output to errors\n"); |
| 116 | | printf("\t-r, --reconnect [wait]\t\tAutomatically try reconnect after wiimote disconnect.\n"); |
| | 117 | printf("\t-r, --reconnect [wait]\tAutomatically try reconnect after wiimote disconnect.\n"); |
| 117 | 118 | printf("\t-w, --wait\t\tWait indefinitely for wiimote to connect.\n"); |
| | 119 | } |
| | 120 | |
| | 121 | void cwiid_err_connect(struct wiimote *wiimote, const char *str, va_list ap) |
| | 122 | { |
| | 123 | /* TODO: temporary kludge to stifle error messages from cwiid_open */ |
| | 124 | if (errno != EHOSTDOWN) { |
| | 125 | vfprintf(stderr, str, ap); |
| | 126 | fprintf(stderr, "\n"); |
| | 127 | } |
| 118 | 128 | } |
| 119 | 129 | |
| … |
… |
|
| 279 | 289 | } |
| 280 | 290 | /* TODO: avoid continuously calling cwiid_open */ |
| 281 | | /* TODO: kill error messages on failed cwiid_open calls */ |
| | 291 | cwiid_set_err(cwiid_err_connect); |
| 282 | 292 | while (!(wiimote = cwiid_open(¤t_bdaddr, CWIID_FLAG_MESG_IFC))); |
| | 293 | cwiid_set_err(cwiid_err_default); |
| 283 | 294 | } |
| 284 | 295 | else { |