Changeset 604:b81293d144f0
- Timestamp:
- 06/11/08 11:29:46 (7 months ago)
- Author:
- Maxime Petazzoni <maxime.petazzoni@…>
- Branch:
- default
- Message:
-
Add nx_fs_write() return value check in USB command recording.
- Location:
- nxos/systems/tag-route
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r603
|
r604
|
|
| 18 | 18 | void replay(char *filename); |
| 19 | 19 | void usb_recv(void); |
| 20 | | void usb_recv_to(fs_fd_t fd); |
| | 20 | fs_err_t usb_recv_to(fs_fd_t fd); |
| 21 | 21 | |
| 22 | 22 | #endif /* __NXOS_TAG_ROUTE_MAIN_H__ */ |
-
|
r603
|
r604
|
|
| 45 | 45 | nx_display_string("File opened.\n"); |
| 46 | 46 | nx_display_string("Waiting...\n"); |
| 47 | | usb_recv_to(fd); |
| | 47 | |
| | 48 | if (usb_recv_to(fd) != FS_ERR_NO_ERROR) { |
| | 49 | nx_display_string("Error!\n"); |
| | 50 | nx_fs_close(fd); |
| | 51 | return; |
| | 52 | } |
| 48 | 53 | |
| 49 | 54 | nx_display_uint(nx_fs_get_filesize(fd)); |
-
|
r603
|
r604
|
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | | void usb_recv_to(fs_fd_t fd) { |
| | 63 | fs_err_t usb_recv_to(fs_fd_t fd) { |
| 64 | 64 | U8 buf[RCMD_BUF_LEN]; |
| | 65 | fs_err_t err; |
| 65 | 66 | size_t i; |
| 66 | 67 | |
| … |
… |
|
| 74 | 75 | |
| 75 | 76 | for (i=0; i<strlen((char *)buf); i++) { |
| 76 | | nx_fs_write(fd, buf[i]); |
| | 77 | err = nx_fs_write(fd, buf[i]); |
| | 78 | if (err != FS_ERR_NO_ERROR) { |
| | 79 | return err; |
| | 80 | } |
| 77 | 81 | } |
| 78 | | nx_fs_write(fd, (U8)'\n'); |
| | 82 | |
| | 83 | err = nx_fs_write(fd, (U8)'\n'); |
| | 84 | if (err != FS_ERR_NO_ERROR) { |
| | 85 | return err; |
| | 86 | } |
| 79 | 87 | |
| 80 | 88 | nx_rcmd_do((char *)buf); |
| 81 | 89 | nx_systick_wait_ms(50); |
| 82 | 90 | } while (!streq((char *)buf, "end")); |
| | 91 | |
| | 92 | return FS_ERR_NO_ERROR; |
| 83 | 93 | } |
| 84 | 94 | |