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

Changeset ebb98c5 in mainline


Ignore:
Timestamp:
2010-12-10T16:44:40Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
243cb86, 39701ed, fa9b606
Parents:
bf2063e9 (diff), cf978f2 (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 with vojtechhorky/ - minor changes

Fixed some bugs, root hub of VHC has address set.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rbf2063e9 rebb98c5  
    547547
    548548% Launch (devman) test drivers
    549 ! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
    550 
     549! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)
     550
  • uspace/app/virtusbkbd/virtusbkbd.c

    rbf2063e9 rebb98c5  
    202202int main(int argc, char * argv[])
    203203{
    204         printf("Dump of report descriptor (%u bytes):\n", report_descriptor_size);
     204        printf("Dump of report descriptor (%zu bytes):\n", report_descriptor_size);
    205205        size_t i;
    206206        for (i = 0; i < report_descriptor_size; i++) {
  • uspace/drv/root/root.c

    rbf2063e9 rebb98c5  
    8787
    8888        int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME,
    89             VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE);
     89            VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE,
     90            NULL);
    9091
    9192        return res;
     
    104105       
    105106        int res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME,
    106             PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE);
     107            PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE,
     108            NULL);
    107109
    108110        return res;
  • uspace/drv/rootvirt/rootvirt.c

    rbf2063e9 rebb98c5  
    8484
    8585        int rc = child_device_register_wrapper(parent, virt_dev->name,
    86             virt_dev->match_id, 10);
     86            virt_dev->match_id, 10, NULL);
    8787
    8888        if (rc == EOK) {
  • uspace/drv/test1/test1.c

    rbf2063e9 rebb98c5  
    6464
    6565        int rc = child_device_register_wrapper(parent, name,
    66             match_id, match_score);
     66            match_id, match_score, NULL);
    6767
    6868        if (rc == EOK) {
  • uspace/drv/test2/test2.c

    rbf2063e9 rebb98c5  
    6464
    6565        int rc = child_device_register_wrapper(parent, name,
    66             match_id, match_score);
     66            match_id, match_score, NULL);
    6767
    6868        if (rc == EOK) {
  • uspace/drv/vhc/connhost.c

    rbf2063e9 rebb98c5  
    9393    usbhc_iface_transfer_out_callback_t callback, void *arg)
    9494{
    95         printf(NAME ": transfer OUT [%d.%d (%s); %u]\n",
     95        printf(NAME ": transfer OUT [%d.%d (%s); %zu]\n",
    9696            target.address, target.endpoint,
    9797            usb_str_transfer_type(transfer_type),
     
    113113    usbhc_iface_transfer_out_callback_t callback, void *arg)
    114114{
    115         printf(NAME ": transfer SETUP [%d.%d (%s); %u]\n",
     115        printf(NAME ": transfer SETUP [%d.%d (%s); %zu]\n",
    116116            target.address, target.endpoint,
    117117            usb_str_transfer_type(transfer_type),
     
    133133    usbhc_iface_transfer_in_callback_t callback, void *arg)
    134134{
    135         printf(NAME ": transfer IN [%d.%d (%s); %u]\n",
     135        printf(NAME ": transfer IN [%d.%d (%s); %zu]\n",
    136136            target.address, target.endpoint,
    137137            usb_str_transfer_type(transfer_type),
  • uspace/drv/vhc/hcd.c

    rbf2063e9 rebb98c5  
    7979         * Initialize our hub and announce its presence.
    8080         */
    81         hub_init();
    82         usb_hcd_add_root_hub(dev);
     81        hub_init(dev);
    8382
    8483        printf("%s: virtual USB host controller ready.\n", NAME);
  • uspace/drv/vhc/hub.c

    rbf2063e9 rebb98c5  
    3737#include <usbvirt/device.h>
    3838#include <errno.h>
     39#include <str_error.h>
    3940#include <stdlib.h>
     41#include <driver.h>
    4042
    4143#include "vhcd.h"
    4244#include "hub.h"
    4345#include "hubintern.h"
     46#include "conn.h"
    4447
    4548
     
    148151hub_device_t hub_dev;
    149152
     153static usb_address_t hub_set_address(usbvirt_device_t *hub)
     154{
     155        usb_address_t new_address;
     156        int rc = vhc_iface.request_address(NULL, &new_address);
     157        if (rc != EOK) {
     158                return rc;
     159        }
     160       
     161        usb_device_request_setup_packet_t setup_packet = {
     162                .request_type = 0,
     163                .request = USB_DEVREQ_SET_ADDRESS,
     164                .index = 0,
     165                .length = 0,
     166        };
     167        setup_packet.value = new_address;
     168
     169        hub->transaction_setup(hub, 0, &setup_packet, sizeof(setup_packet));
     170        hub->transaction_in(hub, 0, NULL, 0, NULL);
     171       
     172        return new_address;
     173}
     174
    150175/** Initialize virtual hub. */
    151 void hub_init(void)
     176void hub_init(device_t *hc_dev)
    152177{
    153178        size_t i;
     
    163188       
    164189        dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT);
     190
     191        usb_address_t hub_address = hub_set_address(&virthub_dev);
     192        if (hub_address < 0) {
     193                dprintf(1, "problem changing hub address (%s)",
     194                    str_error(hub_address));
     195        }
     196
     197        dprintf(2, "virtual hub address changed to %d", hub_address);
     198
     199        char *id;
     200        int rc = asprintf(&id, "usb&hub");
     201        if (rc <= 0) {
     202                return;
     203        }
     204        devman_handle_t hub_handle;
     205        rc = child_device_register_wrapper(hc_dev, "hub", id, 10, &hub_handle);
     206        if (rc != EOK) {
     207                free(id);
     208        }
     209
     210        vhc_iface.bind_address(NULL, hub_address, hub_handle); 
     211
     212        dprintf(2, "virtual hub has devman handle %d", (int) hub_handle);
    165213}
    166214
  • uspace/drv/vhc/hub.h

    rbf2063e9 rebb98c5  
    3737
    3838#include <usbvirt/device.h>
     39#include <driver.h>
    3940
    4041#include "devices.h"
     
    4748extern usbvirt_device_t virthub_dev;
    4849
    49 void hub_init(void);
     50void hub_init(device_t *);
    5051size_t hub_add_device(virtdev_connection_t *);
    5152void hub_remove_device(virtdev_connection_t *);
  • uspace/lib/drv/generic/driver.c

    rbf2063e9 rebb98c5  
    390390 */
    391391int child_device_register_wrapper(device_t *parent, const char *child_name,
    392     const char *child_match_id, int child_match_score)
     392    const char *child_match_id, int child_match_score,
     393    devman_handle_t *child_handle)
    393394{
    394395        device_t *child = NULL;
     
    418419                goto failure;
    419420
     421        if (child_handle != NULL) {
     422                *child_handle = child->handle;
     423        }
    420424        return EOK;
    421425
  • uspace/lib/drv/include/driver.h

    rbf2063e9 rebb98c5  
    199199
    200200int child_device_register(device_t *, device_t *);
    201 int child_device_register_wrapper(device_t *, const char *, const char *, int);
     201int child_device_register_wrapper(device_t *, const char *, const char *, int,
     202    devman_handle_t *);
    202203
    203204
  • uspace/lib/usb/src/remotedrv.c

    rbf2063e9 rebb98c5  
    300300 */
    301301static void remote_in_callback(usb_hc_device_t *hc,
    302     usb_transaction_outcome_t outcome, size_t actual_size, void *arg)
     302    size_t actual_size, usb_transaction_outcome_t outcome, void *arg)
    303303{
    304304        transfer_info_t *transfer = (transfer_info_t *) arg;
Note: See TracChangeset for help on using the changeset viewer.