Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 58854f2 in mainline


Ignore:
Timestamp:
2010-12-20T08:21:33Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
1522b42
Parents:
5863a95 (diff), 8dd039a (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.
Message:

Merge development/ changes

Files:
8 added
35 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r5863a95 r58854f2  
    2828
    2929CSCOPE = cscope
     30CHECK = tools/check.sh
    3031CONFIG = tools/config.py
    3132AUTOTOOL = tools/autotool.py
     
    4142CONFIG_HEADER = config.h
    4243
    43 .PHONY: all precheck cscope autotool config_auto config_default config distclean clean
     44.PHONY: all precheck cscope autotool config_auto config_default config distclean clean check
    4445
    4546all: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
     
    5455cscope:
    5556        find kernel boot uspace -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
     57
     58# Pre-integration build check
     59check: $(CHECK)
     60ifdef JOBS
     61        $(CHECK) -j $(JOBS)
     62else
     63        $(CHECK)
     64endif
    5665
    5766$(COMMON_MAKEFILE): autotool
  • uspace/app/tester/Makefile

    r5863a95 r58854f2  
    5555        loop/loop1.c \
    5656        mm/malloc1.c \
     57        hw/misc/virtchar1.c \
    5758        hw/serial/serial1.c
    5859
  • uspace/app/tester/tester.c

    r5863a95 r58854f2  
    6666#include "hw/serial/serial1.def"
    6767#include "adt/usbaddrkeep.def"
     68#include "hw/misc/virtchar1.def"
    6869        {NULL, NULL, NULL, false}
    6970};
  • uspace/app/tester/tester.h

    r5863a95 r58854f2  
    8383extern const char *test_serial1(void);
    8484extern const char *test_usbaddrkeep(void);
     85extern const char *test_virtchar1(void);
    8586
    8687extern test_t tests[];
  • uspace/drv/rootvirt/devices.def

    r5863a95 r58854f2  
    1717        .match_id = "virtual&test2"
    1818},
     19{
     20        .name = "null",
     21        .match_id = "virtual&test1"
     22},
    1923#endif
    2024/* Virtual USB host controller. */
  • uspace/drv/test1/Makefile

    r5863a95 r58854f2  
    3333
    3434SOURCES = \
     35        char.c \
    3536        test1.c
    3637
  • uspace/drv/test1/test1.c

    r5863a95 r58854f2  
    3434#include <errno.h>
    3535#include <str_error.h>
    36 #include <driver.h>
    37 
    38 #define NAME "test1"
     36#include "test1.h"
    3937
    4038static int add_device(device_t *dev);
     
    9896        add_device_to_class(dev, "virtual");
    9997
    100         if (dev->parent == NULL) {
     98        if (str_cmp(dev->name, "null") == 0) {
     99                dev->ops = &char_device_ops;
     100                add_device_to_class(dev, "virt-null");
     101        } else if (dev->parent == NULL) {
    101102                register_child_verbose(dev, "cloning myself ;-)", "clone",
    102103                    "virtual&test1", 10);
     
    117118}
    118119
    119 
  • uspace/drv/usbhub/Makefile

    r5863a95 r58854f2  
    3434SOURCES = \
    3535        main.c \
    36         utils.c
     36        utils.c \
     37        usbhub.c \
     38        usblist.c
    3739
    3840include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/usbhub/main.c

    r5863a95 r58854f2  
    3232
    3333#include <usb/usbdrv.h>
     34
    3435#include "usbhub.h"
    3536#include "usbhub_private.h"
     
    5859int main(int argc, char *argv[])
    5960{
     61        usb_dprintf_enable(NAME,1);
    6062        usb_lst_init(&usb_hub_list);
    6163        fid_t fid = fibril_create(usb_hub_control_loop, NULL);
    6264        if (fid == 0) {
    63                 printf("%s: failed to start fibril for HUB devices\n", NAME);
     65                dprintf(1, "failed to start fibril for HUB devices");
     66                //printf("%s: failed to start fibril for HUB devices\n", NAME);
    6467                return ENOMEM;
    6568        }
  • uspace/drv/usbhub/usbhub_private.h

    r5863a95 r58854f2  
    3838
    3939#include "usbhub.h"
     40#include "usblist.h"
     41
    4042#include <adt/list.h>
    4143#include <bool.h>
    4244#include <driver.h>
    4345#include <usb/usb.h>
     46#include <usb/usbdrv.h>
    4447#include <usb/classes/hub.h>
    4548#include <usb/devreq.h>
     49#include <usb/debug.h>
    4650
    4751//************
     
    5559//************
    5660//
    57 // My private list implementation; I did not like the original helenos list
    58 //
    59 // This one does not depend on the structure of stored data
     61// convenience debug printf
    6062//
    6163//************
    62 
    63 /** general list structure */
    64 
    65 
    66 typedef struct usb_general_list{
    67         void * data;
    68         struct usb_general_list * prev, * next;
    69 } usb_general_list_t;
    70 
    71 /** create head of usb general list */
    72 usb_general_list_t * usb_lst_create(void);
    73 
    74 /** initialize head of usb general list */
    75 void usb_lst_init(usb_general_list_t * lst);
    76 
    77 
    78 /** is the list empty? */
    79 static inline bool usb_lst_empty(usb_general_list_t * lst){
    80         return lst?(lst->next==lst):true;
    81 }
    82 
    83 /** append data behind item */
    84 void usb_lst_append(usb_general_list_t * lst, void * data);
    85 
    86 /** prepend data beore item */
    87 void usb_lst_prepend(usb_general_list_t * lst, void * data);
    88 
    89 /** remove list item from list */
    90 void usb_lst_remove(usb_general_list_t * item);
    91 
    92 /** get data o specified type from list item */
    93 #define usb_lst_get_data(item, type)  (type *) (item->data)
    94 
    95 /** get usb_hub_info_t data from list item */
    96 static inline usb_hub_info_t * usb_hub_lst_get_data(usb_general_list_t * item) {
    97         return usb_lst_get_data(item,usb_hub_info_t);
    98 }
     64#define dprintf(level, format, ...) \
     65        usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
    9966
    10067/**
  • uspace/drv/usbhub/utils.c

    r5863a95 r58854f2  
    3131 */
    3232/** @file
    33  * @brief Hub driver.
     33 * @brief various utilities
    3434 */
    3535#include <driver.h>
     
    9090
    9191        if (sdescriptor[1] != USB_DESCTYPE_HUB) {
    92                 printf("[usb_hub] wrong descriptor %x\n",sdescriptor[1]);
     92                dprintf(1,"[usb_hub] wrong descriptor %x\n",sdescriptor[1]);
    9393                return NULL;
    9494        }
     
    102102        result->pwr_on_2_good_time = sdescriptor[5];
    103103        result->current_requirement = sdescriptor[6];
    104         size_t var_size = result->ports_count / 8 + ((result->ports_count % 8 > 0) ? 1 : 0);
     104        size_t var_size = result->ports_count / 8 + ((result->ports_count % 8 > 0)
     105                        ? 1 : 0);
    105106        result->devices_removable = (uint8_t*) malloc(var_size);
    106107        //printf("[usb_hub] getting removable devices data \n");
     
    198199}
    199200
    200 //list implementation
    201 
    202 usb_general_list_t * usb_lst_create(void) {
    203         usb_general_list_t* result = usb_new(usb_general_list_t);
    204         usb_lst_init(result);
    205         return result;
    206 }
    207 
    208 void usb_lst_init(usb_general_list_t * lst) {
    209         lst->prev = lst;
    210         lst->next = lst;
    211         lst->data = NULL;
    212 }
    213 
    214 void usb_lst_prepend(usb_general_list_t* item, void* data) {
    215         usb_general_list_t* appended = usb_new(usb_general_list_t);
    216         appended->data = data;
    217         appended->next = item;
    218         appended->prev = item->prev;
    219         item->prev->next = appended;
    220         item->prev = appended;
    221 }
    222 
    223 void usb_lst_append(usb_general_list_t* item, void* data) {
    224         usb_general_list_t* appended = usb_new(usb_general_list_t);
    225         appended->data = data;
    226         appended->next = item->next;
    227         appended->prev = item;
    228         item->next->prev = appended;
    229         item->next = appended;
    230 }
    231 
    232 void usb_lst_remove(usb_general_list_t* item) {
    233         item->next->prev = item->prev;
    234         item->prev->next = item->next;
    235 }
    236 
     201
     202/*
     203 * method for testing port status bitmap
     204 
    237205static void usb_hub_test_port_status(void) {
    238206        printf("[usb_hub] -------------port status test---------\n");
     
    286254        //printf("this should be 0: %d \n",usb_port_get_bit(&status,4));
    287255
    288 
    289 
    290 
    291 }
    292 
    293 //*********************************************
    294 //
    295 //  hub driver code, initialization
    296 //
    297 //*********************************************
    298 
    299 usb_hub_info_t * usb_create_hub_info(device_t * device, int hc) {
    300         usb_hub_info_t* result = usb_new(usb_hub_info_t);
    301         //result->device = device;
    302         result->port_count = -1;
    303         /// \TODO is this correct? is the device stored?
    304         result->device = device;
    305 
    306 
    307         //printf("[usb_hub] phone to hc = %d\n", hc);
    308         if (hc < 0) {
    309                 return result;
    310         }
    311         //get some hub info
    312         usb_address_t addr = usb_drv_get_my_address(hc, device);
    313         printf("[usb_hub] addres of newly created hub = %d\n", addr);
    314         /*if(addr<0){
    315                 //return result;
    316                
    317         }*/
    318 
    319         result->usb_device = usb_new(usb_hcd_attached_device_info_t);
    320         result->usb_device->address = addr;
    321 
    322         // get hub descriptor
    323         usb_target_t target;
    324         target.address = addr;
    325         target.endpoint = 0;
    326         usb_device_request_setup_packet_t request;
    327         //printf("[usb_hub] creating descriptor request\n");
    328         usb_hub_set_descriptor_request(&request);
    329 
    330         //printf("[usb_hub] creating serialized descriptor\n");
    331         void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
    332         usb_hub_descriptor_t * descriptor;
    333         size_t received_size;
    334         int opResult;
    335         //printf("[usb_hub] starting control transaction\n");
    336         opResult = usb_drv_sync_control_read(
    337                         hc, target, &request, serialized_descriptor,
    338                         USB_HUB_MAX_DESCRIPTOR_SIZE, &received_size);
    339         if (opResult != EOK) {
    340                 printf("[usb_hub] failed when receiving hub descriptor, badcode = %d\n",opResult);
    341                 ///\TODO memory leak will occur here!
    342                 return result;
    343         }
    344         //printf("[usb_hub] deserializing descriptor\n");
    345         descriptor = usb_deserialize_hub_desriptor(serialized_descriptor);
    346         if(descriptor==NULL){
    347                 printf("[usb_hub] could not deserialize descriptor \n");
    348                 result->port_count = 1;///\TODO this code is only for debug!!!
    349                 return result;
    350         }
    351         //printf("[usb_hub] setting port count to %d\n",descriptor->ports_count);
    352         result->port_count = descriptor->ports_count;
    353         result->attached_devs = (usb_hub_attached_device_t*)
    354             malloc((result->port_count+1) * sizeof(usb_hub_attached_device_t));
    355         int i;
    356         for(i=0;i<result->port_count+1;++i){
    357                 result->attached_devs[i].devman_handle=0;
    358                 result->attached_devs[i].address=0;
    359         }
    360         //printf("[usb_hub] freeing data\n");
    361         free(serialized_descriptor);
    362         free(descriptor->devices_removable);
    363         free(descriptor);
    364 
    365         //finish
    366 
    367         printf("[usb_hub] hub info created\n");
    368 
    369         return result;
    370 }
    371 
    372 int usb_add_hub_device(device_t *dev) {
    373         printf(NAME ": add_hub_device(handle=%d)\n", (int) dev->handle);
    374         printf("[usb_hub] hub device\n");
    375 
    376         /*
    377          * We are some (probably deeply nested) hub.
    378          * Thus, assign our own operations and explore already
    379          * connected devices.
    380          */
    381 
    382         //create the hub structure
    383         //get hc connection
    384         /// \TODO correct params
    385         int hc = usb_drv_hc_connect(dev, 0);
    386 
    387         usb_hub_info_t * hub_info = usb_create_hub_info(dev, hc);
    388         int port;
    389         int opResult;
    390         usb_device_request_setup_packet_t request;
    391         usb_target_t target;
    392         target.address = hub_info->usb_device->address;
    393         target.endpoint = 0;
    394 
    395         //get configuration descriptor
    396         // this is not fully correct - there are more configurations
    397         // and all should be checked
    398         usb_standard_device_descriptor_t std_descriptor;
    399         opResult = usb_drv_req_get_device_descriptor(hc, target.address,
    400     &std_descriptor);
    401         if(opResult!=EOK){
    402                 printf("[usb_hub] could not get device descriptor, %d\n",opResult);
    403                 return 1;///\TODO some proper error code needed
    404         }
    405         printf("[usb_hub] hub has %d configurations\n",std_descriptor.configuration_count);
    406         if(std_descriptor.configuration_count<1){
    407                 printf("[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE\n");
    408         }
    409         usb_standard_configuration_descriptor_t config_descriptor;
    410         opResult = usb_drv_req_get_bare_configuration_descriptor(hc,
    411         target.address, 0,
    412         &config_descriptor);
    413         if(opResult!=EOK){
    414                 printf("[usb_hub] could not get configuration descriptor, %d\n",opResult);
    415                 return 1;///\TODO some proper error code needed
    416         }
    417         //set configuration
    418         request.request_type = 0;
    419         request.request = USB_DEVREQ_SET_CONFIGURATION;
    420         request.index=0;
    421         request.length=0;
    422         request.value_high=0;
    423         request.value_low = config_descriptor.configuration_number;
    424         opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
    425         if (opResult != EOK) {
    426                 printf("[usb_hub]something went wrong when setting hub`s configuration, %d\n", opResult);
    427         }
    428 
    429 
    430         for (port = 1; port < hub_info->port_count+1; ++port) {
    431                 usb_hub_set_power_port_request(&request, port);
    432                 opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
    433                 printf("[usb_hub] powering port %d\n",port);
    434                 if (opResult != EOK) {
    435                         printf("[usb_hub]something went wrong when setting hub`s %dth port\n", port);
    436                 }
    437         }
    438         //ports powered, hub seems to be enabled
    439        
    440 
    441         ipc_hangup(hc);
    442 
    443         //add the hub to list
    444         usb_lst_append(&usb_hub_list, hub_info);
    445         printf("[usb_hub] hub info added to list\n");
    446         //(void)hub_info;
    447         usb_hub_check_hub_changes();
    448 
    449         /// \TODO start the check loop, if not already started...
    450 
    451         //this is just a test for port status bitmap type
    452         usb_hub_test_port_status();
    453 
    454         printf("[usb_hub] hub dev added\n");
    455         printf("\taddress %d, has %d ports \n",
    456                         hub_info->usb_device->address,
    457                         hub_info->port_count);
    458         printf("\tused configuration %d\n",config_descriptor.configuration_number);
    459 
    460         return EOK;
    461         //return ENOTSUP;
    462 }
    463 
    464 //*********************************************
    465 //
    466 //  hub driver code, main loop
    467 //
    468 //*********************************************
    469 
    470 /**
    471  * reset the port with new device and reserve the default address
    472  * @param hc
    473  * @param port
    474  * @param target
    475  */
    476 static void usb_hub_init_add_device(int hc, uint16_t port, usb_target_t target) {
    477         usb_device_request_setup_packet_t request;
    478         int opResult;
    479         printf("[usb_hub] some connection changed\n");
    480         //get default address
    481         opResult = usb_drv_reserve_default_address(hc);
    482         if (opResult != EOK) {
    483                 printf("[usb_hub] cannot assign default address, it is probably used\n");
    484                 return;
    485         }
    486         //reset port
    487         usb_hub_set_reset_port_request(&request, port);
    488         opResult = usb_drv_sync_control_write(
    489                         hc, target,
    490                         &request,
    491                         NULL, 0
    492                         );
    493         if (opResult != EOK) {
    494                 //continue;
    495                 printf("[usb_hub] something went wrong when reseting a port\n");
    496         }
    497 }
    498 
    499 /**
    500  * finalize adding new device after port reset
    501  * @param hc
    502  * @param port
    503  * @param target
    504  */
    505 static void usb_hub_finalize_add_device( usb_hub_info_t * hub,
    506                 int hc, uint16_t port, usb_target_t target) {
    507 
    508         int opResult;
    509         printf("[usb_hub] finalizing add device\n");
    510         opResult = usb_hub_clear_port_feature(hc, target.address,
    511             port, USB_HUB_FEATURE_C_PORT_RESET);
    512         if (opResult != EOK) {
    513                 goto release;
    514         }
    515 
    516         /* Request address at from host controller. */
    517         usb_address_t new_device_address = usb_drv_request_address(hc);
    518         if (new_device_address < 0) {
    519                 printf("[usb_hub] failed to get free USB address\n");
    520                 opResult = new_device_address;
    521                 goto release;
    522         }
    523         printf("[usb_hub] setting new address\n");
    524         opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
    525             new_device_address);
    526 
    527         if (opResult != EOK) {
    528                 printf("[usb_hub] could not set address for new device\n");
    529                 goto release;
    530         }
    531 
    532 release:
    533         printf("[usb_hub] releasing default address\n");
    534         usb_drv_release_default_address(hc);
    535         if (opResult != EOK) {
    536                 return;
    537         }
    538 
    539         devman_handle_t child_handle;
    540         opResult = usb_drv_register_child_in_devman(hc, hub->device,
    541             new_device_address, &child_handle);
    542         if (opResult != EOK) {
    543                 printf("[usb_hub] could not start driver for new device \n");
    544                 return;
    545         }
    546         hub->attached_devs[port].devman_handle = child_handle;
    547         hub->attached_devs[port].address = new_device_address;
    548 
    549         opResult = usb_drv_bind_address(hc, new_device_address, child_handle);
    550         if (opResult != EOK) {
    551                 printf("[usb_hub] could not assign address of device in hcd \n");
    552                 return;
    553         }
    554         printf("[usb_hub] new device address %d, handle %zu\n",
    555             new_device_address, child_handle);
    556        
    557 }
    558 
    559 /**
    560  * unregister device address in hc, close the port
    561  * @param hc
    562  * @param port
    563  * @param target
    564  */
    565 static void usb_hub_removed_device(
    566     usb_hub_info_t * hub, int hc, uint16_t port, usb_target_t target) {
    567         //usb_device_request_setup_packet_t request;
    568         int opResult;
    569         //disable port
    570         /*usb_hub_set_disable_port_request(&request, port);
    571         opResult = usb_drv_sync_control_write(
    572                         hc, target,
    573                         &request,
    574                         NULL, 0
    575                         );
    576         if (opResult != EOK) {
    577                 //continue;
    578                 printf("[usb_hub] something went wrong when disabling a port\n");
    579         }*/
    580         /// \TODO remove device
    581 
    582         hub->attached_devs[port].devman_handle=0;
    583         //close address
    584         if(hub->attached_devs[port].address!=0){
    585                 opResult = usb_drv_release_address(hc,hub->attached_devs[port].address);
    586                 if(opResult != EOK) {
    587                         printf("[usb_hub] could not release address of removed device: %d\n",opResult);
    588                 }
    589                 hub->attached_devs[port].address = 0;
    590         }else{
    591                 printf("[usb_hub] this is strange, disconnected device had no address\n");
    592                 //device was disconnected before it`s port was reset - return default address
    593                 usb_drv_release_default_address(hc);
    594         }
    595 }
    596 
    597 /**
    598  * process interrupts on given hub port
    599  * @param hc
    600  * @param port
    601  * @param target
    602  */
    603 static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc,
    604         uint16_t port, usb_address_t address) {
    605         printf("[usb_hub] interrupt at port %d\n", port);
    606         //determine type of change
    607         usb_target_t target;
    608         target.address=address;
    609         target.endpoint=0;
    610         usb_port_status_t status;
    611         size_t rcvd_size;
    612         usb_device_request_setup_packet_t request;
    613         int opResult;
    614         usb_hub_set_port_status_request(&request, port);
    615         //endpoint 0
    616 
    617         opResult = usb_drv_sync_control_read(
    618                         hc, target,
    619                         &request,
    620                         &status, 4, &rcvd_size
    621                         );
    622         if (opResult != EOK) {
    623                 printf("[usb_hub] ERROR: could not get port status\n");
    624                 return;
    625         }
    626         if (rcvd_size != sizeof (usb_port_status_t)) {
    627                 printf("[usb_hub] ERROR: received status has incorrect size\n");
    628                 return;
    629         }
    630         //something connected/disconnected
    631         if (usb_port_connect_change(&status)) {
    632                 opResult = usb_hub_clear_port_feature(hc, target.address,
    633                     port, USB_HUB_FEATURE_C_PORT_CONNECTION);
    634                 // TODO: check opResult
    635                 if (usb_port_dev_connected(&status)) {
    636                         printf("[usb_hub] some connection changed\n");
    637                         usb_hub_init_add_device(hc, port, target);
    638                 } else {
    639                         usb_hub_removed_device(hub, hc, port, target);
    640                 }
    641         }
    642         //port reset
    643         if (usb_port_reset_completed(&status)) {
    644                 printf("[usb_hub] port reset complete\n");
    645                 if (usb_port_enabled(&status)) {
    646                         usb_hub_finalize_add_device(hub, hc, port, target);
    647                 } else {
    648                         printf("[usb_hub] ERROR: port reset, but port still not enabled\n");
    649                 }
    650         }
    651 
    652         usb_port_set_connect_change(&status, false);
    653         usb_port_set_reset(&status, false);
    654         usb_port_set_reset_completed(&status, false);
    655         usb_port_set_dev_connected(&status, false);
    656         if (status) {
    657                 printf("[usb_hub]there was some unsupported change on port %d\n",port);
    658         }
    659         /// \TODO handle other changes
    660         /// \TODO debug log for various situations
    661 
    662 
    663 
    664         /*
    665         //configure device
    666         usb_drv_reserve_default_address(hc);
    667 
    668         usb_address_t new_device_address = usb_drv_request_address(hc);
    669 
    670 
    671         usb_drv_release_default_address(hc);
    672          * */
    673 }
    674 
    675 /** Check changes on all known hubs.
    676  */
    677 void usb_hub_check_hub_changes(void) {
    678         /*
    679          * Iterate through all hubs.
    680          */
    681         usb_general_list_t * lst_item;
    682         for (lst_item = usb_hub_list.next;
    683                         lst_item != &usb_hub_list;
    684                         lst_item = lst_item->next) {
    685                 usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data);
    686                 /*
    687                  * Check status change pipe of this hub.
    688                  */
    689 
    690                 usb_target_t target;
    691                 target.address = hub_info->usb_device->address;
    692                 target.endpoint = 1;/// \TODO get from endpoint descriptor
    693                 printf("[usb_hub] checking changes for hub at addr %d\n",
    694                     target.address);
    695 
    696                 size_t port_count = hub_info->port_count;
    697 
    698                 /*
    699                  * Connect to respective HC.
    700                  */
    701                 int hc = usb_drv_hc_connect(hub_info->device, 0);
    702                 if (hc < 0) {
    703                         continue;
    704                 }
    705 
    706                 // FIXME: count properly
    707                 size_t byte_length = ((port_count+1) / 8) + 1;
    708 
    709                 void *change_bitmap = malloc(byte_length);
    710                 size_t actual_size;
    711                 usb_handle_t handle;
    712 
    713                 /*
    714                  * Send the request.
    715                  */
    716                 int opResult = usb_drv_async_interrupt_in(hc, target,
    717                                 change_bitmap, byte_length, &actual_size,
    718                                 &handle);
    719 
    720                 usb_drv_async_wait_for(handle);
    721 
    722                 if (opResult != EOK) {
    723                         printf("[usb_hub] something went wrong while getting status of hub\n");
    724                         continue;
    725                 }
    726                 unsigned int port;
    727                 for (port = 1; port < port_count+1; ++port) {
    728                         bool interrupt = (((uint8_t*) change_bitmap)[port / 8] >> (port % 8)) % 2;
    729                         if (interrupt) {
    730                                 usb_hub_process_interrupt(
    731                                         hub_info, hc, port, hub_info->usb_device->address);
    732                         }
    733                 }
    734 
    735 
    736                 /*
    737                  * TODO: handle the changes.
    738                  */
    739 
    740                 /*
    741                  * WARNING: sample code, will not work out of the box.
    742                  * And does not contain code for checking for errors.
    743                  */
    744 #if 0
    745                 /*
    746                  * Before opening the port, we must acquire the default
    747                  * address.
    748                  */
    749                 usb_drv_reserve_default_address(hc);
    750 
    751                 usb_address_t new_device_address = usb_drv_request_address(hc);
    752 
    753                 // TODO: open the port
    754 
    755                 // TODO: send request for setting address to new_device_address
    756 
    757                 /*
    758                  * Once new address is set, we can release the default
    759                  * address.
    760                  */
    761                 usb_drv_release_default_address(hc);
    762 
    763                 /*
    764                  * Obtain descriptors and create match ids for devman.
    765                  */
    766 
    767                 // TODO: get device descriptors
    768 
    769                 // TODO: create match ids
    770 
    771                 // TODO: add child device
    772 
    773                 // child_device_register sets the device handle
    774                 // TODO: store it here
    775                 devman_handle_t new_device_handle = 0;
    776 
    777                 /*
    778                  * Inform the HC that the new device has devman handle
    779                  * assigned.
    780                  */
    781                 usb_drv_bind_address(hc, new_device_address, new_device_handle);
    782 
    783                 /*
    784                  * That's all.
    785                  */
    786 #endif
    787 
    788 
    789                 /*
    790                  * Hang-up the HC-connected phone.
    791                  */
    792                 ipc_hangup(hc);
    793         }
    794 }
     256}
     257*/
     258
    795259
    796260/**
  • uspace/lib/c/generic/devmap.c

    r5863a95 r58854f2  
    127127/** Register new device.
    128128 *
    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 */
     140int 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 *
    130179 * @param fqdn      Fully qualified device name.
    131180 * @param handle    Output: Handle to the created instance of device.
     
    134183int devmap_device_register(const char *fqdn, devmap_handle_t *handle)
    135184{
    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
    169188
    170189int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags)
  • uspace/lib/c/generic/net/modules.c

    r5863a95 r58854f2  
    198198}
    199199
    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 the
    211  *                      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 request
    222         if (!async_data_write_receive(&callid, length))
    223                 return EINVAL;
    224 
    225         // allocate the buffer
    226         *data = malloc(*length);
    227         if (!*data)
    228                 return ENOMEM;
    229 
    230         // fetch the data
    231         rc = async_data_write_finalize(callid, *data, *length);
    232         if (rc != EOK) {
    233                 free(data);
    234                 return rc;
    235         }
    236 
    237         return EOK;
    238 }
    239 
    240200/** Replies the data to the other party.
    241201 *
  • uspace/lib/c/include/devmap.h

    r5863a95 r58854f2  
    4545extern int devmap_driver_register(const char *, async_client_conn_t);
    4646extern int devmap_device_register(const char *, devmap_handle_t *);
     47extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t);
    4748
    4849extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int);
  • uspace/lib/c/include/ipc/devman.h

    r5863a95 r58854f2  
    123123        DEVMAN_CLIENT,
    124124        DEVMAN_CONNECT_TO_DEVICE,
     125        DEVMAN_CONNECT_FROM_DEVMAP,
    125126        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    126127} devman_interface_t;
  • uspace/lib/c/include/net/modules.h

    r5863a95 r58854f2  
    4949#include <sys/time.h>
    5050
    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 
    6851/** Connect to the needed module function type definition.
    6952 *
     
    8063extern int connect_to_service(services_t);
    8164extern int connect_to_service_timeout(services_t, suseconds_t);
    82 extern int data_receive(void **, size_t *);
    8365extern int data_reply(void *, size_t);
    8466extern void refresh_answer(ipc_call_t *, int *);
  • uspace/lib/usb/include/usb/hcdhubd.h

    r5863a95 r58854f2  
    207207int usb_hc_add_child_device(device_t *, const char *, const char *, bool);
    208208
     209
     210/**
     211 * @}
     212 */
     213
    209214#endif
  • uspace/srv/devman/devman.c

    r5863a95 r58854f2  
    6262}
    6363
     64static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys,
     65    link_t *item)
     66{
     67        dev_class_info_t *class_info
     68            = hash_table_get_instance(item, dev_class_info_t, devmap_link);
     69        assert(class_info != NULL);
     70
     71        return (class_info->devmap_handle == (devmap_handle_t) key[0]);
     72}
     73
    6474static void devices_remove_callback(link_t *item)
    6575{
     
    7585        .hash = devices_hash,
    7686        .compare = devmap_devices_compare,
     87        .remove_callback = devices_remove_callback
     88};
     89
     90static hash_table_operations_t devmap_devices_class_ops = {
     91        .hash = devices_hash,
     92        .compare = devmap_devices_class_compare,
    7793        .remove_callback = devices_remove_callback
    7894};
     
    678694        }
    679695       
    680         devmap_device_register(devmap_pathname, &node->devmap_handle);
     696        devmap_device_register_with_iface(devmap_pathname,
     697            &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
    681698       
    682699        tree_add_devmap_device(tree, node);
     
    10501067       
    10511068        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1052         if (info != NULL)
     1069        if (info != NULL) {
    10531070                memset(info, 0, sizeof(dev_class_info_t));
     1071                list_initialize(&info->dev_classes);
     1072                list_initialize(&info->devmap_link);
     1073                list_initialize(&info->link);
     1074        }
    10541075       
    10551076        return info;
     
    11751196        fibril_rwlock_initialize(&class_list->rwlock);
    11761197        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1177             &devmap_devices_ops);
     1198            &devmap_devices_class_ops);
    11781199}
    11791200
     
    12231244        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12241245        fibril_rwlock_write_unlock(&class_list->rwlock);
     1246
     1247        assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12251248}
    12261249
  • uspace/srv/devman/main.c

    r5863a95 r58854f2  
    281281         * handle.
    282282         */
    283         devmap_device_register(devmap_pathname, &cli->devmap_handle);
     283        devmap_device_register_with_iface(devmap_pathname,
     284            &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
    284285       
    285286        /*
     
    486487static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    487488{
    488         devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
     489        devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
    489490        node_t *dev;
    490491
     
    503504        }
    504505       
    505         printf(NAME ": devman_connection_devmapper: forward connection to "
    506             "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    507506        ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    508507            IPC_FF_NONE);
     508        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     509            "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    509510}
    510511
     
    512513static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
    513514{
    514         /*
    515          * Silly hack to enable the device manager to register as a driver by
    516          * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this
    517          * is not the forwarded connection from naming service, so it must be a
    518          * connection from the devmapper which thinks this is a devmapper-style
    519          * driver. So pretend this is a devmapper-style driver. (This does not
    520          * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper
    521          * passes device handle to the driver as an ipc method.)
    522          */
    523         if (IPC_GET_IMETHOD(*icall) != IPC_M_CONNECT_ME_TO)
    524                 devman_connection_devmapper(iid, icall);
    525 
    526         /*
    527          * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection
    528          * from naming service by which we registered as device manager, so be
    529          * device manager.
    530          */
    531        
    532515        /* Select interface. */
    533516        switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     
    542525                devman_forward(iid, icall, false);
    543526                break;
     527        case DEVMAN_CONNECT_FROM_DEVMAP:
     528                /* Someone connected through devmap node. */
     529                devman_connection_devmapper(iid, icall);
     530                break;
    544531        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    545532                /* Connect client to selected device. */
  • uspace/srv/devmap/devmap.c

    r5863a95 r58854f2  
    9999        /** Device driver handling this device */
    100100        devmap_driver_t *driver;
     101        /** Use this interface when forwarding to driver. */
     102        sysarg_t forward_interface;
    101103} devmap_device_t;
    102104
     
    517519        }
    518520       
     521        /* Set the interface, if any. */
     522        device->forward_interface = IPC_GET_ARG1(*icall);
     523
    519524        /* Get fqdn */
    520525        char *fqdn;
     
    566571        /* Get unique device handle */
    567572        device->handle = devmap_create_handle();
    568        
     573
    569574        devmap_namespace_addref(namespace, device);
    570575        device->driver = driver;
     
    617622        }
    618623       
    619         ipc_forward_fast(callid, dev->driver->phone, dev->handle,
    620             IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
     624        if (dev->forward_interface == 0) {
     625                ipc_forward_fast(callid, dev->driver->phone,
     626                    dev->handle, 0, 0,
     627                    IPC_FF_NONE);
     628        } else {
     629                ipc_forward_fast(callid, dev->driver->phone,
     630                    dev->forward_interface, dev->handle, 0,
     631                    IPC_FF_NONE);
     632        }
    621633       
    622634        fibril_mutex_unlock(&devices_list_mutex);
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r5863a95 r58854f2  
    197197                return rc;
    198198        address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
    199         address->length = CONVERT_SIZE(ether_addr_t, char, 1);
     199        address->length = sizeof(ether_addr_t);
    200200        return EOK;
    201201}
     
    310310        async_set_interrupt_received(irq_handler);
    311311
    312         return REGISTER_ME(SERVICE_DP8390, &phonehash);
     312        return ipc_connect_to_me(PHONE_NS, SERVICE_DP8390, 0, 0, &phonehash);
    313313}
    314314
  • uspace/srv/net/il/arp/arp.c

    r5863a95 r58854f2  
    483483        des_proto = des_hw + header->hardware_length;
    484484        trans = arp_addr_find(&proto->addresses, (char *) src_proto,
    485             CONVERT_SIZE(uint8_t, char, header->protocol_length));
     485            header->protocol_length);
    486486        /* Exists? */
    487487        if (trans && trans->hw_addr) {
    488                 if (trans->hw_addr->length != CONVERT_SIZE(uint8_t, char,
    489                     header->hardware_length)) {
     488                if (trans->hw_addr->length != header->hardware_length)
    490489                        return EINVAL;
    491                 }
    492490                memcpy(trans->hw_addr->value, src_hw, trans->hw_addr->length);
    493491        }
    494492        /* Is my protocol address? */
    495         if (proto->addr->length != CONVERT_SIZE(uint8_t, char,
    496             header->protocol_length)) {
     493        if (proto->addr->length != header->protocol_length)
    497494                return EINVAL;
    498         }
    499495        if (!str_lcmp(proto->addr->value, (char *) des_proto,
    500496            proto->addr->length)) {
     
    507503                        fibril_condvar_initialize(&trans->cv);
    508504                        rc = arp_addr_add(&proto->addresses, (char *) src_proto,
    509                             CONVERT_SIZE(uint8_t, char, header->protocol_length),
    510                             trans);
     505                            header->protocol_length, trans);
    511506                        if (rc != EOK) {
    512507                                /* The generic char map has already freed trans! */
     
    516511                if (!trans->hw_addr) {
    517512                        trans->hw_addr = measured_string_create_bulk(
    518                             (char *) src_hw, CONVERT_SIZE(uint8_t, char,
    519                             header->hardware_length));
     513                            (char *) src_hw, header->hardware_length);
    520514                        if (!trans->hw_addr)
    521515                                return ENOMEM;
     
    606600
    607601        /* ARP packet content size = header + (address + translation) * 2 */
    608         length = 8 + 2 * (CONVERT_SIZE(char, uint8_t, proto->addr->length) +
    609             CONVERT_SIZE(char, uint8_t, device->addr->length));
     602        length = 8 + 2 * (proto->addr->length + device->addr->length);
    610603        if (length > device->packet_dimension.content)
    611604                return ELIMIT;
     
    640633
    641634        rc = packet_set_addr(packet, (uint8_t *) device->addr->value,
    642             (uint8_t *) device->broadcast_addr->value,
    643             CONVERT_SIZE(char, uint8_t, device->addr->length));
     635            (uint8_t *) device->broadcast_addr->value, device->addr->length);
    644636        if (rc != EOK) {
    645637                pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
  • uspace/srv/net/il/arp/arp_module.c

    r5863a95 r58854f2  
    7979                goto out;
    8080       
    81         rc = REGISTER_ME(SERVICE_ARP, &phonehash);
     81        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ARP, 0, 0, &phonehash);
    8282        if (rc != EOK)
    8383                goto out;
  • uspace/srv/net/il/ip/ip.c

    r5863a95 r58854f2  
    442442                if (route) {
    443443                        address.value = (char *) &route->address.s_addr;
    444                         address.length = CONVERT_SIZE(in_addr_t, char, 1);
     444                        address.length = sizeof(in_addr_t);
    445445                       
    446446                        rc = arp_device_req(ip_netif->arp->phone,
     
    639639        if (destination) {
    640640                rc = packet_set_addr(packet, NULL, (uint8_t *) destination->value,
    641                     CONVERT_SIZE(char, uint8_t, destination->length));
     641                    destination->length);
    642642        } else {
    643643                rc = packet_set_addr(packet, NULL, NULL, 0);
     
    687687                                rc = packet_set_addr(next, NULL,
    688688                                    (uint8_t *) destination->value,
    689                                     CONVERT_SIZE(char, uint8_t,
    690                                     destination->length));
     689                                    destination->length);
    691690                                if (rc != EOK) {
    692691                                        free(last_header);
     
    718717                        rc = packet_set_addr(next, NULL,
    719718                            (uint8_t *) destination->value,
    720                             CONVERT_SIZE(char, uint8_t, destination->length));
     719                            destination->length);
    721720                        if (rc != EOK) {
    722721                                free(last_header);
     
    10061005                destination.value = route->gateway.s_addr ?
    10071006                    (char *) &route->gateway.s_addr : (char *) &dest.s_addr;
    1008                 destination.length = CONVERT_SIZE(dest.s_addr, char, 1);
     1007                destination.length = sizeof(dest.s_addr);
    10091008
    10101009                rc = arp_translate_req(netif->arp->phone, netif->device_id,
     
    17581757                        // clear the ARP mapping if any
    17591758                        address.value = (char *) &header->destination_address;
    1760                         address.length = CONVERT_SIZE(uint8_t, char,
    1761                             sizeof(header->destination_address));
     1759                        address.length = sizeof(header->destination_address);
    17621760                        arp_clear_address_req(netif->arp->phone,
    17631761                            netif->device_id, SERVICE_IP, &address);
     
    19511949
    19521950        case NET_IP_GET_ROUTE:
    1953                 rc = data_receive((void **) &addr, &addrlen);
     1951                rc = async_data_write_accept((void **) &addr, false, 0, 0, 0,
     1952                    &addrlen);
    19541953                if (rc != EOK)
    19551954                        return rc;
  • uspace/srv/net/il/ip/ip_module.c

    r5863a95 r58854f2  
    8080                goto out;
    8181       
    82         rc = REGISTER_ME(SERVICE_IP, &phonehash);
     82        rc = ipc_connect_to_me(PHONE_NS, SERVICE_IP, 0, 0, &phonehash);
    8383        if (rc != EOK)
    8484                goto out;
  • uspace/srv/net/net/net.c

    r5863a95 r58854f2  
    335335                goto out;
    336336       
    337         rc = REGISTER_ME(SERVICE_NETWORKING, &phonehash);
     337        rc = ipc_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, &phonehash);
    338338        if (rc != EOK)
    339339                goto out;
  • uspace/srv/net/netif/lo/lo.c

    r5863a95 r58854f2  
    166166        sysarg_t phonehash;
    167167
    168         return REGISTER_ME(SERVICE_LO, &phonehash);
     168        return ipc_connect_to_me(PHONE_NS, SERVICE_LO, 0, 0, &phonehash);
    169169}
    170170
  • uspace/srv/net/nil/eth/eth.c

    r5863a95 r58854f2  
    201201
    202202        eth_globals.broadcast_addr =
    203             measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF",
    204             CONVERT_SIZE(uint8_t, char, ETH_ADDR));
     203            measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF", ETH_ADDR);
    205204        if (!eth_globals.broadcast_addr) {
    206205                rc = ENOMEM;
  • uspace/srv/net/nil/eth/eth_module.c

    r5863a95 r58854f2  
    6666                goto out;
    6767
    68         rc = REGISTER_ME(SERVICE_ETHERNET, &phonehash);
     68        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ETHERNET, 0, 0, &phonehash);
    6969        if (rc != EOK)
    7070                goto out;
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r5863a95 r58854f2  
    6767                goto out;
    6868       
    69         rc = REGISTER_ME(SERVICE_NILDUMMY, &phonehash);
     69        rc = ipc_connect_to_me(PHONE_NS, SERVICE_NILDUMMY, 0, 0, &phonehash);
    7070        if (rc != EOK)
    7171                goto out;
  • uspace/srv/net/tl/icmp/icmp_module.c

    r5863a95 r58854f2  
    7474                goto out;
    7575
    76         rc = REGISTER_ME(SERVICE_ICMP, &phonehash);
     76        rc = ipc_connect_to_me(PHONE_NS, SERVICE_ICMP, 0, 0, &phonehash);
    7777        if (rc != EOK)
    7878                goto out;
  • uspace/srv/net/tl/tcp/tcp.c

    r5863a95 r58854f2  
    13651365
    13661366                case NET_SOCKET_BIND:
    1367                         res = data_receive((void **) &addr, &addrlen);
     1367                        res = async_data_write_accept((void **) &addr, false,
     1368                            0, 0, 0, &addrlen);
    13681369                        if (res != EOK)
    13691370                                break;
     
    14021403
    14031404                case NET_SOCKET_CONNECT:
    1404                         res = data_receive((void **) &addr, &addrlen);
     1405                        res = async_data_write_accept((void **) &addr, false,
     1406                            0, 0, 0, &addrlen);
    14051407                        if (res != EOK)
    14061408                                break;
     
    14531455
    14541456                case NET_SOCKET_SENDTO:
    1455                         res = data_receive((void **) &addr, &addrlen);
     1457                        res = async_data_write_accept((void **) &addr, false,
     1458                            0, 0, 0, &addrlen);
    14561459                        if (res != EOK)
    14571460                                break;
  • uspace/srv/net/tl/tcp/tcp_module.c

    r5863a95 r58854f2  
    7575                goto out;
    7676
    77         rc = REGISTER_ME(SERVICE_TCP, &phonehash);
     77        rc = ipc_connect_to_me(PHONE_NS, SERVICE_TCP, 0, 0, &phonehash);
    7878        if (rc != EOK)
    7979                goto out;
  • uspace/srv/net/tl/udp/udp.c

    r5863a95 r58854f2  
    771771
    772772                case NET_SOCKET_BIND:
    773                         res = data_receive((void **) &addr, &addrlen);
     773                        res = async_data_write_accept((void **) &addr, false,
     774                            0, 0, 0, &addrlen);
    774775                        if (res != EOK)
    775776                                break;
     
    784785
    785786                case NET_SOCKET_SENDTO:
    786                         res = data_receive((void **) &addr, &addrlen);
     787                        res = async_data_write_accept((void **) &addr, false,
     788                            0, 0, 0, &addrlen);
    787789                        if (res != EOK)
    788790                                break;
  • uspace/srv/net/tl/udp/udp_module.c

    r5863a95 r58854f2  
    7575                goto out;
    7676       
    77         rc = REGISTER_ME(SERVICE_UDP, &phonehash);
     77        rc = ipc_connect_to_me(PHONE_NS, SERVICE_UDP, 0, 0, &phonehash);
    7878        if (rc != EOK)
    7979                goto out;
Note: See TracChangeset for help on using the changeset viewer.