Changes in / [1d7a74e:192466bc] in mainline
- Location:
- uspace/drv/usbhub
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/main.c
r1d7a74e r192466bc 52 52 while(true){ 53 53 usb_hub_check_hub_changes(); 54 async_usleep(1000 * 1000 );54 async_usleep(1000 * 1000 );/// \TODO proper number once 55 55 } 56 56 return 0; -
uspace/drv/usbhub/usbhub.c
r1d7a74e r192466bc 46 46 #include "usbhub_private.h" 47 47 #include "port_status.h" 48 #include "usb/usb.h" 48 49 49 50 static usb_iface_t hub_usb_iface = { … … 85 86 86 87 // get hub descriptor 87 usb_target_t target;88 target.address = addr;89 target.endpoint = 0;90 usb_device_request_setup_packet_t request;91 //printf("[usb_hub] creating descriptor request\n");92 usb_hub_set_descriptor_request(&request);93 88 94 89 //printf("[usb_hub] creating serialized descriptor\n"); … … 98 93 int opResult; 99 94 //printf("[usb_hub] starting control transaction\n"); 100 opResult = usb_drv_sync_control_read( 101 hc, target, &request, serialized_descriptor, 95 96 opResult = usb_drv_req_get_descriptor(hc, addr, 97 USB_REQUEST_TYPE_CLASS, 98 USB_DESCTYPE_HUB, 0, 0, serialized_descriptor, 102 99 USB_HUB_MAX_DESCRIPTOR_SIZE, &received_size); 100 103 101 if (opResult != EOK) { 104 102 dprintf(1,"[usb_hub] failed when receiving hub descriptor, badcode = %d",opResult); … … 155 153 int port; 156 154 int opResult; 157 usb_device_request_setup_packet_t request;158 155 usb_target_t target; 159 156 target.address = hub_info->usb_device->address; … … 173 170 if(std_descriptor.configuration_count<1){ 174 171 dprintf(1,"[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE"); 172 //shouldn`t I return? 175 173 } 176 174 /// \TODO check other configurations … … 184 182 } 185 183 //set configuration 186 request.request_type = 0; 187 request.request = USB_DEVREQ_SET_CONFIGURATION; 188 request.index=0; 189 request.length=0; 190 request.value_high=0; 191 request.value_low = config_descriptor.configuration_number; 192 opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0); 184 opResult = usb_drv_req_set_configuration(hc, target.address, 185 config_descriptor.configuration_number); 186 193 187 if (opResult != EOK) { 194 188 dprintf(1,"[usb_hub]something went wrong when setting hub`s configuration, %d", opResult); 195 189 } 196 190 191 usb_device_request_setup_packet_t request; 197 192 for (port = 1; port < hub_info->port_count+1; ++port) { 198 193 usb_hub_set_power_port_request(&request, port); … … 229 224 230 225 231 232 226 //********************************************* 233 227 // … … 237 231 238 232 /** 239 * convenience function for releasing default address and writing debug info240 * (these few lines are used too often to be written again and again) 233 * Convenience function for releasing default address and writing debug info 234 * (these few lines are used too often to be written again and again). 241 235 * @param hc 242 236 * @return … … 253 247 254 248 /** 255 * reset the port with new device and reserve the default address249 * Reset the port with new device and reserve the default address. 256 250 * @param hc 257 251 * @param port … … 282 276 283 277 /** 284 * finalize adding new device after port reset278 * Finalize adding new device after port reset 285 279 * @param hc 286 280 * @param port … … 345 339 346 340 /** 347 * unregister device address in hc341 * Unregister device address in hc 348 342 * @param hc 349 343 * @param port … … 355 349 int opResult; 356 350 357 /// \TODO remove device 351 /** \TODO remove device from device manager - not yet implemented in 352 * devide manager 353 */ 358 354 359 355 hub->attached_devs[port].devman_handle=0; … … 376 372 377 373 /** 378 * process interrupts on given hub port374 * Process interrupts on given hub port 379 375 * @param hc 380 376 * @param port … … 434 430 usb_port_set_reset_completed(&status, false); 435 431 usb_port_set_dev_connected(&status, false); 436 if (status) { 437 dprintf(1,"[usb_hub]there was some unsupported change on port %d",port); 432 if (status>>16) { 433 dprintf(1,"[usb_hub]there was some unsupported change on port %d: %X",port,status); 434 438 435 } 439 436 /// \TODO handle other changes … … 442 439 } 443 440 444 /* Check changes on all known hubs. 441 /** 442 * Check changes on all known hubs. 445 443 */ 446 444 void usb_hub_check_hub_changes(void) { -
uspace/drv/usbhub/usbhub_private.h
r1d7a74e r192466bc 31 31 */ 32 32 /** @file 33 * @brief Hub driver .33 * @brief Hub driver private definitions 34 34 */ 35 35 … … 68 68 69 69 /** 70 * create hub structure instance70 * Create hub structure instance 71 71 * 72 72 * Set the address and port count information most importantly. … … 78 78 usb_hub_info_t * usb_create_hub_info(device_t * device, int hc); 79 79 80 /** list of hubs maanged by this driver */80 /** List of hubs maanged by this driver */ 81 81 extern usb_general_list_t usb_hub_list; 82 82 83 /** lock for hub list*/83 /** Lock for hub list*/ 84 84 extern futex_t usb_hub_list_lock; 85 85 86 86 87 87 /** 88 * perform complete control read transaction88 * Perform complete control read transaction 89 89 * 90 * manages all three steps of transaction: setup, read and finalize90 * Manages all three steps of transaction: setup, read and finalize 91 91 * @param phone 92 92 * @param target 93 * @param request request for data94 * @param rcvd_buffer received data93 * @param request Request packet 94 * @param rcvd_buffer Received data 95 95 * @param rcvd_size 96 * @param actual_size actual size of received data96 * @param actual_size Actual size of received data 97 97 * @return error code 98 98 */ … … 104 104 105 105 /** 106 * perform complete control write transaction106 * Perform complete control write transaction 107 107 * 108 * manages all three steps of transaction: setup, write and finalize108 * Manages all three steps of transaction: setup, write and finalize 109 109 * @param phone 110 110 * @param target 111 * @param request request to send data111 * @param request Request packet to send data 112 112 * @param sent_buffer 113 113 * @param sent_size … … 121 121 122 122 /** 123 * set the device request to be a get hub descriptor request.123 * Set the device request to be a get hub descriptor request. 124 124 * @warning the size is allways set to USB_HUB_MAX_DESCRIPTOR_SIZE 125 125 * @param request … … 137 137 } 138 138 139 /** 140 * Clear feature on hub port. 141 * 142 * @param hc Host controller telephone 143 * @param address Hub address 144 * @param port_index Port 145 * @param feature Feature selector 146 * @return Operation result 147 */ 139 148 static inline int usb_hub_clear_port_feature(int hc, usb_address_t address, 140 149 int port_index,
Note:
See TracChangeset
for help on using the changeset viewer.