Changeset c1693dae in mainline
- Timestamp:
- 2011-04-15T12:52:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9063484
- Parents:
- cd5b878
- Location:
- uspace/drv/usbhub
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
rcd5b878 rc1693dae 153 153 bool hub_port_changes_callback(usb_device_t *dev, 154 154 uint8_t *change_bitmap, size_t change_bitmap_size, void *arg) { 155 usb_log_debug("hub_port_changes_callback\n"); 155 156 usb_hub_info_t *hub = (usb_hub_info_t *) arg; 156 157 … … 217 218 // get hub descriptor 218 219 usb_log_debug("creating serialized descriptor\n"); 219 void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE); 220 //void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE); 221 uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE]; 220 222 usb_hub_descriptor_t * descriptor; 221 223 int opResult; … … 239 241 if (descriptor == NULL) { 240 242 usb_log_warning("could not deserialize descriptor \n"); 241 return opResult;243 return ENOMEM; 242 244 } 243 245 usb_log_debug("setting port count to %d\n", descriptor->ports_count); 244 246 hub_info->port_count = descriptor->ports_count; 245 247 /// \TODO this is not semantically correct 248 bool is_power_switched = 249 ((descriptor->hub_characteristics & 1) ==0); 250 bool has_individual_port_powering = 251 ((descriptor->hub_characteristics & 1) !=0); 246 252 hub_info->ports = malloc( 247 253 sizeof (usb_hub_port_t) * (hub_info->port_count + 1)); … … 250 256 usb_hub_port_init(&hub_info->ports[port]); 251 257 } 252 for (port = 0; port < hub_info->port_count; port++) { 253 opResult = usb_hub_set_port_feature(hub_info->control_pipe, 254 port+1, USB_HUB_FEATURE_PORT_POWER); 255 if (opResult != EOK) { 256 usb_log_error("cannot power on port %d; %d\n", 257 port+1, opResult); 258 } 258 if(is_power_switched){ 259 usb_log_debug("is_power_switched\n"); 260 if(has_individual_port_powering){ 261 usb_log_debug("has_individual_port_powering\n"); 262 for (port = 0; port < hub_info->port_count; port++) { 263 opResult = usb_hub_set_port_feature(hub_info->control_pipe, 264 port+1, USB_HUB_FEATURE_PORT_POWER); 265 if (opResult != EOK) { 266 usb_log_error("cannot power on port %d; %d\n", 267 port+1, opResult); 268 } 269 } 270 }else{ 271 usb_log_debug("!has_individual_port_powering\n"); 272 opResult = usb_hub_set_feature(hub_info->control_pipe, 273 USB_HUB_FEATURE_C_HUB_LOCAL_POWER); 274 if (opResult != EOK) { 275 usb_log_error("cannot power hub; %d\n", 276 opResult); 277 } 278 } 279 }else{ 280 usb_log_debug("!is_power_switched\n"); 259 281 } 260 282 usb_log_debug2("freeing data\n"); 261 free(serialized_descriptor);283 //free(serialized_descriptor); 262 284 //free(descriptor->devices_removable); 263 285 free(descriptor); -
uspace/drv/usbhub/usbhub_private.h
rcd5b878 rc1693dae 113 113 114 114 usb_device_request_setup_packet_t clear_request = { 115 .request_type = USB_HUB_REQ_TYPE_ CLEAR_PORT_FEATURE,115 .request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE, 116 116 .request = USB_DEVREQ_SET_FEATURE, 117 117 .length = 0, -
uspace/drv/usbhub/utils.c
rcd5b878 rc1693dae 70 70 uint8_t * result = malloc(size); 71 71 //size 72 usb_serialize_hub_descriptor(descriptor,result); 72 if(result) 73 usb_serialize_hub_descriptor(descriptor,result); 73 74 return result; 74 75 }
Note:
See TracChangeset
for help on using the changeset viewer.