Changeset cf8cc36 in mainline for uspace/app/test_serial/test_serial.c
- Timestamp:
- 2010-05-14T13:45:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c47e1a8
- Parents:
- 04c7003f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/test_serial/test_serial.c
r04c7003f rcf8cc36 92 92 } 93 93 94 res = ipc_call_sync_1_0(phone, SERIAL_SET_BAUD_RATE, 1200); 94 unsigned int old_baud, old_par, old_stop, old_word_size; 95 96 res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud, &old_par, &old_word_size, &old_stop); 95 97 if (EOK != res) { 96 printf(NAME ": failed to set baud rate, errno = %d.\n", -res);98 printf(NAME ": failed to get old communication parameters, errno = %d.\n", -res); 97 99 devman_hangup_phone(DEVMAN_CLIENT); 98 100 ipc_hangup(phone); 99 101 free(buf); 100 return 4; 102 return 4; 101 103 } 104 105 res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200, SERIAL_NO_PARITY, 8, 1); 106 if (EOK != res) { 107 printf(NAME ": failed to set communication parameters, errno = %d.\n", -res); 108 devman_hangup_phone(DEVMAN_CLIENT); 109 ipc_hangup(phone); 110 free(buf); 111 return 4; 112 } 113 102 114 103 115 int total = 0; … … 107 119 if (0 > read) { 108 120 printf(NAME ": failed read from device, errno = %d.\n", -read); 121 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par, old_word_size, old_stop); 109 122 ipc_hangup(phone); 110 123 devman_hangup_phone(DEVMAN_CLIENT); … … 126 139 write_dev(phone, the_end, str_size(the_end)); 127 140 141 // restore original communication settings 142 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par, old_word_size, old_stop); 128 143 devman_hangup_phone(DEVMAN_CLIENT); 129 144 ipc_hangup(phone);
Note:
See TracChangeset
for help on using the changeset viewer.