Revision 5fafdf24 hw/usb-hub.c

b/hw/usb-hub.c
2 2
 * QEMU USB HUB emulation
3 3
 *
4 4
 * Copyright (c) 2005 Fabrice Bellard
5
 * 
5
 *
6 6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 7
 * of this software and associated documentation files (the "Software"), to deal
8 8
 * in the Software without restriction, including without limitation the rights
......
112 112
	0x01,       /*  u8  bNumInterfaces; (1) */
113 113
	0x01,       /*  u8  bConfigurationValue; */
114 114
	0x00,       /*  u8  iConfiguration; */
115
	0xc0,       /*  u8  bmAttributes; 
115
	0xc0,       /*  u8  bmAttributes;
116 116
				 Bit 7: must be set,
117 117
				     6: Self-powered,
118 118
				     5: Remote wakeup,
119 119
				     4..0: resvd */
120 120
	0x00,       /*  u8  MaxPower; */
121
      
121
     
122 122
	/* USB 1.1:
123 123
	 * USB 2.0, single TT organization (mandatory):
124 124
	 *	one interface, protocol 0
......
140 140
	0x00,       /*  u8  if_bInterfaceSubClass; */
141 141
	0x00,       /*  u8  if_bInterfaceProtocol; [usb1.1 or single tt] */
142 142
	0x00,       /*  u8  if_iInterface; */
143
     
143
    
144 144
	/* one endpoint (status change endpoint) */
145 145
	0x07,       /*  u8  ep_bLength; */
146 146
	0x05,       /*  u8  ep_bDescriptorType; Endpoint */
......
167 167
{
168 168
    USBHubState *s = port1->opaque;
169 169
    USBHubPort *port = &s->ports[port1->index];
170
    
170
   
171 171
    if (dev) {
172 172
        if (port->port.dev)
173 173
            usb_attach(port1, NULL);
174
        
174
       
175 175
        port->wPortStatus |= PORT_STAT_CONNECTION;
176 176
        port->wPortChange |= PORT_STAT_C_CONNECTION;
177 177
        if (dev->speed == USB_SPEED_LOW)
......
244 244
    case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
245 245
        switch(value >> 8) {
246 246
        case USB_DT_DEVICE:
247
            memcpy(data, qemu_hub_dev_descriptor, 
247
            memcpy(data, qemu_hub_dev_descriptor,
248 248
                   sizeof(qemu_hub_dev_descriptor));
249 249
            ret = sizeof(qemu_hub_dev_descriptor);
250 250
            break;
251 251
        case USB_DT_CONFIG:
252
            memcpy(data, qemu_hub_config_descriptor, 
252
            memcpy(data, qemu_hub_config_descriptor,
253 253
                   sizeof(qemu_hub_config_descriptor));
254 254

  
255 255
            /* status change endpoint size based on number
......
401 401
    case GetHubDescriptor:
402 402
        {
403 403
            unsigned int n, limit, var_hub_size = 0;
404
            memcpy(data, qemu_hub_hub_descriptor, 
404
            memcpy(data, qemu_hub_hub_descriptor,
405 405
                   sizeof(qemu_hub_hub_descriptor));
406 406
            data[2] = s->nb_ports;
407 407

  
......
504 504
    if (dev->state == USB_STATE_DEFAULT &&
505 505
        dev->addr != 0 &&
506 506
        p->devaddr != dev->addr &&
507
        (p->pid == USB_TOKEN_SETUP || 
508
         p->pid == USB_TOKEN_OUT || 
507
        (p->pid == USB_TOKEN_SETUP ||
508
         p->pid == USB_TOKEN_OUT ||
509 509
         p->pid == USB_TOKEN_IN)) {
510 510
        /* broadcast the packet to the devices */
511 511
        return usb_hub_broadcast_packet(s, p);

Also available in: Unified diff