Changeset 5ea75f0 in mainline for uspace/app/sportdmp/sportdmp.c
- Timestamp:
- 2012-07-29T23:28:08Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4bbba4a
- Parents:
- 0aa300d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sportdmp/sportdmp.c
r0aa300d r5ea75f0 42 42 int main(int argc, char **argv) 43 43 { 44 const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";45 44 sysarg_t baud = 9600; 45 service_id_t svc_id; 46 46 47 47 int arg = 1; 48 int rc; 48 49 49 50 if (argc > arg && str_test_prefix(argv[arg], "--baud=")) { … … 66 67 67 68 if (argc > arg) { 68 svc_path = argv[arg]; 69 rc = loc_service_get_id(argv[arg], &svc_id, 0); 70 if (rc != EOK) { 71 fprintf(stderr, "Cannot find device service %s\n", 72 argv[arg]); 73 return 1; 74 } 69 75 arg++; 76 } 77 else { 78 category_id_t serial_cat_id; 79 80 rc = loc_category_get_id("serial", &serial_cat_id, 0); 81 if (rc != EOK) { 82 fprintf(stderr, "Failed getting id of category " 83 "'serial'\n"); 84 return 1; 85 } 86 87 service_id_t *svc_ids; 88 size_t svc_count; 89 90 rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count); if (rc != EOK) { 91 fprintf(stderr, "Failed getting list of services\n"); 92 return 1; 93 } 94 95 if (svc_count == 0) { 96 fprintf(stderr, "No service in category 'serial'\n"); 97 free(svc_ids); 98 return 1; 99 } 100 101 svc_id = svc_ids[0]; 102 free(svc_ids); 70 103 } 71 104 … … 76 109 } 77 110 78 service_id_t svc_id;79 int rc = loc_service_get_id(svc_path, &svc_id, 0);80 if (rc != EOK) {81 fprintf(stderr, "Cannot find device service %s\n", svc_path);82 return 1;83 }84 111 85 112 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id, 86 113 IPC_FLAG_BLOCKING); 87 114 if (!sess) { 88 fprintf(stderr, "Failed connecting to service %s\n", svc_path);115 fprintf(stderr, "Failed connecting to service\n"); 89 116 } 90 117
Note:
See TracChangeset
for help on using the changeset viewer.