Changeset a281aec5 in mainline
- Timestamp:
- 2011-09-17T20:45:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 128c78b
- Parents:
- 3a11f17
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sportdmp/sportdmp.c
r3a11f17 ra281aec5 36 36 #define BUF_SIZE 1 37 37 38 static void syntax_print() { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n"); 40 } 41 38 42 int main(int argc, char **argv) 39 43 { 44 const char* devpath = "/hw/pci0/00:01.0/com1/a"; 45 sysarg_t baud = 9600; 46 47 if (argc > 1) { 48 char *endptr; 49 baud = strtol(argv[1], &endptr, 10); 50 if (*endptr != '\0') { 51 fprintf(stderr, "Invalid value for baud\n"); 52 syntax_print(); 53 return 1; 54 } 55 } 56 57 if (argc > 2) { 58 devpath = argv[2]; 59 } 60 61 if (argc > 3) { 62 syntax_print(); 63 return 1; 64 } 65 40 66 devman_handle_t device; 41 int rc = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", 42 &device, IPC_FLAG_BLOCKING); 67 int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING); 43 68 if (rc != EOK) { 44 fprintf(stderr, "Cannot open device \n");69 fprintf(stderr, "Cannot open device %s\n", devpath); 45 70 return 1; 46 71 } … … 53 78 54 79 async_exch_t *exch = async_exchange_begin(sess); 55 rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, 9600,80 rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, baud, 56 81 SERIAL_NO_PARITY, 8, 1); 57 82 async_exchange_end(exch); … … 76 101 ssize_t i; 77 102 for (i = 0; i < read; i++) { 78 if ( buf[i] >= 32 && buf[i] < 128)103 if ((buf[i] >= 32) && (buf[i] < 128)) 79 104 putchar((wchar_t) buf[i]); 80 105 else
Note:
See TracChangeset
for help on using the changeset viewer.