Changeset 2b0db98 in mainline for uspace/lib
- Timestamp:
- 2011-01-07T14:02:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6986418
- Parents:
- d99120f (diff), 0f191a2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 4 added
- 1 deleted
- 32 edited
- 1 moved
-
c/Makefile (modified) (1 diff)
-
c/generic/async.c (modified) (1 diff)
-
c/generic/async_rel.c (deleted)
-
c/generic/async_sess.c (added)
-
c/generic/device/hw_res.c (modified) (1 diff)
-
c/generic/devmap.c (modified) (3 diffs)
-
c/generic/fibril_synch.c (modified) (6 diffs)
-
c/generic/libc.c (modified) (2 diffs)
-
c/generic/net/icmp_api.c (modified) (1 diff)
-
c/generic/net/inet.c (modified) (6 diffs)
-
c/generic/net/modules.c (modified) (6 diffs)
-
c/generic/net/packet.c (modified) (1 diff)
-
c/generic/net/socket_client.c (modified) (49 diffs)
-
c/generic/task.c (modified) (1 diff)
-
c/include/async.h (modified) (1 diff)
-
c/include/async_sess.h (added)
-
c/include/device/hw_res.h (modified) (1 diff)
-
c/include/devmap.h (modified) (1 diff)
-
c/include/fibril_synch.h (modified) (2 diffs)
-
c/include/ipc/dev_iface.h (modified) (1 diff)
-
c/include/ipc/devman.h (modified) (1 diff)
-
c/include/ipc/kbd.h (modified) (1 diff)
-
c/include/net/modules.h (modified) (2 diffs)
-
c/include/net/socket.h (modified) (1 diff)
-
c/include/task.h (modified) (1 diff)
-
drv/Makefile (modified) (1 diff)
-
drv/generic/dev_iface.c (modified) (2 diffs)
-
drv/generic/remote_usb.c (added)
-
drv/generic/remote_usbhc.c (modified) (2 diffs)
-
drv/include/remote_usb.h (moved) (moved from uspace/lib/c/include/async_rel.h ) (3 diffs)
-
drv/include/usb_iface.h (added)
-
drv/include/usbhc_iface.h (modified) (2 diffs)
-
packet/generic/packet_server.c (modified) (4 diffs)
-
usb/include/usb/hcdhubd.h (modified) (1 diff)
-
usb/include/usb/usbdrv.h (modified) (1 diff)
-
usb/src/hcdhubd.c (modified) (3 diffs)
-
usb/src/recognise.c (modified) (3 diffs)
-
usb/src/usbdrv.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rd99120f r2b0db98 87 87 generic/ipc.c \ 88 88 generic/async.c \ 89 generic/async_ rel.c \89 generic/async_sess.c \ 90 90 generic/loader.c \ 91 91 generic/getopt.c \ -
uspace/lib/c/generic/async.c
rd99120f r2b0db98 749 749 return ENOMEM; 750 750 } 751 752 _async_sess_init(); 751 753 752 754 return 0; -
uspace/lib/c/generic/device/hw_res.c
rd99120f r2b0db98 38 38 #include <malloc.h> 39 39 40 boolget_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)40 int get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources) 41 41 { 42 42 sysarg_t count = 0; 43 43 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count); 44 44 hw_resources->count = count; 45 if (EOK != rc) { 46 return false; 47 } 45 if (rc != EOK) 46 return rc; 48 47 49 48 size_t size = count * sizeof(hw_resource_t); 50 49 hw_resources->resources = (hw_resource_t *)malloc(size); 51 if (NULL == hw_resources->resources) { 52 return false; 53 } 50 if (!hw_resources->resources) 51 return ENOMEM; 54 52 55 53 rc = async_data_read_start(dev_phone, hw_resources->resources, size); 56 if ( EOK != rc) {54 if (rc != EOK) { 57 55 free(hw_resources->resources); 58 56 hw_resources->resources = NULL; 59 return false;57 return rc; 60 58 } 61 59 62 return true;60 return EOK; 63 61 } 64 62 -
uspace/lib/c/generic/devmap.c
rd99120f r2b0db98 127 127 /** Register new device. 128 128 * 129 * @param namespace Namespace name. 129 * The @p interface is used when forwarding connection to the driver. 130 * If not 0, the first argument is the interface and the second argument 131 * is the devmap handle of the device. 132 * When the interface is zero (default), the first argument is directly 133 * the handle (to ensure backward compatibility). 134 * 135 * @param fqdn Fully qualified device name. 136 * @param[out] handle Handle to the created instance of device. 137 * @param interface Interface when forwarding. 138 * 139 */ 140 int devmap_device_register_with_iface(const char *fqdn, 141 devmap_handle_t *handle, sysarg_t interface) 142 { 143 int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING); 144 145 if (phone < 0) 146 return phone; 147 148 async_serialize_start(); 149 150 ipc_call_t answer; 151 aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, interface, 0, 152 &answer); 153 154 sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn)); 155 if (retval != EOK) { 156 async_wait_for(req, NULL); 157 async_serialize_end(); 158 return retval; 159 } 160 161 async_wait_for(req, &retval); 162 163 async_serialize_end(); 164 165 if (retval != EOK) { 166 if (handle != NULL) 167 *handle = -1; 168 return retval; 169 } 170 171 if (handle != NULL) 172 *handle = (devmap_handle_t) IPC_GET_ARG1(answer); 173 174 return retval; 175 } 176 177 /** Register new device. 178 * 130 179 * @param fqdn Fully qualified device name. 131 180 * @param handle Output: Handle to the created instance of device. … … 134 183 int devmap_device_register(const char *fqdn, devmap_handle_t *handle) 135 184 { 136 int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING); 137 138 if (phone < 0) 139 return phone; 140 141 async_serialize_start(); 142 143 ipc_call_t answer; 144 aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, 0, 0, 145 &answer); 146 147 sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn)); 148 if (retval != EOK) { 149 async_wait_for(req, NULL); 150 async_serialize_end(); 151 return retval; 152 } 153 154 async_wait_for(req, &retval); 155 156 async_serialize_end(); 157 158 if (retval != EOK) { 159 if (handle != NULL) 160 *handle = -1; 161 return retval; 162 } 163 164 if (handle != NULL) 165 *handle = (devmap_handle_t) IPC_GET_ARG1(answer); 166 167 return retval; 168 } 185 return devmap_device_register_with_iface(fqdn, handle, 0); 186 } 187 169 188 170 189 int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags) … … 260 279 261 280 if (flags & IPC_FLAG_BLOCKING) { 262 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,281 phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP, 263 282 DEVMAP_CONNECT_TO_DEVICE, handle); 264 283 } else { 265 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,284 phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAP, 266 285 DEVMAP_CONNECT_TO_DEVICE, handle); 267 286 } -
uspace/lib/c/generic/fibril_synch.c
rd99120f r2b0db98 139 139 static void _fibril_mutex_unlock_unsafe(fibril_mutex_t *fm) 140 140 { 141 assert(fm->counter <= 0);142 141 if (fm->counter++ < 0) { 143 142 link_t *tmp; … … 165 164 void fibril_mutex_unlock(fibril_mutex_t *fm) 166 165 { 166 assert(fibril_mutex_is_locked(fm)); 167 167 futex_down(&async_futex); 168 168 _fibril_mutex_unlock_unsafe(fm); 169 169 futex_up(&async_futex); 170 } 171 172 bool fibril_mutex_is_locked(fibril_mutex_t *fm) 173 { 174 bool locked = false; 175 176 futex_down(&async_futex); 177 if (fm->counter <= 0) 178 locked = true; 179 futex_up(&async_futex); 180 181 return locked; 170 182 } 171 183 … … 230 242 { 231 243 futex_down(&async_futex); 232 assert(frw->readers || (frw->writers == 1));233 244 if (frw->readers) { 234 245 if (--frw->readers) { … … 296 307 void fibril_rwlock_read_unlock(fibril_rwlock_t *frw) 297 308 { 309 assert(fibril_rwlock_is_read_locked(frw)); 298 310 _fibril_rwlock_common_unlock(frw); 299 311 } … … 301 313 void fibril_rwlock_write_unlock(fibril_rwlock_t *frw) 302 314 { 315 assert(fibril_rwlock_is_write_locked(frw)); 303 316 _fibril_rwlock_common_unlock(frw); 317 } 318 319 bool fibril_rwlock_is_read_locked(fibril_rwlock_t *frw) 320 { 321 bool locked = false; 322 323 futex_down(&async_futex); 324 if (frw->readers) 325 locked = true; 326 futex_up(&async_futex); 327 328 return locked; 329 } 330 331 bool fibril_rwlock_is_write_locked(fibril_rwlock_t *frw) 332 { 333 bool locked = false; 334 335 futex_down(&async_futex); 336 if (frw->writers) { 337 assert(frw->writers == 1); 338 locked = true; 339 } 340 futex_up(&async_futex); 341 342 return locked; 343 } 344 345 bool fibril_rwlock_is_locked(fibril_rwlock_t *frw) 346 { 347 return fibril_rwlock_is_read_locked(frw) || 348 fibril_rwlock_is_write_locked(frw); 304 349 } 305 350 … … 314 359 { 315 360 awaiter_t wdata; 361 362 assert(fibril_mutex_is_locked(fm)); 316 363 317 364 if (timeout < 0) -
uspace/lib/c/generic/libc.c
rd99120f r2b0db98 50 50 #include <ipc/ipc.h> 51 51 #include <async.h> 52 #include <async_rel.h>53 52 #include <as.h> 54 53 #include <loader/pcb.h> … … 66 65 __heap_init(); 67 66 __async_init(); 68 (void) async_rel_init();69 67 fibril_t *fibril = fibril_setup(); 70 68 __tcb_set(fibril->tcb); -
uspace/lib/c/generic/net/icmp_api.c
rd99120f r2b0db98 89 89 tos, (sysarg_t) dont_fragment, NULL); 90 90 91 / / send the address91 /* Send the address */ 92 92 async_data_write_start(icmp_phone, addr, (size_t) addrlen); 93 93 -
uspace/lib/c/generic/net/inet.c
rd99120f r2b0db98 64 64 switch (family) { 65 65 case AF_INET: 66 / / check the output buffer size66 /* Check output buffer size */ 67 67 if (length < INET_ADDRSTRLEN) 68 68 return ENOMEM; 69 69 70 / / fill the buffer with the IPv4 address70 /* Fill buffer with IPv4 address */ 71 71 snprintf(address, length, "%hhu.%hhu.%hhu.%hhu", 72 72 data[0], data[1], data[2], data[3]); … … 75 75 76 76 case AF_INET6: 77 / / check the output buffer size77 /* Check output buffer size */ 78 78 if (length < INET6_ADDRSTRLEN) 79 79 return ENOMEM; 80 80 81 / / fill the buffer with the IPv6 address81 /* Fill buffer with IPv6 address */ 82 82 snprintf(address, length, 83 83 "%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:" … … 124 124 return EINVAL; 125 125 126 / / set the processing parameters126 /* Set processing parameters */ 127 127 switch (family) { 128 128 case AF_INET: … … 142 142 } 143 143 144 / / erase if no address144 /* Erase if no address */ 145 145 if (!address) { 146 146 bzero(data, count); … … 148 148 } 149 149 150 / / process the string from the beginning150 /* Process string from the beginning */ 151 151 next = address; 152 152 index = 0; 153 153 do { 154 / / if the actual character is set154 /* If the actual character is set */ 155 155 if (next && *next) { 156 156 157 / / if not on the first character157 /* If not on the first character */ 158 158 if (index) { 159 / / move to the next character159 /* Move to the next character */ 160 160 ++next; 161 161 } 162 162 163 / / parse the actual integral value163 /* Parse the actual integral value */ 164 164 value = strtoul(next, &last, base); 165 // remember the last problematic character 166 // should be either '.' or ':' but is ignored to be more 167 // generic 165 /* 166 * Remember the last problematic character 167 * should be either '.' or ':' but is ignored to be 168 * more generic 169 */ 168 170 next = last; 169 171 170 / / fill the address data byte by byte172 /* Fill the address data byte by byte */ 171 173 shift = bytes - 1; 172 174 do { 173 / / like little endian175 /* like little endian */ 174 176 data[index + shift] = value; 175 177 value >>= 8; … … 178 180 index += bytes; 179 181 } else { 180 / / erase the rest of the address182 /* Erase the rest of the address */ 181 183 bzero(data + index, count - index); 182 184 return EOK; -
uspace/lib/c/generic/net/modules.c
rd99120f r2b0db98 63 63 int answer_count) 64 64 { 65 / / choose the most efficient answer function65 /* Choose the most efficient answer function */ 66 66 if (answer || (!answer_count)) { 67 67 switch (answer_count) { … … 178 178 int phone; 179 179 180 / / if no timeout is set180 /* If no timeout is set */ 181 181 if (timeout <= 0) 182 182 return async_connect_me_to_blocking(PHONE_NS, need, 0, 0); … … 187 187 return phone; 188 188 189 / / end if no time is left189 /* Abort if no time is left */ 190 190 if (timeout <= 0) 191 191 return ETIMEOUT; 192 192 193 / / wait the minimum of the module wait time and the timeout193 /* Wait the minimum of the module wait time and the timeout */ 194 194 usleep((timeout <= MODULE_WAIT_TIME) ? 195 195 timeout : MODULE_WAIT_TIME); 196 196 timeout -= MODULE_WAIT_TIME; 197 197 } 198 }199 200 /** Receives data from the other party.201 *202 * The received data buffer is allocated and returned.203 *204 * @param[out] data The data buffer to be filled.205 * @param[out] length The buffer length.206 * @return EOK on success.207 * @return EBADMEM if the data or the length parameter is NULL.208 * @return EINVAL if the client does not send data.209 * @return ENOMEM if there is not enough memory left.210 * @return Other error codes as defined for the211 * async_data_write_finalize() function.212 */213 int data_receive(void **data, size_t *length)214 {215 ipc_callid_t callid;216 int rc;217 218 if (!data || !length)219 return EBADMEM;220 221 // fetch the request222 if (!async_data_write_receive(&callid, length))223 return EINVAL;224 225 // allocate the buffer226 *data = malloc(*length);227 if (!*data)228 return ENOMEM;229 230 // fetch the data231 rc = async_data_write_finalize(callid, *data, *length);232 if (rc != EOK) {233 free(data);234 return rc;235 }236 237 return EOK;238 198 } 239 199 … … 254 214 ipc_callid_t callid; 255 215 256 / / fetch the request216 /* Fetch the request */ 257 217 if (!async_data_read_receive(&callid, &length)) 258 218 return EINVAL; 259 219 260 / / check the requested data size220 /* Check the requested data size */ 261 221 if (length < data_length) { 262 222 async_data_read_finalize(callid, data, length); … … 264 224 } 265 225 266 / / send the data226 /* Send the data */ 267 227 return async_data_read_finalize(callid, data, data_length); 268 228 } … … 282 242 if (answer) { 283 243 IPC_SET_RETVAL(*answer, 0); 284 / / just to be precize244 /* Just to be precise */ 285 245 IPC_SET_IMETHOD(*answer, 0); 286 246 IPC_SET_ARG1(*answer, 0); -
uspace/lib/c/generic/net/packet.c
rd99120f r2b0db98 191 191 } 192 192 gpm_destroy(&pm_globals.packet_map); 193 / / leave locked193 /* leave locked */ 194 194 } 195 195 -
uspace/lib/c/generic/net/socket_client.c
rd99120f r2b0db98 220 220 fibril_rwlock_read_lock(&socket_globals.lock); 221 221 222 / / find the socket222 /* Find the socket */ 223 223 socket = sockets_find(socket_get_sockets(), 224 224 SOCKET_GET_SOCKET_ID(call)); … … 232 232 case NET_SOCKET_RECEIVED: 233 233 fibril_mutex_lock(&socket->receive_lock); 234 / / push the number of received packet fragments234 /* Push the number of received packet fragments */ 235 235 rc = dyn_fifo_push(&socket->received, 236 236 SOCKET_GET_DATA_FRAGMENTS(call), 237 237 SOCKET_MAX_RECEIVED_SIZE); 238 238 if (rc == EOK) { 239 / / signal the received packet239 /* Signal the received packet */ 240 240 fibril_condvar_signal(&socket->receive_signal); 241 241 } … … 244 244 245 245 case NET_SOCKET_ACCEPTED: 246 / / push the new socket identifier246 /* Push the new socket identifier */ 247 247 fibril_mutex_lock(&socket->accept_lock); 248 248 rc = dyn_fifo_push(&socket->accepted, 1, 249 249 SOCKET_MAX_ACCEPTED_SIZE); 250 250 if (rc == EOK) { 251 / / signal the accepted socket251 /* Signal the accepted socket */ 252 252 fibril_condvar_signal(&socket->accept_signal); 253 253 } … … 264 264 fibril_rwlock_write_lock(&socket->sending_lock); 265 265 266 / / set the data fragment size266 /* Set the data fragment size */ 267 267 socket->data_fragment_size = 268 268 SOCKET_GET_DATA_FRAGMENT_SIZE(call); … … 342 342 socket_id = 1; 343 343 ++count; 344 / / only this branch for last_id344 /* Only this branch for last_id */ 345 345 } else { 346 346 if (socket_id < INT_MAX) { … … 408 408 int rc; 409 409 410 / / find the appropriate service410 /* Find the appropriate service */ 411 411 switch (domain) { 412 412 case PF_INET: … … 457 457 return phone; 458 458 459 / / create a new socket structure459 /* Create a new socket structure */ 460 460 socket = (socket_t *) malloc(sizeof(socket_t)); 461 461 if (!socket) … … 465 465 fibril_rwlock_write_lock(&socket_globals.lock); 466 466 467 / / request a new socket467 /* Request a new socket */ 468 468 socket_id = socket_generate_new_id(); 469 469 if (socket_id <= 0) { … … 484 484 socket->header_size = (size_t) header_size; 485 485 486 / / finish the new socket initialization486 /* Finish the new socket initialization */ 487 487 socket_initialize(socket, socket_id, phone, service); 488 / / store the new socket488 /* Store the new socket */ 489 489 rc = sockets_add(socket_get_sockets(), socket_id, socket); 490 490 … … 531 531 fibril_rwlock_read_lock(&socket_globals.lock); 532 532 533 / / find the socket533 /* Find the socket */ 534 534 socket = sockets_find(socket_get_sockets(), socket_id); 535 535 if (!socket) { … … 538 538 } 539 539 540 / / request the message540 /* Request the message */ 541 541 message_id = async_send_3(socket->phone, message, 542 542 (sysarg_t) socket->socket_id, arg2, socket->service, NULL); 543 / / send the address543 /* Send the address */ 544 544 async_data_write_start(socket->phone, data, datalength); 545 545 … … 566 566 return EINVAL; 567 567 568 / / send the address568 /* Send the address */ 569 569 return socket_send_data(socket_id, NET_SOCKET_BIND, 0, my_addr, 570 570 (size_t) addrlen); … … 591 591 fibril_rwlock_read_lock(&socket_globals.lock); 592 592 593 / / find the socket593 /* Find the socket */ 594 594 socket = sockets_find(socket_get_sockets(), socket_id); 595 595 if (!socket) { … … 598 598 } 599 599 600 / / request listen backlog change600 /* Request listen backlog change */ 601 601 result = (int) async_req_3_0(socket->phone, NET_SOCKET_LISTEN, 602 602 (sysarg_t) socket->socket_id, (sysarg_t) backlog, socket->service); … … 634 634 fibril_rwlock_write_lock(&socket_globals.lock); 635 635 636 / / find the socket636 /* Find the socket */ 637 637 socket = sockets_find(socket_get_sockets(), socket_id); 638 638 if (!socket) { … … 643 643 fibril_mutex_lock(&socket->accept_lock); 644 644 645 / / wait for an accepted socket645 /* Wait for an accepted socket */ 646 646 ++ socket->blocked; 647 647 while (dyn_fifo_value(&socket->accepted) <= 0) { 648 648 fibril_rwlock_write_unlock(&socket_globals.lock); 649 649 fibril_condvar_wait(&socket->accept_signal, &socket->accept_lock); 650 / / drop the accept lock to avoid deadlock650 /* Drop the accept lock to avoid deadlock */ 651 651 fibril_mutex_unlock(&socket->accept_lock); 652 652 fibril_rwlock_write_lock(&socket_globals.lock); … … 655 655 -- socket->blocked; 656 656 657 / / create a new scoket657 /* Create a new socket */ 658 658 new_socket = (socket_t *) malloc(sizeof(socket_t)); 659 659 if (!new_socket) { … … 681 681 } 682 682 683 / / request accept683 /* Request accept */ 684 684 message_id = async_send_5(socket->phone, NET_SOCKET_ACCEPT, 685 685 (sysarg_t) socket->socket_id, 0, socket->service, 0, 686 686 new_socket->socket_id, &answer); 687 687 688 / / read address688 /* Read address */ 689 689 ipc_data_read_start(socket->phone, cliaddr, *addrlen); 690 690 fibril_rwlock_write_unlock(&socket_globals.lock); … … 695 695 result = EINVAL; 696 696 697 / / dequeue the accepted socket if successful697 /* Dequeue the accepted socket if successful */ 698 698 dyn_fifo_pop(&socket->accepted); 699 / / set address length699 /* Set address length */ 700 700 *addrlen = SOCKET_GET_ADDRESS_LENGTH(answer); 701 701 new_socket->data_fragment_size = 702 702 SOCKET_GET_DATA_FRAGMENT_SIZE(answer); 703 703 } else if (result == ENOTSOCK) { 704 / / empty the queue if no accepted sockets704 /* Empty the queue if no accepted sockets */ 705 705 while (dyn_fifo_pop(&socket->accepted) > 0) 706 706 ; … … 731 731 return EDESTADDRREQ; 732 732 733 / / send the address733 /* Send the address */ 734 734 return socket_send_data(socket_id, NET_SOCKET_CONNECT, 0, serv_addr, 735 735 addrlen); … … 744 744 int accepted_id; 745 745 746 / / destroy all accepted sockets746 /* Destroy all accepted sockets */ 747 747 while ((accepted_id = dyn_fifo_pop(&socket->accepted)) >= 0) 748 748 socket_destroy(sockets_find(socket_get_sockets(), accepted_id)); … … 780 780 } 781 781 782 / / request close782 /* Request close */ 783 783 rc = (int) async_req_3_0(socket->phone, NET_SOCKET_CLOSE, 784 784 (sysarg_t) socket->socket_id, 0, socket->service); … … 787 787 return rc; 788 788 } 789 / / free the socket structure789 /* Free the socket structure */ 790 790 socket_destroy(socket); 791 791 … … 833 833 fibril_rwlock_read_lock(&socket_globals.lock); 834 834 835 / / find socket835 /* Find socket */ 836 836 socket = sockets_find(socket_get_sockets(), socket_id); 837 837 if (!socket) { … … 842 842 fibril_rwlock_read_lock(&socket->sending_lock); 843 843 844 / / compute data fragment count844 /* Compute data fragment count */ 845 845 if (socket->data_fragment_size > 0) { 846 846 fragments = (datalength + socket->header_size) / … … 853 853 } 854 854 855 / / request send855 /* Request send */ 856 856 message_id = async_send_5(socket->phone, message, 857 857 (sysarg_t) socket->socket_id, … … 859 859 socket->service, (sysarg_t) flags, fragments, &answer); 860 860 861 / / send the address if given861 /* Send the address if given */ 862 862 if (!toaddr || 863 863 (async_data_write_start(socket->phone, toaddr, addrlen) == EOK)) { 864 864 if (fragments == 1) { 865 / / send all if only one fragment865 /* Send all if only one fragment */ 866 866 async_data_write_start(socket->phone, data, datalength); 867 867 } else { 868 / / send the first fragment868 /* Send the first fragment */ 869 869 async_data_write_start(socket->phone, data, 870 870 socket->data_fragment_size - socket->header_size); … … 872 872 socket->data_fragment_size - socket->header_size; 873 873 874 / / send the middle fragments874 /* Send the middle fragments */ 875 875 while (--fragments > 1) { 876 876 async_data_write_start(socket->phone, data, … … 880 880 } 881 881 882 / / send the last fragment882 /* Send the last fragment */ 883 883 async_data_write_start(socket->phone, data, 884 884 (datalength + socket->header_size) % … … 892 892 (SOCKET_GET_DATA_FRAGMENT_SIZE(answer) != 893 893 socket->data_fragment_size)) { 894 / / set the data fragment size894 /* Set the data fragment size */ 895 895 socket->data_fragment_size = 896 896 SOCKET_GET_DATA_FRAGMENT_SIZE(answer); … … 917 917 int send(int socket_id, void *data, size_t datalength, int flags) 918 918 { 919 / / without the address919 /* Without the address */ 920 920 return sendto_core(NET_SOCKET_SEND, socket_id, data, datalength, flags, 921 921 NULL, 0); … … 950 950 return EDESTADDRREQ; 951 951 952 / / with the address952 /* With the address */ 953 953 return sendto_core(NET_SOCKET_SENDTO, socket_id, data, datalength, 954 954 flags, toaddr, addrlen); … … 966 966 * read. The actual address length is set. Used only if 967 967 * fromaddr is not NULL. 968 * @return EOK on success. 968 * @return Positive received message size in bytes on success. 969 * @return Zero if no more data (other side closed the connection). 969 970 * @return ENOTSOCK if the socket is not found. 970 971 * @return EBADMEM if the data parameter is NULL. … … 972 973 * @return Other error codes as defined for the spcific message. 973 974 */ 974 static int975 static ssize_t 975 976 recvfrom_core(sysarg_t message, int socket_id, void *data, size_t datalength, 976 977 int flags, struct sockaddr *fromaddr, socklen_t *addrlen) … … 984 985 size_t index; 985 986 ipc_call_t answer; 987 ssize_t retval; 986 988 987 989 if (!data) … … 996 998 fibril_rwlock_read_lock(&socket_globals.lock); 997 999 998 / / find the socket1000 /* Find the socket */ 999 1001 socket = sockets_find(socket_get_sockets(), socket_id); 1000 1002 if (!socket) { … … 1004 1006 1005 1007 fibril_mutex_lock(&socket->receive_lock); 1006 / / wait for a received packet1008 /* Wait for a received packet */ 1007 1009 ++socket->blocked; 1008 while ((result = dyn_fifo_value(&socket->received)) < =0) {1010 while ((result = dyn_fifo_value(&socket->received)) < 0) { 1009 1011 fibril_rwlock_read_unlock(&socket_globals.lock); 1010 1012 fibril_condvar_wait(&socket->receive_signal, 1011 1013 &socket->receive_lock); 1012 1014 1013 / / drop the receive lock to avoid deadlock1015 /* Drop the receive lock to avoid deadlock */ 1014 1016 fibril_mutex_unlock(&socket->receive_lock); 1015 1017 fibril_rwlock_read_lock(&socket_globals.lock); … … 1019 1021 fragments = (size_t) result; 1020 1022 1021 // prepare lengths if more fragments 1023 if (fragments == 0) { 1024 /* No more data, other side has closed the connection. */ 1025 fibril_mutex_unlock(&socket->receive_lock); 1026 fibril_rwlock_read_unlock(&socket_globals.lock); 1027 return 0; 1028 } 1029 1030 /* Prepare lengths if more fragments */ 1022 1031 if (fragments > 1) { 1023 1032 lengths = (size_t *) malloc(sizeof(size_t) * fragments + … … 1029 1038 } 1030 1039 1031 / / request packet data1040 /* Request packet data */ 1032 1041 message_id = async_send_4(socket->phone, message, 1033 1042 (sysarg_t) socket->socket_id, 0, socket->service, 1034 1043 (sysarg_t) flags, &answer); 1035 1044 1036 / / read the address if desired1045 /* Read the address if desired */ 1037 1046 if(!fromaddr || 1038 1047 (async_data_read_start(socket->phone, fromaddr, 1039 1048 *addrlen) == EOK)) { 1040 / / read the fragment lengths1049 /* Read the fragment lengths */ 1041 1050 if (async_data_read_start(socket->phone, lengths, 1042 1051 sizeof(int) * (fragments + 1)) == EOK) { 1043 1052 if (lengths[fragments] <= datalength) { 1044 1053 1045 / / read all fragments if long enough1054 /* Read all fragments if long enough */ 1046 1055 for (index = 0; index < fragments; 1047 1056 ++index) { … … 1057 1066 1058 1067 free(lengths); 1059 } else { 1060 / / request packet data1068 } else { /* fragments == 1 */ 1069 /* Request packet data */ 1061 1070 message_id = async_send_4(socket->phone, message, 1062 1071 (sysarg_t) socket->socket_id, 0, socket->service, 1063 1072 (sysarg_t) flags, &answer); 1064 1073 1065 / / read the address if desired1074 /* Read the address if desired */ 1066 1075 if (!fromaddr || 1067 1076 (async_data_read_start(socket->phone, fromaddr, 1068 1077 *addrlen) == EOK)) { 1069 / / read all if only one fragment1078 /* Read all if only one fragment */ 1070 1079 async_data_read_start(socket->phone, data, datalength); 1071 1080 } … … 1075 1084 result = (int) ipc_result; 1076 1085 if (result == EOK) { 1077 / / dequeue the received packet1086 /* Dequeue the received packet */ 1078 1087 dyn_fifo_pop(&socket->received); 1079 / / return read data length1080 re sult= SOCKET_GET_READ_DATA_LENGTH(answer);1081 / / set address length1088 /* Return read data length */ 1089 retval = SOCKET_GET_READ_DATA_LENGTH(answer); 1090 /* Set address length */ 1082 1091 if (fromaddr && addrlen) 1083 1092 *addrlen = SOCKET_GET_ADDRESS_LENGTH(answer); 1093 } else { 1094 retval = (ssize_t) result; 1084 1095 } 1085 1096 1086 1097 fibril_mutex_unlock(&socket->receive_lock); 1087 1098 fibril_rwlock_read_unlock(&socket_globals.lock); 1088 return re sult;1099 return retval; 1089 1100 } 1090 1101 … … 1095 1106 * @param[in] datalength The data length. 1096 1107 * @param[in] flags Various receive flags. 1097 * @return EOK on success. 1108 * @return Positive received message size in bytes on success. 1109 * @return Zero if no more data (other side closed the connection). 1098 1110 * @return ENOTSOCK if the socket is not found. 1099 1111 * @return EBADMEM if the data parameter is NULL. … … 1102 1114 * message. 1103 1115 */ 1104 int recv(int socket_id, void *data, size_t datalength, int flags)1105 { 1106 / / without the address1116 ssize_t recv(int socket_id, void *data, size_t datalength, int flags) 1117 { 1118 /* Without the address */ 1107 1119 return recvfrom_core(NET_SOCKET_RECV, socket_id, data, datalength, 1108 1120 flags, NULL, NULL); … … 1118 1130 * @param[in,out] addrlen The address length. The maximum address length is 1119 1131 * read. The actual address length is set. 1120 * @return EOK on success. 1132 * @return Positive received message size in bytes on success. 1133 * @return Zero if no more data (other side closed the connection). 1121 1134 * @return ENOTSOCK if the socket is not found. 1122 1135 * @return EBADMEM if the data or fromaddr parameter is NULL. … … 1125 1138 * message. 1126 1139 */ 1127 int1140 ssize_t 1128 1141 recvfrom(int socket_id, void *data, size_t datalength, int flags, 1129 1142 struct sockaddr *fromaddr, socklen_t *addrlen) … … 1135 1148 return NO_DATA; 1136 1149 1137 / / with the address1150 /* With the address */ 1138 1151 return recvfrom_core(NET_SOCKET_RECVFROM, socket_id, data, datalength, 1139 1152 flags, fromaddr, addrlen); … … 1170 1183 fibril_rwlock_read_lock(&socket_globals.lock); 1171 1184 1172 / / find the socket1185 /* Find the socket */ 1173 1186 socket = sockets_find(socket_get_sockets(), socket_id); 1174 1187 if (!socket) { … … 1177 1190 } 1178 1191 1179 / / request option value1192 /* Request option value */ 1180 1193 message_id = async_send_3(socket->phone, NET_SOCKET_GETSOCKOPT, 1181 1194 (sysarg_t) socket->socket_id, (sysarg_t) optname, socket->service, 1182 1195 NULL); 1183 1196 1184 / / read the length1197 /* Read the length */ 1185 1198 if (async_data_read_start(socket->phone, optlen, 1186 1199 sizeof(*optlen)) == EOK) { 1187 / / read the value1200 /* Read the value */ 1188 1201 async_data_read_start(socket->phone, value, *optlen); 1189 1202 } … … 1212 1225 size_t optlen) 1213 1226 { 1214 / / send the value1227 /* Send the value */ 1215 1228 return socket_send_data(socket_id, NET_SOCKET_SETSOCKOPT, 1216 1229 (sysarg_t) optname, value, optlen); -
uspace/lib/c/generic/task.c
rd99120f r2b0db98 65 65 * 66 66 * @return Zero on success or negative error code. 67 *68 67 */ 69 68 int task_set_name(const char *name) 70 69 { 71 70 return __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name)); 71 } 72 73 /** Kill a task. 74 * 75 * @param task_id ID of task to kill. 76 * 77 * @return Zero on success or negative error code. 78 */ 79 80 int task_kill(task_id_t task_id) 81 { 82 return (int) __SYSCALL1(SYS_TASK_KILL, (sysarg_t) &task_id); 72 83 } 73 84 -
uspace/lib/c/include/async.h
rd99120f r2b0db98 37 37 38 38 #include <ipc/ipc.h> 39 #include <async_sess.h> 39 40 #include <fibril.h> 40 41 #include <sys/time.h> -
uspace/lib/c/include/device/hw_res.h
rd99120f r2b0db98 95 95 96 96 97 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources); 98 99 bool enable_interrupt(int dev_phone); 97 extern int get_hw_resources(int, hw_resource_list_t *); 98 extern bool enable_interrupt(int); 100 99 101 100 -
uspace/lib/c/include/devmap.h
rd99120f r2b0db98 45 45 extern int devmap_driver_register(const char *, async_client_conn_t); 46 46 extern int devmap_device_register(const char *, devmap_handle_t *); 47 extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t); 47 48 48 49 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int); -
uspace/lib/c/include/fibril_synch.h
rd99120f r2b0db98 105 105 extern bool fibril_mutex_trylock(fibril_mutex_t *); 106 106 extern void fibril_mutex_unlock(fibril_mutex_t *); 107 extern bool fibril_mutex_is_locked(fibril_mutex_t *); 107 108 108 109 extern void fibril_rwlock_initialize(fibril_rwlock_t *); … … 111 112 extern void fibril_rwlock_read_unlock(fibril_rwlock_t *); 112 113 extern void fibril_rwlock_write_unlock(fibril_rwlock_t *); 114 extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *); 115 extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *); 116 extern bool fibril_rwlock_is_locked(fibril_rwlock_t *); 113 117 114 118 extern void fibril_condvar_initialize(fibril_condvar_t *); -
uspace/lib/c/include/ipc/dev_iface.h
rd99120f r2b0db98 39 39 CHAR_DEV_IFACE, 40 40 41 /** Interface provided by any USB device. */ 42 USB_DEV_IFACE, 41 43 /** Interface provided by USB host controller. */ 42 44 USBHC_DEV_IFACE, -
uspace/lib/c/include/ipc/devman.h
rd99120f r2b0db98 123 123 DEVMAN_CLIENT, 124 124 DEVMAN_CONNECT_TO_DEVICE, 125 DEVMAN_CONNECT_FROM_DEVMAP, 125 126 DEVMAN_CONNECT_TO_PARENTS_DEVICE 126 127 } devman_interface_t; -
uspace/lib/c/include/ipc/kbd.h
rd99120f r2b0db98 39 39 40 40 #include <ipc/ipc.h> 41 #include <ipc/dev_iface.h> 41 42 42 43 typedef enum { 43 KBD_YIELD = IPC_FIRST_USER_METHOD,44 KBD_YIELD = DEV_FIRST_CUSTOM_METHOD, 44 45 KBD_RECLAIM 45 46 } kbd_request_t; -
uspace/lib/c/include/net/modules.h
rd99120f r2b0db98 49 49 #include <sys/time.h> 50 50 51 /** Converts the data length between different types.52 *53 * @param[in] type_from The source type.54 * @param[in] type_to The destination type.55 * @param[in] count The number units of the source type size.56 */57 #define CONVERT_SIZE(type_from, type_to, count) \58 ((sizeof(type_from) / sizeof(type_to)) * (count))59 60 /** Registers the module service at the name server.61 *62 * @param[in] me The module service.63 * @param[out] phonehash The created phone hash.64 */65 #define REGISTER_ME(me, phonehash) \66 ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash))67 68 51 /** Connect to the needed module function type definition. 69 52 * … … 80 63 extern int connect_to_service(services_t); 81 64 extern int connect_to_service_timeout(services_t, suseconds_t); 82 extern int data_receive(void **, size_t *);83 65 extern int data_reply(void *, size_t); 84 66 extern void refresh_answer(ipc_call_t *, int *); -
uspace/lib/c/include/net/socket.h
rd99120f r2b0db98 60 60 extern int sendto(int, const void *, size_t, int, const struct sockaddr *, 61 61 socklen_t); 62 extern int recv(int, void *, size_t, int);63 extern int recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);62 extern ssize_t recv(int, void *, size_t, int); 63 extern ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); 64 64 extern int getsockopt(int, int, int, void *, size_t *); 65 65 extern int setsockopt(int, int, int, const void *, size_t); -
uspace/lib/c/include/task.h
rd99120f r2b0db98 47 47 extern task_id_t task_get_id(void); 48 48 extern int task_set_name(const char *); 49 extern int task_kill(task_id_t); 50 49 51 extern task_id_t task_spawn(const char *, const char *const[], int *); 50 52 extern int task_spawnv(task_id_t *, const char *path, const char *const []); -
uspace/lib/drv/Makefile
rd99120f r2b0db98 36 36 generic/dev_iface.c \ 37 37 generic/remote_res.c \ 38 generic/remote_usb.c \ 38 39 generic/remote_usbhc.c \ 39 40 generic/remote_char.c -
uspace/lib/drv/generic/dev_iface.c
rd99120f r2b0db98 39 39 #include "remote_res.h" 40 40 #include "remote_char.h" 41 #include "remote_usb.h" 41 42 #include "remote_usbhc.h" 42 43 … … 45 46 &remote_res_iface, 46 47 &remote_char_iface, 48 &remote_usb_iface, 47 49 &remote_usbhc_iface 48 50 } -
uspace/lib/drv/generic/remote_usbhc.c
rd99120f r2b0db98 59 59 //static void remote_usbhc(device_t *, void *, ipc_callid_t, ipc_call_t *); 60 60 61 /** Remote USB interface operations. */61 /** Remote USB host controller interface operations. */ 62 62 static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = { 63 63 remote_usbhc_get_address, … … 84 84 }; 85 85 86 /** Remote USB interface structure.86 /** Remote USB host controller interface structure. 87 87 */ 88 88 remote_iface_t remote_usbhc_iface = { -
uspace/lib/drv/include/remote_usb.h
rd99120f r2b0db98 1 1 /* 2 * Copyright (c) 2010 Jakub Jermar2 * Copyright (c) 2010 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib c29 /** @addtogroup libdrv 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef LIB C_ASYNC_REL_H_36 #define LIB C_ASYNC_REL_H_35 #ifndef LIBDRV_REMOTE_USB_H_ 36 #define LIBDRV_REMOTE_USB_H_ 37 37 38 extern int async_rel_init(void); 39 extern int async_relation_create(int); 40 extern void async_relation_destroy(int, int); 38 remote_iface_t remote_usb_iface; 41 39 42 40 #endif 43 41 44 /** @} 42 /** 43 * @} 45 44 */ -
uspace/lib/drv/include/usbhc_iface.h
rd99120f r2b0db98 31 31 */ 32 32 /** @file 33 * @brief USB interface definition.33 * @brief USB host controller interface definition. 34 34 */ 35 35 … … 226 226 usbhc_iface_transfer_in_callback_t, void *); 227 227 228 /** USB devicescommunication interface. */228 /** USB host controller communication interface. */ 229 229 typedef struct { 230 230 int (*tell_address)(device_t *, devman_handle_t, usb_address_t *); -
uspace/lib/packet/generic/packet_server.c
rd99120f r2b0db98 135 135 /** Creates a new packet of dimensions at least as given. 136 136 * 137 * Should be used only when the global data are locked.138 *139 137 * @param[in] length The total length of the packet, including the header, 140 138 * the addresses and the data of the packet. … … 153 151 packet_t *packet; 154 152 int rc; 153 154 assert(fibril_mutex_is_locked(&ps_globals.lock)); 155 155 156 156 // already locked … … 233 233 /** Release the packet and returns it to the appropriate free packet queue. 234 234 * 235 * Should be used only when the global data are locked.236 *237 235 * @param[in] packet The packet to be released. 238 236 * … … 242 240 int index; 243 241 int result; 242 243 assert(fibril_mutex_is_locked(&ps_globals.lock)); 244 244 245 245 for (index = 0; (index < FREE_QUEUES_COUNT - 1) && -
uspace/lib/usb/include/usb/hcdhubd.h
rd99120f r2b0db98 207 207 int usb_hc_add_child_device(device_t *, const char *, const char *, bool); 208 208 209 210 /** 211 * @} 212 */ 213 209 214 #endif -
uspace/lib/usb/include/usb/usbdrv.h
rd99120f r2b0db98 41 41 #include <usb/descriptor.h> 42 42 43 int usb_drv_hc_connect(device_t *, unsigned int); 43 int usb_drv_find_hc(device_t *, devman_handle_t *); 44 int usb_drv_hc_connect(device_t *, devman_handle_t, unsigned int); 45 int usb_drv_hc_connect_auto(device_t *, unsigned int); 44 46 45 47 int usb_drv_reserve_default_address(int); -
uspace/lib/usb/src/hcdhubd.c
rd99120f r2b0db98 36 36 #include <usb/devreq.h> 37 37 #include <usbhc_iface.h> 38 #include <usb_iface.h> 38 39 #include <usb/descriptor.h> 39 40 #include <driver.h> … … 45 46 #include "hcdhubd_private.h" 46 47 48 49 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle) 50 { 51 assert(dev); 52 assert(dev->parent != NULL); 53 54 device_t *parent = dev->parent; 55 56 if (parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) { 57 usb_iface_t *usb_iface 58 = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE]; 59 assert(usb_iface != NULL); 60 if (usb_iface->get_hc_handle) { 61 int rc = usb_iface->get_hc_handle(parent, handle); 62 return rc; 63 } 64 } 65 66 return ENOTSUP; 67 } 68 69 static usb_iface_t usb_iface = { 70 .get_hc_handle = usb_iface_get_hc_handle 71 }; 72 73 static device_ops_t child_ops = { 74 .interfaces[USB_DEV_IFACE] = &usb_iface 75 }; 76 47 77 /** Callback when new device is detected and must be handled by this driver. 48 78 * … … 129 159 } 130 160 child->name = child_info->name; 161 child->parent = child_info->parent; 162 child->ops = &child_ops; 131 163 132 164 match_id = create_match_id(); -
uspace/lib/usb/src/recognise.c
rd99120f r2b0db98 33 33 * @brief Functions for recognising kind of attached devices. 34 34 */ 35 #include <usb_iface.h> 35 36 #include <usb/usbdrv.h> 36 37 #include <usb/classes/classes.h> … … 38 39 #include <errno.h> 39 40 41 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle) 42 { 43 assert(dev); 44 assert(dev->parent != NULL); 45 46 device_t *parent = dev->parent; 47 48 if (parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) { 49 usb_iface_t *usb_iface 50 = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE]; 51 assert(usb_iface != NULL); 52 if (usb_iface->get_hc_handle) { 53 int rc = usb_iface->get_hc_handle(parent, handle); 54 return rc; 55 } 56 } 57 58 return ENOTSUP; 59 } 60 61 static usb_iface_t usb_iface = { 62 .get_hc_handle = usb_iface_get_hc_handle 63 }; 64 65 static device_ops_t child_ops = { 66 .interfaces[USB_DEV_IFACE] = &usb_iface 67 }; 40 68 41 69 #define BCD_INT(a) (((unsigned int)(a)) / 256) … … 285 313 goto failure; 286 314 } 315 child->parent = parent; 287 316 child->name = child_name; 317 child->ops = &child_ops; 288 318 289 319 rc = usb_drv_create_device_match_ids(hc, &child->match_ids, address); -
uspace/lib/usb/src/usbdrv.c
rd99120f r2b0db98 35 35 #include <usb/usbdrv.h> 36 36 #include <usbhc_iface.h> 37 #include <usb_iface.h> 37 38 #include <errno.h> 38 39 #include <str_error.h> … … 54 55 } transfer_info_t; 55 56 57 /** Find handle of host controller the device is physically attached to. 58 * 59 * @param[in] dev Device looking for its host controller. 60 * @param[out] handle Host controller devman handle. 61 * @return Error code. 62 */ 63 int usb_drv_find_hc(device_t *dev, devman_handle_t *handle) 64 { 65 if (dev == NULL) { 66 return EBADMEM; 67 } 68 if (handle == NULL) { 69 return EBADMEM; 70 } 71 72 int parent_phone = devman_parent_device_connect(dev->handle, 73 IPC_FLAG_BLOCKING); 74 if (parent_phone < 0) { 75 return parent_phone; 76 } 77 78 devman_handle_t h; 79 int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE), 80 IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h); 81 82 ipc_hangup(parent_phone); 83 84 if (rc != EOK) { 85 return rc; 86 } 87 88 *handle = h; 89 90 return EOK; 91 } 92 93 /** Connect to host controller the device is physically attached to. 94 * 95 * @param dev Device asking for connection. 96 * @param hc_handle Devman handle of the host controller. 97 * @param flags Connection flags (blocking connection). 98 * @return Phone to the HC or error code. 99 */ 100 int usb_drv_hc_connect(device_t *dev, devman_handle_t hc_handle, 101 unsigned int flags) 102 { 103 return devman_device_connect(hc_handle, flags); 104 } 105 56 106 /** Connect to host controller the device is physically attached to. 57 107 * … … 60 110 * @return Phone to corresponding HC or error code. 61 111 */ 62 int usb_drv_hc_connect(device_t *dev, unsigned int flags) 63 { 112 int usb_drv_hc_connect_auto(device_t *dev, unsigned int flags) 113 { 114 int rc; 115 devman_handle_t hc_handle; 116 64 117 /* 65 118 * Call parent hub to obtain device handle of respective HC. 66 119 */ 67 68 /* 69 * FIXME: currently we connect always to virtual host controller. 70 */ 71 int rc; 72 devman_handle_t handle; 73 74 rc = devman_device_get_handle("/virt/usbhc", &handle, flags); 120 rc = usb_drv_find_hc(dev, &hc_handle); 75 121 if (rc != EOK) { 76 122 return rc; 77 123 } 78 124 79 int phone = devman_device_connect(handle, flags); 80 81 return phone; 125 return usb_drv_hc_connect(dev, hc_handle, flags); 82 126 } 83 127
Note:
See TracChangeset
for help on using the changeset viewer.
