Changeset f658458 in mainline for uspace/srv/devman
- Timestamp:
- 2010-05-02T20:49:09Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bb864a0
- Parents:
- 25a7e11d
- Location:
- uspace/srv/devman
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r25a7e11d rf658458 679 679 { 680 680 node_t *dev = tree->root_node; 681 // relative path to the device from its parent (but with '/' at the beginning) 681 682 char *rel_path = path; 682 683 char *next_path_elem = NULL; … … 685 686 686 687 while (cont && NULL != dev) { 687 next_path_elem = get_path_elem_end(rel_path +1);688 next_path_elem = get_path_elem_end(rel_path + 1); 688 689 if ('/' == next_path_elem[0]) { 689 690 cont = true; … … 693 694 } 694 695 695 dev = find_node_child(dev, rel_path );696 dev = find_node_child(dev, rel_path + 1); 696 697 697 698 if (cont) { 699 // restore the original path 698 700 next_path_elem[0] = '/'; 699 701 } -
uspace/srv/devman/main.c
r25a7e11d rf658458 291 291 } 292 292 293 /** Find handle for the device instance identified by the device's path in the device tree. 294 */ 295 static void devman_device_get_handle(ipc_callid_t iid, ipc_call_t *icall) 296 { 297 char *pathname; 298 299 /* Get fqdn */ 300 int rc = async_string_receive(&pathname, 0, NULL); 301 if (rc != EOK) { 302 ipc_answer_0(iid, rc); 303 return; 304 } 305 306 node_t * dev = find_dev_node_by_path(&device_tree, pathname); 307 308 free(pathname); 309 310 if (NULL == dev) { 311 ipc_answer_0(iid, ENOENT); 312 return; 313 } 314 315 ipc_answer_1(iid, EOK, dev->handle); 316 } 317 318 319 /** Function for handling connections from a client to the device manager. 320 */ 321 static void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall) 322 { 323 /* Accept connection */ 324 ipc_answer_0(iid, EOK); 325 326 bool cont = true; 327 while (cont) { 328 ipc_call_t call; 329 ipc_callid_t callid = async_get_call(&call); 330 331 switch (IPC_GET_METHOD(call)) { 332 case IPC_M_PHONE_HUNGUP: 333 cont = false; 334 continue; 335 case DEVMAN_DEVICE_GET_HANDLE: 336 devman_device_get_handle(callid, &call); 337 break; 338 default: 339 if (!(callid & IPC_CALLID_NOTIFICATION)) 340 ipc_answer_0(callid, ENOENT); 341 } 342 } 343 } 344 293 345 static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) { 294 346 … … 346 398 devman_connection_driver(iid, icall); 347 399 break; 348 /*case DEVMAN_CLIENT:349 devma p_connection_client(iid, icall);350 break; */400 case DEVMAN_CLIENT: 401 devman_connection_client(iid, icall); 402 break; 351 403 case DEVMAN_CONNECT_TO_DEVICE: 352 404 // Connect client to selected device
Note:
See TracChangeset
for help on using the changeset viewer.