Changes in / [6298d80:17ceb72] in mainline


Ignore:
Location:
uspace
Files:
3 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.c

    r6298d80 r17ceb72  
    9292        pci_fun_t *dev_data = (pci_fun_t *) fnode->driver_data;
    9393
    94         sysarg_t apic;
    95         sysarg_t i8259;
     94  sysarg_t apic;
     95  sysarg_t i8259;
    9696
    9797        int irc_phone = -1;
    98         int irc_service = -1;
    99 
    100         if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) {
    101                 irc_service = SERVICE_APIC;
     98        int irc_service = 0;
     99
     100  if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) {
     101    irc_service = SERVICE_APIC;
    102102        } else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) {
    103                 irc_service = SERVICE_I8259;
    104         }
    105 
    106         if (irc_service == -1) {
     103    irc_service = SERVICE_I8259;
     104        }
     105
     106  if (irc_service == 0)
    107107                return false;
    108         }
    109108
    110109        irc_phone = service_connect_blocking(irc_service, 0, 0);
    111         if (irc_phone < 0) {
     110        if (irc_phone < 0)
    112111                return false;
    113         }
    114112
    115113        size_t i;
    116         for (i = 0; i < dev_data->hw_resources.count; i++) {
     114  for (i = 0; i < dev_data->hw_resources.count; i++) {
    117115                if (dev_data->hw_resources.resources[i].type == INTERRUPT) {
    118116                        int irq = dev_data->hw_resources.resources[i].res.interrupt.irq;
  • uspace/drv/usbmouse/init.c

    r6298d80 r17ceb72  
    4242
    4343/** Mouse polling endpoint description for boot protocol subclass. */
    44 usb_endpoint_description_t poll_endpoint_description = {
     44static usb_endpoint_description_t poll_endpoint_description = {
    4545        .transfer_type = USB_TRANSFER_INTERRUPT,
    4646        .direction = USB_DIRECTION_IN,
     
    5151};
    5252
     53/** Initialize poll pipe.
     54 *
     55 * Expects that session is already started on control pipe zero.
     56 *
     57 * @param mouse Mouse device.
     58 * @param my_interface Interface number.
     59 * @return Error code.
     60 */
     61static int intialize_poll_pipe(usb_mouse_t *mouse, int my_interface)
     62{
     63        assert(usb_endpoint_pipe_is_session_started(&mouse->ctrl_pipe));
     64
     65        int rc;
     66
     67        void *config_descriptor;
     68        size_t config_descriptor_size;
     69
     70        rc = usb_request_get_full_configuration_descriptor_alloc(
     71            &mouse->ctrl_pipe, 0, &config_descriptor, &config_descriptor_size);
     72        if (rc != EOK) {
     73                return rc;
     74        }
     75
     76        usb_endpoint_mapping_t endpoint_mapping[1] = {
     77                {
     78                        .pipe = &mouse->poll_pipe,
     79                        .description = &poll_endpoint_description,
     80                        .interface_no = my_interface
     81                }
     82        };
     83
     84        rc = usb_endpoint_pipe_initialize_from_configuration(endpoint_mapping,
     85            1, config_descriptor, config_descriptor_size, &mouse->wire);
     86        if (rc != EOK) {
     87                return rc;
     88        }
     89
     90        if (!endpoint_mapping[0].present) {
     91                return ENOENT;
     92        }
     93
     94        mouse->poll_interval_us = 1000 * endpoint_mapping[0].descriptor->poll_interval;
     95
     96        usb_log_debug("prepared polling endpoint %d (interval %zu).\n",
     97            mouse->poll_pipe.endpoint_no, mouse->poll_interval_us);
     98
     99        return EOK;
     100}
     101
    53102static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
    54103/** Device ops for USB mouse. */
     
    94143 * @return Error code.
    95144 */
    96 int usb_mouse_create(usb_device_t *dev)
     145int usb_mouse_create(ddf_dev_t *dev)
    97146{
    98147        usb_mouse_t *mouse = malloc(sizeof(usb_mouse_t));
     
    100149                return ENOMEM;
    101150        }
    102         mouse->dev = dev;
     151        mouse->device = dev;
    103152        mouse->console_phone = -1;
    104153
    105154        int rc;
    106155
     156        /* Initialize the backing connection. */
     157        rc = usb_device_connection_initialize_from_device(&mouse->wire, dev);
     158        if (rc != EOK) {
     159                goto leave;
     160        }
     161
     162        /* Initialize the default control pipe. */
     163        rc = usb_endpoint_pipe_initialize_default_control(&mouse->ctrl_pipe,
     164            &mouse->wire);
     165        if (rc != EOK) {
     166                goto leave;
     167        }
     168
     169        rc = usb_endpoint_pipe_start_session(&mouse->ctrl_pipe);
     170        if (rc != EOK) {
     171                goto leave;
     172        }
     173
     174        rc = intialize_poll_pipe(mouse, usb_device_get_assigned_interface(dev));
     175
     176        /* We can ignore error here. */
     177        usb_endpoint_pipe_end_session(&mouse->ctrl_pipe);
     178
     179        if (rc != EOK) {
     180                goto leave;
     181        }
     182
    107183        /* Create DDF function. */
    108         mouse->mouse_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "mouse");
     184        mouse->mouse_fun = ddf_fun_create(dev, fun_exposed, "mouse");
    109185        if (mouse->mouse_fun == NULL) {
    110186                rc = ENOMEM;
  • uspace/drv/usbmouse/main.c

    r6298d80 r17ceb72  
    4444 * @return Error code.
    4545 */
    46 static int usbmouse_add_device(usb_device_t *dev)
     46static int usbmouse_add_device(ddf_dev_t *dev)
    4747{
    4848        int rc = usb_mouse_create(dev);
     
    5353        }
    5454
    55         usb_log_debug("Polling pipe at endpoint %d.\n", dev->pipes[0].pipe->endpoint_no);
    56 
    57         rc = usb_device_auto_poll(dev, 0,
    58             usb_mouse_polling_callback, dev->pipes[0].pipe->max_packet_size,
    59             usb_mouse_polling_ended_callback, dev->driver_data);
    60 
    61         if (rc != EOK) {
    62                 usb_log_error("Failed to start polling fibril: %s.\n",
    63                     str_error(rc));
    64                 return rc;
     55        fid_t poll_fibril = fibril_create(usb_mouse_polling_fibril, dev);
     56        if (poll_fibril == 0) {
     57                usb_log_error("Failed to initialize polling fibril.\n");
     58                /* FIXME: free allocated resources. */
     59                return ENOMEM;
    6560        }
    6661
     62        fibril_add_ready(poll_fibril);
     63
    6764        usb_log_info("controlling new mouse (handle %llu).\n",
    68             dev->ddf_dev->handle);
     65            dev->handle);
    6966
    7067        return EOK;
     
    7269
    7370/** USB mouse driver ops. */
    74 static usb_driver_ops_t mouse_driver_ops = {
     71static driver_ops_t mouse_driver_ops = {
    7572        .add_device = usbmouse_add_device,
    7673};
    7774
    78 static usb_endpoint_description_t *endpoints[] = {
    79         &poll_endpoint_description,
    80         NULL
    81 };
    82 
    8375/** USB mouse driver. */
    84 static usb_driver_t mouse_driver = {
     76static driver_t mouse_driver = {
    8577        .name = NAME,
    86         .ops = &mouse_driver_ops,
    87         .endpoints = endpoints
     78        .driver_ops = &mouse_driver_ops
    8879};
    8980
     
    9283        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    9384
    94         return usb_driver_main(&mouse_driver);
     85        return ddf_driver_main(&mouse_driver);
    9586}
    9687
  • uspace/drv/usbmouse/mouse.c

    r6298d80 r17ceb72  
    4040#include <ipc/mouse.h>
    4141
    42 /** Mouse polling callback.
     42/** Fibril function for polling the mouse device.
    4343 *
    44  * @param dev Device that is being polled.
    45  * @param buffer Data buffer.
    46  * @param buffer_size Buffer size in bytes.
    47  * @param arg Custom argument - points to usb_mouse_t.
    48  * @return Always true.
     44 * This function shall not terminate unless the device breaks and fails
     45 * to send data (e.g. stalls on data request).
     46 *
     47 * @param arg ddf_dev_t type representing the mouse device.
     48 * @return EOK Always.
    4949 */
    50 bool usb_mouse_polling_callback(usb_device_t *dev,
    51     uint8_t *buffer, size_t buffer_size, void *arg)
     50int usb_mouse_polling_fibril(void *arg)
    5251{
    53         usb_mouse_t *mouse = (usb_mouse_t *) arg;
     52        assert(arg != NULL);
     53        ddf_dev_t *dev = (ddf_dev_t *) arg;
     54        usb_mouse_t *mouse = (usb_mouse_t *) dev->driver_data;
    5455
    55         usb_log_debug2("got buffer: %s.\n",
    56             usb_debug_str_buffer(buffer, buffer_size, 0));
     56        assert(mouse);
    5757
    58         uint8_t butt = buffer[0];
    59         char str_buttons[4] = {
    60                 butt & 1 ? '#' : '.',
    61                 butt & 2 ? '#' : '.',
    62                 butt & 4 ? '#' : '.',
    63                 0
    64         };
     58        size_t buffer_size = mouse->poll_pipe.max_packet_size;
    6559
    66         int shift_x = ((int) buffer[1]) - 127;
    67         int shift_y = ((int) buffer[2]) - 127;
    68         int wheel = ((int) buffer[3]) - 127;
    69 
    70         if (buffer[1] == 0) {
    71                 shift_x = 0;
    72         }
    73         if (buffer[2] == 0) {
    74                 shift_y = 0;
    75         }
    76         if (buffer[3] == 0) {
    77                 wheel = 0;
     60        if (buffer_size < 4) {
     61                usb_log_error("Weird mouse, results will be skewed.\n");
     62                buffer_size = 4;
    7863        }
    7964
    80         if (mouse->console_phone >= 0) {
    81                 if ((shift_x != 0) || (shift_y != 0)) {
    82                         /* FIXME: guessed for QEMU */
    83                         async_req_2_0(mouse->console_phone,
    84                             MEVENT_MOVE,
    85                             - shift_x / 10,  - shift_y / 10);
    86                 }
    87                 if (butt) {
    88                         /* FIXME: proper button clicking. */
    89                         async_req_2_0(mouse->console_phone,
    90                             MEVENT_BUTTON, 1, 1);
    91                         async_req_2_0(mouse->console_phone,
    92                             MEVENT_BUTTON, 1, 0);
    93                 }
     65        uint8_t *buffer = malloc(buffer_size);
     66        if (buffer == NULL) {
     67                usb_log_error("Out of memory, poll fibril aborted.\n");
     68                return ENOMEM;
    9469        }
    9570
    96         usb_log_debug("buttons=%s  dX=%+3d  dY=%+3d  wheel=%+3d\n",
    97             str_buttons, shift_x, shift_y, wheel);
     71        while (true) {
     72                async_usleep(mouse->poll_interval_us);
    9873
    99         /* Guess. */
    100         async_usleep(1000);
     74                size_t actual_size;
     75                int rc;
    10176
    102         return true;
     77                /*
     78                 * Error checking note:
     79                 * - failure when starting a session is considered
     80                 *   temporary (e.g. out of phones, next try might succeed)
     81                 * - failure of transfer considered fatal (probably the
     82                 *   device was unplugged)
     83                 * - session closing not checked (shall not fail anyway)
     84                 */
     85
     86                rc = usb_endpoint_pipe_start_session(&mouse->poll_pipe);
     87                if (rc != EOK) {
     88                        usb_log_warning("Failed to start session, will try again: %s.\n",
     89                            str_error(rc));
     90                        continue;
     91                }
     92
     93                rc = usb_endpoint_pipe_read(&mouse->poll_pipe,
     94                    buffer, buffer_size, &actual_size);
     95
     96                usb_endpoint_pipe_end_session(&mouse->poll_pipe);
     97
     98                if (rc != EOK) {
     99                        usb_log_error("Failed reading mouse input: %s.\n",
     100                            str_error(rc));
     101                        break;
     102                }
     103
     104                usb_log_debug2("got buffer: %s.\n",
     105                    usb_debug_str_buffer(buffer, buffer_size, 0));
     106
     107                uint8_t butt = buffer[0];
     108                char str_buttons[4] = {
     109                        butt & 1 ? '#' : '.',
     110                        butt & 2 ? '#' : '.',
     111                        butt & 4 ? '#' : '.',
     112                        0
     113                };
     114
     115                int shift_x = ((int) buffer[1]) - 127;
     116                int shift_y = ((int) buffer[2]) - 127;
     117                int wheel = ((int) buffer[3]) - 127;
     118
     119                if (buffer[1] == 0) {
     120                        shift_x = 0;
     121                }
     122                if (buffer[2] == 0) {
     123                        shift_y = 0;
     124                }
     125                if (buffer[3] == 0) {
     126                        wheel = 0;
     127                }
     128
     129                if (mouse->console_phone >= 0) {
     130                        if ((shift_x != 0) || (shift_y != 0)) {
     131                                /* FIXME: guessed for QEMU */
     132                                async_req_2_0(mouse->console_phone,
     133                                    MEVENT_MOVE,
     134                                    - shift_x / 10,  - shift_y / 10);
     135                        }
     136                        if (butt) {
     137                                /* FIXME: proper button clicking. */
     138                                async_req_2_0(mouse->console_phone,
     139                                    MEVENT_BUTTON, 1, 1);
     140                                async_req_2_0(mouse->console_phone,
     141                                    MEVENT_BUTTON, 1, 0);
     142                        }
     143                }
     144
     145                usb_log_debug("buttons=%s  dX=%+3d  dY=%+3d  wheel=%+3d\n",
     146                   str_buttons, shift_x, shift_y, wheel);
     147        }
     148
     149        /*
     150         * Device was probably unplugged.
     151         * Hang-up the phone to the console.
     152         * FIXME: release allocated memory.
     153         */
     154        async_hangup(mouse->console_phone);
     155        mouse->console_phone = -1;
     156
     157        usb_log_error("Mouse polling fibril terminated.\n");
     158
     159        return EOK;
    103160}
    104161
    105 /** Callback when polling is terminated.
    106  *
    107  * @param dev Device where the polling terminated.
    108  * @param recurring_errors Whether the polling was terminated due to
    109  *      recurring errors.
    110  * @param arg Custom argument - points to usb_mouse_t.
    111  */
    112 void usb_mouse_polling_ended_callback(usb_device_t *dev,
    113     bool recurring_errors, void *arg)
    114 {
    115         usb_mouse_t *mouse = (usb_mouse_t *) arg;
    116 
    117         async_hangup(mouse->console_phone);
    118         mouse->console_phone = -1;
    119 }
    120162
    121163/**
  • uspace/drv/usbmouse/mouse.h

    r6298d80 r17ceb72  
    3737#define USBMOUSE_MOUSE_H_
    3838
    39 #include <usb/devdrv.h>
     39#include <ddf/driver.h>
    4040#include <usb/pipes.h>
    4141#include <time.h>
     
    4646typedef struct {
    4747        /** Generic device container. */
    48         usb_device_t *dev;
     48        ddf_dev_t *device;
    4949        /** Function representing the device. */
    5050        ddf_fun_t *mouse_fun;
     51        /** Representation of connection to the device. */
     52        usb_device_connection_t wire;
     53        /** Default (zero) control pipe. */
     54        usb_endpoint_pipe_t ctrl_pipe;
     55        /** Polling (in) pipe. */
     56        usb_endpoint_pipe_t poll_pipe;
    5157        /** Polling interval in microseconds. */
    5258        suseconds_t poll_interval_us;
     
    5561} usb_mouse_t;
    5662
    57 #define POLL_PIPE(dev) ((dev)->pipes[0].pipe)
     63int usb_mouse_create(ddf_dev_t *);
    5864
    59 extern usb_endpoint_description_t poll_endpoint_description;
    60 
    61 int usb_mouse_create(usb_device_t *);
    62 
    63 bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t, void *);
    64 void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
     65int usb_mouse_polling_fibril(void *);
    6566
    6667#endif
  • uspace/lib/drv/generic/remote_usbhc.c

    r6298d80 r17ceb72  
    5555static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5656static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    57 static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    58 static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5957//static void remote_usbhc(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    6058
     
    7573
    7674        remote_usbhc_control_write,
    77         remote_usbhc_control_read,
    78 
    79         remote_usbhc_register_endpoint,
    80         remote_usbhc_unregister_endpoint
     75        remote_usbhc_control_read
    8176};
    8277
     
    527522
    528523
    529 void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
    530     ipc_callid_t callid, ipc_call_t *call)
    531 {
    532         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    533 
    534         if (!usb_iface->register_endpoint) {
    535                 async_answer_0(callid, ENOTSUP);
    536                 return;
    537         }
    538 
    539 #define INIT_FROM_HIGH_DATA(type, var, arg_no) \
    540         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / 256
    541 #define INIT_FROM_LOW_DATA(type, var, arg_no) \
    542         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % 256
    543 
    544         INIT_FROM_HIGH_DATA(usb_address_t, address, 1);
    545         INIT_FROM_LOW_DATA(usb_endpoint_t, endpoint, 1);
    546         INIT_FROM_HIGH_DATA(usb_transfer_type_t, transfer_type, 2);
    547         INIT_FROM_LOW_DATA(usb_direction_t, direction, 2);
    548 
    549 #undef INIT_FROM_HIGH_DATA
    550 #undef INIT_FROM_LOW_DATA
    551 
    552         size_t max_packet_size = (size_t) DEV_IPC_GET_ARG3(*call);
    553         unsigned int interval  = (unsigned int) DEV_IPC_GET_ARG4(*call);
    554 
    555         int rc = usb_iface->register_endpoint(fun, address, endpoint,
    556             transfer_type, direction, max_packet_size, interval);
    557 
    558         async_answer_0(callid, rc);
    559 }
    560 
    561 
    562 void remote_usbhc_unregister_endpoint(ddf_fun_t *fun, void *iface,
    563     ipc_callid_t callid, ipc_call_t *call)
    564 {
    565         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    566 
    567         if (!usb_iface->unregister_endpoint) {
    568                 async_answer_0(callid, ENOTSUP);
    569                 return;
    570         }
    571 
    572         usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
    573         usb_endpoint_t endpoint = (usb_endpoint_t) DEV_IPC_GET_ARG2(*call);
    574         usb_direction_t direction = (usb_direction_t) DEV_IPC_GET_ARG3(*call);
    575 
    576         int rc = usb_iface->unregister_endpoint(fun,
    577             address, endpoint, direction);
    578 
    579         async_answer_0(callid, rc);
    580 }
    581 
    582524
    583525/**
  • uspace/lib/drv/include/usbhc_iface.h

    r6298d80 r17ceb72  
    167167        IPC_M_USBHC_CONTROL_READ,
    168168
    169         /** Register endpoint attributes at host controller.
    170          * This is used to reserve portion of USB bandwidth.
    171          * Parameters:
    172          * - USB address + endpoint number (ADDR * 256 + EP)
    173          * - transfer type + direction (TYPE * 256 + DIR)
    174          * - maximum packet size
    175          * - interval (in milliseconds)
    176          * Answer:
    177          * - EOK - reservation successful
    178          * - ELIMIT - not enough bandwidth to satisfy the request
    179          */
    180         IPC_M_USBHC_REGISTER_ENDPOINT,
    181 
    182         /** Revert endpoint registration.
    183          * Parameters:
    184          * - USB address
    185          * - endpoint number
    186          * - data direction
    187          * Answer:
    188          * - EOK - endpoint unregistered
    189          * - ENOENT - unknown endpoint
    190          */
    191         IPC_M_USBHC_UNREGISTER_ENDPOINT
     169        /* IPC_M_USB_ */
    192170} usbhc_iface_funcs_t;
    193171
     
    222200        int (*release_address)(ddf_fun_t *, usb_address_t);
    223201
    224         int (*register_endpoint)(ddf_fun_t *, usb_address_t, usb_endpoint_t,
    225             usb_transfer_type_t, usb_direction_t, size_t, unsigned int);
    226         int (*unregister_endpoint)(ddf_fun_t *, usb_address_t, usb_endpoint_t,
    227             usb_direction_t);
    228 
    229202        usbhc_iface_transfer_out_t interrupt_out;
    230203        usbhc_iface_transfer_in_t interrupt_in;
  • uspace/lib/usb/Makefile

    r6298d80 r17ceb72  
    3737        src/ddfiface.c \
    3838        src/debug.c \
    39         src/devdrv.c \
    40         src/devpoll.c \
    4139        src/dp.c \
    4240        src/dump.c \
  • uspace/lib/usb/include/usb/pipes.h

    r6298d80 r17ceb72  
    106106        const usb_endpoint_description_t *description;
    107107        /** Interface number the endpoint must belong to (-1 for any). */
    108         int interface_no;
     108        const int interface_no;
    109109        /** Found descriptor fitting the description. */
    110110        usb_standard_endpoint_descriptor_t *descriptor;
     
    131131int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
    132132    size_t, uint8_t *, size_t, usb_device_connection_t *);
    133 int usb_endpoint_pipe_register(usb_endpoint_pipe_t *, unsigned int,
    134     usb_hc_connection_t *);
    135 int usb_endpoint_pipe_unregister(usb_endpoint_pipe_t *, usb_hc_connection_t *);
     133
    136134
    137135int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *);
  • uspace/lib/usb/src/pipesinit.c

    r6298d80 r17ceb72  
    3838#include <usb/dp.h>
    3939#include <usb/request.h>
    40 #include <usbhc_iface.h>
    4140#include <errno.h>
    4241#include <assert.h>
     
    394393}
    395394
    396 /** Register endpoint with the host controller.
    397  *
    398  * @param pipe Pipe to be registered.
    399  * @param interval Polling interval.
    400  * @param hc_connection Connection to the host controller (must be opened).
    401  * @return Error code.
    402  */
    403 int usb_endpoint_pipe_register(usb_endpoint_pipe_t *pipe,
    404     unsigned int interval,
    405     usb_hc_connection_t *hc_connection)
    406 {
    407         assert(pipe);
    408         assert(hc_connection);
    409 
    410         if (!usb_hc_connection_is_opened(hc_connection)) {
    411                 return EBADF;
    412         }
    413 
    414 #define _PACK(high, low) ((high) * 256 + (low))
    415 
    416         return async_req_5_0(hc_connection->hc_phone,
    417             DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT,
    418             _PACK(pipe->wire->address, pipe->endpoint_no),
    419             _PACK(pipe->transfer_type, pipe->direction),
    420             pipe->max_packet_size, interval);
    421 
    422 #undef _PACK
    423 }
    424 
    425 /** Revert endpoint registration with the host controller.
    426  *
    427  * @param pipe Pipe to be unregistered.
    428  * @param hc_connection Connection to the host controller (must be opened).
    429  * @return Error code.
    430  */
    431 int usb_endpoint_pipe_unregister(usb_endpoint_pipe_t *pipe,
    432     usb_hc_connection_t *hc_connection)
    433 {
    434         assert(pipe);
    435         assert(hc_connection);
    436 
    437         if (!usb_hc_connection_is_opened(hc_connection)) {
    438                 return EBADF;
    439         }
    440 
    441         return async_req_4_0(hc_connection->hc_phone,
    442             DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_UNREGISTER_ENDPOINT,
    443             pipe->wire->address, pipe->endpoint_no, pipe->direction);
    444 }
    445 
    446395/**
    447396 * @}
  • uspace/lib/usb/src/recognise.c

    r6298d80 r17ceb72  
    374374         * naming etc., something more descriptive could be created.
    375375         */
    376         rc = asprintf(&child_name, "usb%02zu_a%d",
    377             this_device_name_index, address);
     376        rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index);
    378377        if (rc < 0) {
    379378                goto failure;
  • uspace/srv/hw/irc/apic/apic.c

    r6298d80 r17ceb72  
    5454#define NAME  "apic"
    5555
    56 static bool apic_found = false;
    57 
    5856static int apic_enable_irq(sysarg_t irq)
    5957{
     
    8179                callid = async_get_call(&call);
    8280               
    83                 sysarg_t method = IPC_GET_IMETHOD(call);
    84                 if (method == IPC_M_PHONE_HUNGUP) {
    85                         return;
    86                 }
    87 
    88                 if (!apic_found) {
    89                         async_answer_0(callid, ENOTSUP);
    90                         break;
    91                 }
    92 
    93                 switch (method) {
     81                switch (IPC_GET_IMETHOD(call)) {
    9482                case IRC_ENABLE_INTERRUPT:
    9583                        async_answer_0(callid, apic_enable_irq(IPC_GET_ARG1(call)));
     
    10997 *
    11098 */
    111 static void apic_init(void)
     99static bool apic_init(void)
    112100{
    113101        sysarg_t apic;
    114102       
    115         apic_found = sysinfo_get_value("apic", &apic) && apic;
    116         if (!apic_found) {
    117                 printf(NAME ": Warning: no APIC found\n");
     103        if ((sysinfo_get_value("apic", &apic) != EOK) || (!apic)) {
     104                printf(NAME ": No APIC found\n");
     105                return false;
    118106        }
    119107       
    120108        async_set_client_connection(apic_connection);
    121109        service_register(SERVICE_APIC);
     110       
     111        return true;
    122112}
    123113
     
    126116        printf(NAME ": HelenOS APIC driver\n");
    127117       
    128         apic_init();
    129 
     118        if (!apic_init())
     119                return -1;
     120       
    130121        printf(NAME ": Accepting connections\n");
    131122        async_manager();
Note: See TracChangeset for help on using the changeset viewer.