Changeset f658458 in mainline for uspace/srv
- Timestamp:
- 2010-05-02T20:49:09Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bb864a0
- Parents:
- 25a7e11d
- Location:
- uspace/srv
- Files:
-
- 3 edited
-
devman/devman.c (modified) (3 diffs)
-
devman/main.c (modified) (2 diffs)
-
drivers/serial/serial.c (modified) (4 diffs)
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 -
uspace/srv/drivers/serial/serial.c
r25a7e11d rf658458 53 53 54 54 #include <driver.h> 55 #include <char.h> 55 56 #include <resource.h> 56 57 … … 91 92 } 92 93 94 static int serial_read(device_t *dev, char *buf, size_t count) 95 { 96 printf(NAME ": serial_read %s\n", dev->name); 97 // TODO 98 return 0; 99 } 100 101 static int serial_write(device_t *dev, char *buf, size_t count) 102 { 103 // TODO 104 return 0; 105 } 106 93 107 static device_class_t serial_dev_class; 108 109 static char_iface_t serial_char_iface = { 110 .read = &serial_read, 111 .write = &serial_write 112 }; 94 113 95 114 static int serial_add_device(device_t *dev); … … 377 396 serial_unregister_interrupt_handler(dev); 378 397 return res; 379 } 398 } 399 400 dev->class = &serial_dev_class; 380 401 381 402 printf(NAME ": the %s device has been successfully initialized.\n", dev->name); … … 440 461 serial_dev_class.open = &serial_open; 441 462 serial_dev_class.close = &serial_close; 463 464 serial_dev_class.interfaces[CHAR_DEV_IFACE] = &serial_char_iface; 442 465 } 443 466
Note:
See TracChangeset
for help on using the changeset viewer.
