Changeset cd50486 in mainline for uspace/drv


Ignore:
Timestamp:
2011-02-06T22:03:55Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25971d2
Parents:
1110ebd (diff), 960ff451 (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

Location:
uspace/drv
Files:
24 added
14 edited
6 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/ns8250/ns8250.c

    r1110ebd rcd50486  
    256256       
    257257        if (dev->parent_phone > 0) {
    258                 ipc_hangup(dev->parent_phone);
     258                async_hangup(dev->parent_phone);
    259259                dev->parent_phone = 0;
    260260        }
     
    888888                ns8250_get_props(dev, &baud_rate, &parity, &word_length,
    889889                    &stop_bits);
    890                 ipc_answer_4(callid, EOK, baud_rate, parity, word_length,
     890                async_answer_4(callid, EOK, baud_rate, parity, word_length,
    891891                    stop_bits);
    892892                break;
     
    899899                ret = ns8250_set_props(dev, baud_rate, parity, word_length,
    900900                    stop_bits);
    901                 ipc_answer_0(callid, ret);
     901                async_answer_0(callid, ret);
    902902                break;
    903903               
    904904        default:
    905                 ipc_answer_0(callid, ENOTSUP);
     905                async_answer_0(callid, ENOTSUP);
    906906        }
    907907}
  • uspace/drv/pciintel/pci.c

    r1110ebd rcd50486  
    478478                    "the device.\n");
    479479                delete_pci_bus_data(bus_data);
    480                 ipc_hangup(dev->parent_phone);
     480                async_hangup(dev->parent_phone);
    481481                return rc;
    482482        }       
     
    496496                printf(NAME ": failed to enable configuration ports.\n");
    497497                delete_pci_bus_data(bus_data);
    498                 ipc_hangup(dev->parent_phone);
     498                async_hangup(dev->parent_phone);
    499499                hw_res_clean_resource_list(&hw_resources);
    500500                return EADDRNOTAVAIL;
  • uspace/drv/rootvirt/devices.def

    r1110ebd rcd50486  
    2222},
    2323#endif
     24#ifdef CONFIG_RUN_VIRTUAL_USB_HC
    2425/* Virtual USB host controller. */
    2526{
     
    2728        .match_id = "usb&hc=vhc"
    2829},
     30#endif
  • uspace/drv/test2/test2.c

    r1110ebd rcd50486  
    103103        if (dev->parent == NULL) {
    104104                fid_t postpone = fibril_create(postponed_birth, dev);
     105                if (postpone == 0) {
     106                        printf(NAME ": fibril_create() error\n");
     107                        return ENOMEM;
     108                }
    105109                fibril_add_ready(postpone);
    106110        } else {
  • uspace/drv/uhci-hcd/main.c

    r1110ebd rcd50486  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky
     2 * Copyright (c) 2011 Vojtech Horky, Jan Vesely
    33 * All rights reserved.
    44 *
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 #include <usb/hcdhubd.h>
     28/** @addtogroup usb
     29 * @{
     30 */
     31/** @file
     32 * @brief UHCI driver
     33 */
     34#include <driver.h>
    2935#include <usb_iface.h>
     36
     37#include <errno.h>
     38
    3039#include <usb/debug.h>
    31 #include <errno.h>
    32 #include <str_error.h>
    33 #include <driver.h>
     40
     41#include "iface.h"
     42#include "pci.h"
     43#include "root_hub.h"
    3444#include "uhci.h"
     45
     46#define NAME "uhci-hcd"
    3547
    3648static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
     
    5466static int uhci_add_device(device_t *device)
    5567{
    56         usb_dprintf(NAME, 1, "uhci_add_device() called\n");
     68        assert(device);
     69
     70        usb_log_info("uhci_add_device() called\n");
    5771        device->ops = &uhci_ops;
    5872
     
    6579
    6680        if (rc != EOK) {
    67                 fprintf(stderr,
    68                     NAME ": failed to get I/O registers addresses: %s.\n",
    69                     str_error(rc));
     81                usb_log_error("Failed(%d) to get I/O registers addresses for device:.\n",
     82                    rc, device->handle);
    7083                return rc;
    7184        }
    7285
    73         usb_dprintf(NAME, 2, "I/O regs at 0x%X (size %zu), IRQ %d.\n",
     86        usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
    7487            io_reg_base, io_reg_size, irq);
    7588
    76         /*
    77          * We need to announce the presence of our root hub.
    78          */
    79         usb_dprintf(NAME, 2, "adding root hub\n");
    80         usb_hcd_add_root_hub(device);
     89        uhci_t *uhci_hc = malloc(sizeof(uhci_t));
     90        if (!uhci_hc) {
     91                usb_log_error("Failed to allocaete memory for uhci hcd driver.\n");
     92                return ENOMEM;
     93        }
     94
     95        int ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);
     96        if (ret != EOK) {
     97                usb_log_error("Failed to init uhci-hcd.\n");
     98                return ret;
     99        }
     100        device_t *rh;
     101        ret = setup_root_hub(&rh, device);
     102
     103        if (ret != EOK) {
     104                usb_log_error("Failed to setup uhci root hub.\n");
     105                /* TODO: destroy uhci here */
     106                return ret;
     107        }
     108
     109        ret = child_device_register(rh, device);
     110        if (ret != EOK) {
     111                usb_log_error("Failed to register root hub.\n");
     112                /* TODO: destroy uhci here */
     113                return ret;
     114        }
     115
     116        device->driver_data = uhci_hc;
    81117
    82118        return EOK;
     
    98134         */
    99135        sleep(5);
    100         usb_dprintf_enable(NAME, 5);
     136        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    101137
    102138        return driver_main(&uhci_driver);
    103139}
     140/**
     141 * @}
     142 */
  • uspace/drv/uhci-hcd/pci.c

    r1110ebd rcd50486  
    3434 * PCI related functions needed by the UHCI driver.
    3535 */
    36 #include "uhci.h"
    3736#include <errno.h>
    3837#include <assert.h>
    3938#include <devman.h>
    4039#include <device/hw_res.h>
     40
     41#include "pci.h"
    4142
    4243/** Get address of registers and IRQ for given device.
     
    116117        rc = EOK;
    117118leave:
    118         ipc_hangup(parent_phone);
     119        async_hangup(parent_phone);
    119120
    120121        return rc;
     
    125126 */
    126127
     128/**
     129 * @}
     130 */
  • uspace/drv/uhci-hcd/pci.h

    r1110ebd rcd50486  
    3333 * @brief UHCI driver
    3434 */
    35 #ifndef DRV_UHCI_UHCI_H
    36 #define DRV_UHCI_UHCI_H
     35#ifndef DRV_UHCI_PCI_H
     36#define DRV_UHCI_PCI_H
    3737
    38 #include <usbhc_iface.h>
    39 
    40 #define NAME "uhci"
    41 
    42 usbhc_iface_t uhci_iface;
     38#include <driver.h>
    4339
    4440int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *);
     
    4844 * @}
    4945 */
     46
  • uspace/drv/uhci-rhd/Makefile

    r1110ebd rcd50486  
    11#
    2 # Copyright (c) 2010 Vojtech Horky
     2# Copyright (c) 2010 Jan Vesely
    33# All rights reserved.
    44#
     
    2929USPACE_PREFIX = ../..
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a
    31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include
    32 BINARY = uhci
     31EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include -I.
     32BINARY = uhci-rhd
    3333
    3434SOURCES = \
    3535        main.c \
    36         pci.c \
    37         transfers.c
     36        port.c \
     37        port_status.c \
     38        root_hub.c
    3839
    3940include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/usbhid/hid.h

    r1110ebd rcd50486  
    6969        device_t *device;
    7070        usb_hid_configuration_t *conf;
     71        usb_address_t address;
    7172        usb_hid_report_parser_t *parser;
    7273
    7374        usb_device_connection_t wire;
    74         usb_endpoint_pipe_t ctrl_pipe;
    7575        usb_endpoint_pipe_t poll_pipe;
    7676} usb_hid_dev_kbd_t;
  • uspace/drv/usbhid/main.c

    r1110ebd rcd50486  
    4747#include <usb/classes/hid.h>
    4848#include <usb/classes/hidparser.h>
    49 #include <usb/request.h>
     49#include <usb/devreq.h>
    5050#include <usb/descriptor.h>
    5151#include <io/console.h>
     
    5656#include "layout.h"
    5757
    58 #define BUFFER_SIZE 32
     58#define BUFFER_SIZE 8
    5959#define NAME "usbhid"
    6060
     
    8383
    8484                if (console_callback_phone != -1) {
    85                         ipc_answer_0(icallid, ELIMIT);
     85                        async_answer_0(icallid, ELIMIT);
    8686                        return;
    8787                }
    8888
    8989                console_callback_phone = callback;
    90                 ipc_answer_0(icallid, EOK);
     90                async_answer_0(icallid, EOK);
    9191                return;
    9292        }
    9393
    94         ipc_answer_0(icallid, EINVAL);
     94        async_answer_0(icallid, EINVAL);
    9595}
    9696
     
    262262}
    263263
     264# if 0
    264265/*
    265266 * Kbd functions
     
    280281               
    281282                // get the descriptor from the device
    282                 int rc = usb_request_get_descriptor(&kbd_dev->ctrl_pipe,
    283                     USB_REQUEST_TYPE_CLASS, USB_DESCTYPE_HID_REPORT,
    284                     i, 0,
    285                     kbd_dev->conf->interfaces[i].report_desc, length,
     283                int rc = usb_drv_req_get_descriptor(kbd_dev->device->parent_phone,
     284                    kbd_dev->address, USB_REQUEST_TYPE_CLASS, USB_DESCTYPE_HID_REPORT,
     285                    0, i, kbd_dev->conf->interfaces[i].report_desc, length,
    286286                    &actual_size);
    287287
     
    298298        return EOK;
    299299}
    300 
    301300static int usbkbd_process_descriptors(usb_hid_dev_kbd_t *kbd_dev)
    302301{
     
    304303        usb_standard_configuration_descriptor_t config_desc;
    305304       
    306         int rc;
    307         rc = usb_request_get_bare_configuration_descriptor(&kbd_dev->ctrl_pipe,
    308             0, &config_desc);
     305        int rc = usb_drv_req_get_bare_configuration_descriptor(
     306            kbd_dev->device->parent_phone, kbd_dev->address, 0, &config_desc);
    309307       
    310308        if (rc != EOK) {
     
    320318        size_t transferred = 0;
    321319        // get full configuration descriptor
    322         rc = usb_request_get_full_configuration_descriptor(&kbd_dev->ctrl_pipe,
    323             0, descriptors,
     320        rc = usb_drv_req_get_full_configuration_descriptor(
     321            kbd_dev->device->parent_phone, kbd_dev->address, 0, descriptors,
    324322            config_desc.total_length, &transferred);
    325323       
     
    365363        return EOK;
    366364}
    367 
     365#endif
    368366static usb_hid_dev_kbd_t *usbkbd_init_device(device_t *dev)
    369367{
    370         int rc;
    371 
    372368        usb_hid_dev_kbd_t *kbd_dev = (usb_hid_dev_kbd_t *)calloc(1,
    373369            sizeof(usb_hid_dev_kbd_t));
     
    380376        kbd_dev->device = dev;
    381377
     378        // get phone to my HC and save it as my parent's phone
     379        // TODO: maybe not a good idea if DDF will use parent_phone
     380        int rc = kbd_dev->device->parent_phone = usb_drv_hc_connect_auto(dev, 0);
     381        if (rc < 0) {
     382                printf("Problem setting phone to HC.\n");
     383                goto error_leave;
     384        }
     385
     386        rc = kbd_dev->address = usb_drv_get_my_address(dev->parent_phone, dev);
     387        if (rc < 0) {
     388                printf("Problem getting address of the device.\n");
     389                goto error_leave;
     390        }
     391
     392        // doesn't matter now that we have no address
     393//      if (kbd_dev->address < 0) {
     394//              fprintf(stderr, NAME ": No device address!\n");
     395//              free(kbd_dev);
     396//              return NULL;
     397//      }
     398
     399        /*
     400         * will need all descriptors:
     401         * 1) choose one configuration from configuration descriptors
     402         *    (set it to the device)
     403         * 2) set endpoints from endpoint descriptors
     404         */
     405
     406
     407        // TODO: get descriptors, parse descriptors and save endpoints
     408        //usbkbd_process_descriptors(kbd_dev);
     409        usb_drv_req_set_configuration(
     410          kbd_dev->device->parent_phone, kbd_dev->address, 1);
     411
     412
     413
    382414        /*
    383415         * Initialize the backing connection to the host controller.
     
    393425         * Initialize device pipes.
    394426         */
    395         rc = usb_endpoint_pipe_initialize_default_control(&kbd_dev->ctrl_pipe,
    396             &kbd_dev->wire);
    397         if (rc != EOK) {
    398                 printf("Failed to initialize default control pipe: %s.\n",
    399                     str_error(rc));
    400                 goto error_leave;
    401         }
    402 
    403427        rc = usb_endpoint_pipe_initialize(&kbd_dev->poll_pipe, &kbd_dev->wire,
    404428            GUESSED_POLL_ENDPOINT, USB_TRANSFER_INTERRUPT, USB_DIRECTION_IN);
     
    409433        }
    410434
    411         /*
    412          * will need all descriptors:
    413          * 1) choose one configuration from configuration descriptors
    414          *    (set it to the device)
    415          * 2) set endpoints from endpoint descriptors
    416          */
    417 
    418         // TODO: get descriptors, parse descriptors and save endpoints
    419         usb_endpoint_pipe_start_session(&kbd_dev->ctrl_pipe);
    420         usbkbd_process_descriptors(kbd_dev);
    421         usb_endpoint_pipe_end_session(&kbd_dev->ctrl_pipe);
    422435
    423436        return kbd_dev;
     
    457470
    458471        while (true) {
    459                 async_usleep(1000 * 1000 * 2);
     472                async_usleep(1000 * 10);
    460473
    461474                sess_rc = usb_endpoint_pipe_start_session(&kbd_dev->poll_pipe);
  • uspace/drv/usbhub/main.c

    r1110ebd rcd50486  
    3737#include <usb/usbdrv.h>
    3838
     39
    3940#include "usbhub.h"
    4041#include "usbhub_private.h"
     
    6465int main(int argc, char *argv[])
    6566{
    66         usb_dprintf_enable(NAME, 0);
     67        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    6768       
    6869        fibril_mutex_initialize(&usb_hub_list_lock);
  • uspace/drv/usbhub/usbhub.c

    r1110ebd rcd50486  
    7070
    7171
    72         //printf("[usb_hub] phone to hc = %d\n", hc);
     72        dprintf(USB_LOG_LEVEL_DEBUG, "phone to hc = %d", hc);
    7373        if (hc < 0) {
    7474                return result;
     
    7676        //get some hub info
    7777        usb_address_t addr = usb_drv_get_my_address(hc, device);
    78         dprintf(1, "address of newly created hub = %d", addr);
     78        dprintf(USB_LOG_LEVEL_DEBUG, "address of newly created hub = %d", addr);
    7979        /*if(addr<0){
    8080                //return result;
     
    8787        // get hub descriptor
    8888
    89         //printf("[usb_hub] creating serialized descriptor\n");
     89        dprintf(USB_LOG_LEVEL_DEBUG, "creating serialized descripton");
    9090        void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
    9191        usb_hub_descriptor_t * descriptor;
    9292        size_t received_size;
    9393        int opResult;
    94         //printf("[usb_hub] starting control transaction\n");
     94        dprintf(USB_LOG_LEVEL_DEBUG, "starting control transaction");
    9595       
    9696        opResult = usb_drv_req_get_descriptor(hc, addr,
     
    100100
    101101        if (opResult != EOK) {
    102                 dprintf(1, "failed when receiving hub descriptor, badcode = %d",opResult);
     102                dprintf(USB_LOG_LEVEL_ERROR, "failed when receiving hub descriptor, badcode = %d",opResult);
    103103                free(serialized_descriptor);
    104104                return result;
    105105        }
    106         //printf("[usb_hub] deserializing descriptor\n");
     106        dprintf(USB_LOG_LEVEL_DEBUG2, "deserializing descriptor");
    107107        descriptor = usb_deserialize_hub_desriptor(serialized_descriptor);
    108108        if(descriptor==NULL){
    109                 dprintf(1, "could not deserialize descriptor ");
     109                dprintf(USB_LOG_LEVEL_WARNING, "could not deserialize descriptor ");
    110110                result->port_count = 1;///\TODO this code is only for debug!!!
    111111                return result;
    112112        }
    113         //printf("[usb_hub] setting port count to %d\n",descriptor->ports_count);
     113        dprintf(USB_LOG_LEVEL_INFO, "setting port count to %d",descriptor->ports_count);
    114114        result->port_count = descriptor->ports_count;
    115115        result->attached_devs = (usb_hub_attached_device_t*)
     
    120120                result->attached_devs[i].address=0;
    121121        }
    122         //printf("[usb_hub] freeing data\n");
     122        dprintf(USB_LOG_LEVEL_DEBUG2, "freeing data");
    123123        free(serialized_descriptor);
    124124        free(descriptor->devices_removable);
     
    127127        //finish
    128128
    129         dprintf(1, "hub info created");
     129        dprintf(USB_LOG_LEVEL_INFO, "hub info created");
    130130
    131131        return result;
     
    133133
    134134int usb_add_hub_device(device_t *dev) {
    135         dprintf(1, "add_hub_device(handle=%d)", (int) dev->handle);
    136         dprintf(1, "hub device");
     135        dprintf(USB_LOG_LEVEL_INFO, "add_hub_device(handle=%d)", (int) dev->handle);
    137136
    138137        /*
     
    164163            &std_descriptor);
    165164        if(opResult!=EOK){
    166                 dprintf(1, "could not get device descriptor, %d",opResult);
     165                dprintf(USB_LOG_LEVEL_ERROR, "could not get device descriptor, %d",opResult);
    167166                return opResult;
    168167        }
    169         dprintf(1, "hub has %d configurations",std_descriptor.configuration_count);
     168        dprintf(USB_LOG_LEVEL_INFO, "hub has %d configurations",std_descriptor.configuration_count);
    170169        if(std_descriptor.configuration_count<1){
    171                 dprintf(1, "THERE ARE NO CONFIGURATIONS AVAILABLE");
     170                dprintf(USB_LOG_LEVEL_ERROR, "THERE ARE NO CONFIGURATIONS AVAILABLE");
    172171                //shouldn`t I return?
    173172        }
     
    178177        &config_descriptor);
    179178        if(opResult!=EOK){
    180                 dprintf(1, "could not get configuration descriptor, %d",opResult);
     179                dprintf(USB_LOG_LEVEL_ERROR, "could not get configuration descriptor, %d",opResult);
    181180                return opResult;
    182181        }
     
    186185
    187186        if (opResult != EOK) {
    188                 dprintf(1, "something went wrong when setting hub`s configuration, %d", opResult);
     187                dprintf(USB_LOG_LEVEL_ERROR, "something went wrong when setting hub`s configuration, %d", opResult);
    189188        }
    190189
     
    193192                usb_hub_set_power_port_request(&request, port);
    194193                opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
    195                 dprintf(1, "powering port %d",port);
     194                dprintf(USB_LOG_LEVEL_INFO, "powering port %d",port);
    196195                if (opResult != EOK) {
    197                         dprintf(1, "something went wrong when setting hub`s %dth port", port);
     196                        dprintf(USB_LOG_LEVEL_WARNING, "something went wrong when setting hub`s %dth port", port);
    198197                }
    199198        }
    200199        //ports powered, hub seems to be enabled
    201200
    202         ipc_hangup(hc);
     201        async_hangup(hc);
    203202
    204203        //add the hub to list
     
    207206        fibril_mutex_unlock(&usb_hub_list_lock);
    208207
    209         dprintf(1, "hub info added to list");
     208        dprintf(USB_LOG_LEVEL_DEBUG, "hub info added to list");
    210209        //(void)hub_info;
    211210        usb_hub_check_hub_changes();
     
    213212       
    214213
    215         dprintf(1, "hub dev added");
    216         dprintf(1, "\taddress %d, has %d ports ",
     214        dprintf(USB_LOG_LEVEL_INFO, "hub dev added");
     215        dprintf(USB_LOG_LEVEL_DEBUG, "\taddress %d, has %d ports ",
    217216                        hub_info->usb_device->address,
    218217                        hub_info->port_count);
    219         dprintf(1, "\tused configuration %d",config_descriptor.configuration_number);
     218        dprintf(USB_LOG_LEVEL_DEBUG, "\tused configuration %d",config_descriptor.configuration_number);
    220219
    221220        return EOK;
     
    238237inline static int usb_hub_release_default_address(int hc){
    239238        int opResult;
    240         dprintf(1, "releasing default address");
     239        dprintf(USB_LOG_LEVEL_INFO, "releasing default address");
    241240        opResult = usb_drv_release_default_address(hc);
    242241        if (opResult != EOK) {
    243                 dprintf(1, "failed to release default address");
     242                dprintf(USB_LOG_LEVEL_WARNING, "failed to release default address");
    244243        }
    245244        return opResult;
     
    255254        usb_device_request_setup_packet_t request;
    256255        int opResult;
    257         dprintf(1, "some connection changed");
     256        dprintf(USB_LOG_LEVEL_INFO, "some connection changed");
    258257        //get default address
    259258        opResult = usb_drv_reserve_default_address(hc);
    260259        if (opResult != EOK) {
    261                 dprintf(1, "cannot assign default address, it is probably used");
     260                dprintf(USB_LOG_LEVEL_WARNING, "cannot assign default address, it is probably used");
    262261                return;
    263262        }
     
    270269                        );
    271270        if (opResult != EOK) {
    272                 dprintf(1, "something went wrong when reseting a port");
     271                dprintf(USB_LOG_LEVEL_ERROR, "something went wrong when reseting a port");
    273272                usb_hub_release_default_address(hc);
    274273        }
     
    285284
    286285        int opResult;
    287         dprintf(1, "finalizing add device");
     286        dprintf(USB_LOG_LEVEL_INFO, "finalizing add device");
    288287        opResult = usb_hub_clear_port_feature(hc, target.address,
    289288            port, USB_HUB_FEATURE_C_PORT_RESET);
    290289        if (opResult != EOK) {
    291                 dprintf(1, "failed to clear port reset feature");
     290                dprintf(USB_LOG_LEVEL_ERROR, "failed to clear port reset feature");
    292291                usb_hub_release_default_address(hc);
    293292                return;
     
    297296        usb_address_t new_device_address = usb_drv_request_address(hc);
    298297        if (new_device_address < 0) {
    299                 dprintf(1, "failed to get free USB address");
     298                dprintf(USB_LOG_LEVEL_ERROR, "failed to get free USB address");
    300299                opResult = new_device_address;
    301300                usb_hub_release_default_address(hc);
    302301                return;
    303302        }
    304         dprintf(1, "setting new address");
     303        dprintf(USB_LOG_LEVEL_INFO, "setting new address %d",new_device_address);
    305304        opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
    306305            new_device_address);
    307306
    308307        if (opResult != EOK) {
    309                 dprintf(1, "could not set address for new device");
     308                dprintf(USB_LOG_LEVEL_ERROR, "could not set address for new device");
    310309                usb_hub_release_default_address(hc);
    311310                return;
     
    322321            new_device_address, &child_handle);
    323322        if (opResult != EOK) {
    324                 dprintf(1, "could not start driver for new device");
     323                dprintf(USB_LOG_LEVEL_ERROR, "could not start driver for new device");
    325324                return;
    326325        }
     
    330329        opResult = usb_drv_bind_address(hc, new_device_address, child_handle);
    331330        if (opResult != EOK) {
    332                 dprintf(1, "could not assign address of device in hcd");
    333                 return;
    334         }
    335         dprintf(1, "new device address %d, handle %zu",
     331                dprintf(USB_LOG_LEVEL_ERROR, "could not assign address of device in hcd");
     332                return;
     333        }
     334        dprintf(USB_LOG_LEVEL_INFO, "new device address %d, handle %zu",
    336335            new_device_address, child_handle);
    337336
     
    358357                opResult = usb_drv_release_address(hc,hub->attached_devs[port].address);
    359358                if(opResult != EOK) {
    360                         dprintf(1, "could not release address of " \
     359                        dprintf(USB_LOG_LEVEL_WARNING, "could not release address of " \
    361360                            "removed device: %d", opResult);
    362361                }
    363362                hub->attached_devs[port].address = 0;
    364363        }else{
    365                 dprintf(1, "this is strange, disconnected device had no address");
     364                dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address");
    366365                //device was disconnected before it`s port was reset - return default address
    367366                usb_drv_release_default_address(hc);
     
    377376static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc,
    378377        uint16_t port, usb_address_t address) {
    379         dprintf(1, "interrupt at port %d", port);
     378        dprintf(USB_LOG_LEVEL_DEBUG, "interrupt at port %d", port);
    380379        //determine type of change
    381380        usb_target_t target;
     
    395394                        );
    396395        if (opResult != EOK) {
    397                 dprintf(1, "ERROR: could not get port status");
     396                dprintf(USB_LOG_LEVEL_ERROR, "ERROR: could not get port status");
    398397                return;
    399398        }
    400399        if (rcvd_size != sizeof (usb_port_status_t)) {
    401                 dprintf(1, "ERROR: received status has incorrect size");
     400                dprintf(USB_LOG_LEVEL_ERROR, "ERROR: received status has incorrect size");
    402401                return;
    403402        }
     
    408407                // TODO: check opResult
    409408                if (usb_port_dev_connected(&status)) {
    410                         dprintf(1, "some connection changed");
     409                        dprintf(USB_LOG_LEVEL_INFO, "some connection changed");
    411410                        usb_hub_init_add_device(hc, port, target);
    412411                } else {
     
    416415        //port reset
    417416        if (usb_port_reset_completed(&status)) {
    418                 dprintf(1, "port reset complete");
     417                dprintf(USB_LOG_LEVEL_INFO, "port reset complete");
    419418                if (usb_port_enabled(&status)) {
    420419                        usb_hub_finalize_add_device(hub, hc, port, target);
    421420                } else {
    422                         dprintf(1, "ERROR: port reset, but port still not enabled");
     421                        dprintf(USB_LOG_LEVEL_WARNING, "ERROR: port reset, but port still not enabled");
    423422                }
    424423        }
     
    429428        usb_port_set_dev_connected(&status, false);
    430429        if (status>>16) {
    431                 dprintf(1, "there was some unsupported change on port %d: %X",port,status);
     430                dprintf(USB_LOG_LEVEL_INFO, "there was some unsupported change on port %d: %X",port,status);
    432431
    433432        }
     
    458457                target.address = hub_info->usb_device->address;
    459458                target.endpoint = 1;/// \TODO get from endpoint descriptor
    460                 dprintf(1, "checking changes for hub at addr %d",
     459                dprintf(USB_LOG_LEVEL_INFO, "checking changes for hub at addr %d",
    461460                    target.address);
    462461
     
    489488                if (opResult != EOK) {
    490489                        free(change_bitmap);
    491                         dprintf(1, "something went wrong while getting status of hub");
     490                        dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub");
    492491                        continue;
    493492                }
     
    503502                free(change_bitmap);
    504503
    505                 ipc_hangup(hc);
     504                async_hangup(hc);
    506505                fibril_mutex_lock(&usb_hub_list_lock);
    507506        }
  • uspace/drv/usbhub/usbhub_private.h

    r1110ebd rcd50486  
    6161//************
    6262//
    63 // convenience debug printf
     63// convenience debug printf for usb hub
    6464//
    6565//************
    6666#define dprintf(level, format, ...) \
    67         usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
     67        usb_log_printf((level), format "\n", ##__VA_ARGS__)
     68
    6869
    6970/**
  • uspace/drv/usbhub/utils.c

    r1110ebd rcd50486  
    116116
    117117int usb_drv_sync_control_read(
    118                 int phone, usb_target_t target,
    119                 usb_device_request_setup_packet_t * request,
    120                 void * rcvd_buffer, size_t rcvd_size, size_t * actual_size
    121                 ) {
     118    int phone, usb_target_t target,
     119    usb_device_request_setup_packet_t * request,
     120    void * rcvd_buffer, size_t rcvd_size, size_t * actual_size
     121) {
    122122        usb_handle_t handle;
    123123        int opResult;
    124124        //setup
    125125        opResult = usb_drv_async_control_read_setup(phone, target,
    126                         request, sizeof (usb_device_request_setup_packet_t),
    127                         &handle);
     126            request, sizeof (usb_device_request_setup_packet_t),
     127            &handle);
    128128        if (opResult != EOK) {
    129129                return opResult;
     
    158158
    159159int usb_drv_sync_control_write(
    160                 int phone, usb_target_t target,
    161                 usb_device_request_setup_packet_t * request,
    162                 void * sent_buffer, size_t sent_size
    163                 ) {
     160    int phone, usb_target_t target,
     161    usb_device_request_setup_packet_t * request,
     162    void * sent_buffer, size_t sent_size
     163) {
    164164        usb_handle_t handle;
    165165        int opResult;
    166166        //setup
    167167        opResult = usb_drv_async_control_write_setup(phone, target,
    168                         request, sizeof (usb_device_request_setup_packet_t),
    169                         &handle);
     168            request, sizeof (usb_device_request_setup_packet_t),
     169            &handle);
    170170        if (opResult != EOK) {
    171171                return opResult;
     
    188188        //finalize
    189189        opResult = usb_drv_async_control_write_status(phone, target,
    190                         &handle);
     190            &handle);
    191191        if (opResult != EOK) {
    192192                return opResult;
  • uspace/drv/vhc/conndev.c

    r1110ebd rcd50486  
    9090                    = virtdev_add_device(callback, (sysarg_t)fibril_get_id());
    9191                if (!dev) {
    92                         ipc_answer_0(icallid, EEXISTS);
    93                         ipc_hangup(callback);
     92                        async_answer_0(icallid, EEXISTS);
     93                        async_hangup(callback);
    9494                        return;
    9595                }
    96                 ipc_answer_0(icallid, EOK);
     96                async_answer_0(icallid, EOK);
    9797
    9898                char devname[DEVICE_NAME_MAXLENGTH + 1];
     
    105105        }
    106106
    107         ipc_answer_0(icallid, EINVAL);
     107        async_answer_0(icallid, EINVAL);
    108108}
    109109
  • uspace/drv/vhc/devices.c

    r1110ebd rcd50486  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <adt/list.h>
    3837#include <bool.h>
  • uspace/drv/vhc/hc.c

    r1110ebd rcd50486  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <adt/list.h>
    3837#include <bool.h>
  • uspace/drv/vhc/hcd.c

    r1110ebd rcd50486  
    3535
    3636#include <devmap.h>
    37 #include <ipc/ipc.h>
    3837#include <async.h>
    3938#include <unistd.h>
Note: See TracChangeset for help on using the changeset viewer.