Changes in uspace/app/sportdmp/sportdmp.c [aa91105:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sportdmp/sportdmp.c
raa91105 r9d58539 27 27 */ 28 28 29 #include <errno.h> 30 #include <stdio.h> 31 #include <devman.h> 32 #include <ipc/devman.h> 29 33 #include <device/char_dev.h> 30 #include <errno.h>31 34 #include <ipc/serial_ctl.h> 32 #include <loc.h>33 #include <stdio.h>34 35 35 36 #define BUF_SIZE 1 36 37 37 static void syntax_print(void) 38 { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n"); 38 static void syntax_print() { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n"); 40 40 } 41 41 42 42 int main(int argc, char **argv) 43 43 { 44 const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";44 const char* devpath = "/hw/pci0/00:01.0/com1/a"; 45 45 sysarg_t baud = 9600; 46 46 … … 56 56 57 57 if (argc > 2) { 58 svc_path = argv[2];58 devpath = argv[2]; 59 59 } 60 60 … … 64 64 } 65 65 66 service_id_t svc_id;67 int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING);66 devman_handle_t device; 67 int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING); 68 68 if (rc != EOK) { 69 fprintf(stderr, "Cannot find device service %s\n", svc_path);69 fprintf(stderr, "Cannot open device %s\n", devpath); 70 70 return 1; 71 71 } 72 72 73 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,73 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device, 74 74 IPC_FLAG_BLOCKING); 75 75 if (!sess) { 76 fprintf(stderr, " Failed connecting to service %s\n", svc_path);76 fprintf(stderr, "Cannot connect device\n"); 77 77 } 78 78 … … 83 83 84 84 if (rc != EOK) { 85 fprintf(stderr, " Failed settingserial properties\n");85 fprintf(stderr, "Cannot set serial properties\n"); 86 86 return 2; 87 87 } … … 89 89 uint8_t *buf = (uint8_t *) malloc(BUF_SIZE); 90 90 if (buf == NULL) { 91 fprintf(stderr, " Failed allocatingbuffer\n");91 fprintf(stderr, "Cannot allocate buffer\n"); 92 92 return 3; 93 93 }
Note:
See TracChangeset
for help on using the changeset viewer.