Changeset e280857 in mainline for uspace/lib
- Timestamp:
- 2011-08-18T12:35:59Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 99ac5cf
- Parents:
- 12f9f0d0
- Location:
- uspace/lib
- Files:
-
- 6 edited
-
c/generic/devman.c (modified) (3 diffs)
-
c/include/devman.h (modified) (2 diffs)
-
c/include/ipc/devman.h (modified) (1 diff)
-
usb/include/usb/hc.h (modified) (2 diffs)
-
usb/src/hc.c (modified) (1 diff)
-
usb/src/resolve.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
r12f9f0d0 re280857 333 333 exch = devman_exchange_begin(DEVMAN_CLIENT); 334 334 if (exch == NULL) 335 return errno;335 return ENOMEM; 336 336 } 337 337 … … 364 364 } 365 365 366 int devman_device_get_handle_by_class(const char *classname,367 const char *devname, devman_handle_t *handle, unsigned int flags)368 {369 async_exch_t *exch;370 371 if (flags & IPC_FLAG_BLOCKING)372 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);373 else {374 exch = devman_exchange_begin(DEVMAN_CLIENT);375 if (exch == NULL)376 return errno;377 }378 379 ipc_call_t answer;380 aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,381 flags, &answer);382 sysarg_t retval = async_data_write_start(exch, classname,383 str_size(classname));384 385 if (retval != EOK) {386 devman_exchange_end(exch);387 async_wait_for(req, NULL);388 return retval;389 }390 391 retval = async_data_write_start(exch, devname,392 str_size(devname));393 394 devman_exchange_end(exch);395 396 if (retval != EOK) {397 async_wait_for(req, NULL);398 return retval;399 }400 401 async_wait_for(req, &retval);402 403 if (retval != EOK) {404 if (handle != NULL)405 *handle = (devman_handle_t) -1;406 407 return retval;408 }409 410 if (handle != NULL)411 *handle = (devman_handle_t) IPC_GET_ARG1(answer);412 413 return retval;414 }415 416 366 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size) 417 367 { 418 368 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 419 369 if (exch == NULL) 420 return errno;370 return ENOMEM; 421 371 422 372 ipc_call_t answer; … … 463 413 } 464 414 415 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle) 416 { 417 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 418 if (exch == NULL) 419 return ENOMEM; 420 421 sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE, 422 sid, handle); 423 424 devman_exchange_end(exch); 425 return (int) retval; 426 } 427 465 428 /** @} 466 429 */ -
uspace/lib/c/include/devman.h
r12f9f0d0 re280857 38 38 39 39 #include <ipc/devman.h> 40 #include <ipc/loc.h> 40 41 #include <async.h> 41 42 #include <bool.h> … … 56 57 extern int devman_device_get_handle(const char *, devman_handle_t *, 57 58 unsigned int); 58 extern int devman_device_get_handle_by_class(const char *, const char *,59 devman_handle_t *, unsigned int);60 59 extern int devman_get_device_path(devman_handle_t, char *, size_t); 61 60 62 61 extern int devman_add_device_to_class(devman_handle_t, const char *); 62 extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *); 63 63 64 64 #endif -
uspace/lib/c/include/ipc/devman.h
r12f9f0d0 re280857 149 149 typedef enum { 150 150 DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD, 151 DEVMAN_DEVICE_GET_ HANDLE_BY_CLASS,152 DEVMAN_ DEVICE_GET_DEVICE_PATH151 DEVMAN_DEVICE_GET_DEVICE_PATH, 152 DEVMAN_FUN_SID_TO_HANDLE 153 153 } client_to_devman_t; 154 154 -
uspace/lib/usb/include/usb/hc.h
r12f9f0d0 re280857 38 38 #include <sys/types.h> 39 39 #include <ipc/devman.h> 40 #include <ipc/loc.h> 40 41 #include <ddf/driver.h> 41 42 #include <bool.h> … … 68 69 devman_handle_t *); 69 70 70 int usb_ddf_get_hc_handle_by_ class(size_t, devman_handle_t *);71 int usb_ddf_get_hc_handle_by_sid(service_id_t, devman_handle_t *); 71 72 72 73 -
uspace/lib/usb/src/hc.c
r12f9f0d0 re280857 201 201 /** Get host controller handle by its class index. 202 202 * 203 * @param class_index Class index for the host controller.203 * @param sid Service ID of the HC function. 204 204 * @param hc_handle Where to store the HC handle 205 205 * (can be NULL for existence test only). 206 206 * @return Error code. 207 207 */ 208 int usb_ddf_get_hc_handle_by_class(size_t class_index, 209 devman_handle_t *hc_handle) 210 { 211 char *class_index_str; 212 devman_handle_t hc_handle_tmp; 208 int usb_ddf_get_hc_handle_by_sid(service_id_t sid, devman_handle_t *hc_handle) 209 { 210 devman_handle_t handle; 213 211 int rc; 214 215 rc = asprintf(&class_index_str, "%zu", class_index); 216 if (rc < 0) { 217 return ENOMEM; 218 } 219 rc = devman_device_get_handle_by_class("usbhc", class_index_str, 220 &hc_handle_tmp, 0); 221 free(class_index_str); 222 if (rc != EOK) { 223 return rc; 224 } 225 226 if (hc_handle != NULL) { 227 *hc_handle = hc_handle_tmp; 228 } 229 230 return EOK; 212 213 rc = devman_fun_sid_to_handle(sid, &handle); 214 if (hc_handle != NULL) 215 *hc_handle = handle; 216 217 return rc; 231 218 } 232 219 -
uspace/lib/usb/src/resolve.c
r12f9f0d0 re280857 46 46 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 47 47 { 48 size_t class_index;48 uint64_t sid; 49 49 size_t address; 50 50 int rc; 51 51 char *ptr; 52 52 53 rc = str_ size_t(path, &ptr, 10, false, &class_index);53 rc = str_uint64(path, &ptr, 10, false, &sid); 54 54 if (rc != EOK) { 55 55 return false; … … 64 64 return false; 65 65 } 66 rc = usb_ddf_get_hc_handle_by_ class(class_index, out_hc_handle);66 rc = usb_ddf_get_hc_handle_by_sid(sid, out_hc_handle); 67 67 if (rc != EOK) { 68 68 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
