Lines Matching refs:pUdev
152 struct usb_device *pUdev; in ms_usb_match_id() local
158 pUdev = interface_to_usbdev(pUintf); in ms_usb_match_id()
164 pDevId->idVendor != pUdev->descriptor.idVendor) in ms_usb_match_id()
168 pDevId->idProduct != pUdev->descriptor.idProduct) in ms_usb_match_id()
172 (pDevId->bcdDevice_lo >= pUdev->descriptor.bcdDevice)) in ms_usb_match_id()
176 (pDevId->bcdDevice_hi <= pUdev->descriptor.bcdDevice)) in ms_usb_match_id()
180 (pDevId->bDeviceClass != pUdev->descriptor.bDeviceClass)) in ms_usb_match_id()
184 (pDevId->bDeviceSubClass!= pUdev->descriptor.bDeviceSubClass)) in ms_usb_match_id()
188 (pDevId->bDeviceProtocol != pUdev->descriptor.bDeviceProtocol)) in ms_usb_match_id()
292 struct usb_interface *ms_usb_ifnum_to_if(struct usb_device *pUdev, int ifnum) in ms_usb_ifnum_to_if() argument
296 for (i = 0; i < pUdev->actconfig->desc.bNumInterfaces; i++) in ms_usb_ifnum_to_if()
297 if (pUdev->actconfig->interface[i]->altsetting[0] in ms_usb_ifnum_to_if()
299 return pUdev->actconfig->interface[i]; in ms_usb_ifnum_to_if()
382 struct usb_device *pUdev; in ms_usb_release_dev() local
385 pUdev = ms_to_usb_device(pDev); in ms_usb_release_dev()
389 if ((retv = ms_hcd_free_dev(pUdev)) != ENOERR) { in ms_usb_release_dev()
392 ms_usb_destroy_config(pUdev); in ms_usb_release_dev()
393 kfree (pUdev); in ms_usb_release_dev()
398 struct usb_device *pUdev; in ms_usb_alloc_dev() local
401 pUdev = (struct usb_device*) kmalloc(sizeof(*pUdev), GFP_KERNEL); in ms_usb_alloc_dev()
402 if (!pUdev) in ms_usb_alloc_dev()
405 memset(pUdev, 0, sizeof(*pUdev)); in ms_usb_alloc_dev()
407 ms_device_initialize(&pUdev->dev); in ms_usb_alloc_dev()
408 pUdev->dev.release_func = ms_usb_release_dev; in ms_usb_alloc_dev()
410 pUdev->eState = USB_STATE_ATTACHED; in ms_usb_alloc_dev()
413 pUdev->devpath [0] = '0'; in ms_usb_alloc_dev()
414 pUdev->bus = bus; in ms_usb_alloc_dev()
415 pUdev->parent = parent; in ms_usb_alloc_dev()
419 if ((retv = ms_hcd_alloc_dev(pUdev)) != ENOERR) { in ms_usb_alloc_dev()
423 return pUdev; in ms_usb_alloc_dev()
426 struct usb_device *ms_usb_get_dev (struct usb_device *pUdev) in ms_usb_get_dev() argument
430 if (!pUdev) in ms_usb_get_dev()
433 pDev_t = ms_get_device(&pUdev->dev); in ms_usb_get_dev()
440 void ms_usb_put_dev(struct usb_device *pUdev) in ms_usb_put_dev() argument
442 if (pUdev) in ms_usb_put_dev()
444 if (osapi_atomic_dec_and_test(&((&pUdev->dev)->dev_refcnt))) in ms_usb_put_dev()
447 ms_device_unregister(&pUdev->dev); in ms_usb_put_dev()
454 struct usb_device *pUdev = *pdev; in ms_usb_disconnect() local
457 struct usb_hcd *pHcd = (struct usb_hcd*) pUdev->bus->hcpriv; in ms_usb_disconnect()
459 if (!pUdev) in ms_usb_disconnect()
474 ms_usb_set_device_state(pUdev, USB_STATE_NOTATTACHED); // patch from Linux 2.6.28 in ms_usb_disconnect()
476 ms_usbhost_msg ("USB disconnect, address %d\n", pUdev->u32DevNum); in ms_usb_disconnect()
477 if (pUdev->parent) in ms_usb_disconnect()
478 devnum = pUdev->parent->u32DevNum; in ms_usb_disconnect()
493 struct usb_device **child = pUdev->children + i; in ms_usb_disconnect()
516 ms_usb_disable_device(pUdev, 0); in ms_usb_disconnect()
523 ms_device_unregister(&pUdev->dev); in ms_usb_disconnect()
526 if (pUdev->u32DevNum > 0) in ms_usb_disconnect()
529 ms_devmap_clear_bit(pUdev->u32DevNum, pUdev->bus->devmap.usb_devicemap); in ms_usb_disconnect()
530 pUdev->u32DevNum = -1; in ms_usb_disconnect()
545 void ms_usb_choose_address(struct usb_device *pUdev) in ms_usb_choose_address() argument
550 s32Devnum = find_next_zero_bit(pUdev->bus->devmap.usb_devicemap, 128, pUdev->bus->devnum_next); in ms_usb_choose_address()
552 s32Devnum = find_next_zero_bit(pUdev->bus->devmap.usb_devicemap, 128, 1); in ms_usb_choose_address()
554 pUdev->bus->devnum_next = ( s32Devnum >= 127 ? 1 : s32Devnum + 1); in ms_usb_choose_address()
559 ms_devmap_set_bit(s32Devnum, pUdev->bus->devmap.usb_devicemap); in ms_usb_choose_address()
560 pUdev->u32DevNum = s32Devnum; in ms_usb_choose_address()
564 int ms_usb_set_address(struct usb_device *pUdev) in ms_usb_set_address() argument
568 if (pUdev->u32DevNum == 0) in ms_usb_set_address()
570 if ((pUdev->eState != USB_STATE_DEFAULT) && (pUdev->eState != USB_STATE_ADDRESS)) in ms_usb_set_address()
573 s32Retval = ms_usb_control_cmd(pUdev, usb_snddefctrl(pUdev), USB_REQ_SET_ADDRESS, in ms_usb_set_address()
574 0, pUdev->u32DevNum, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT); in ms_usb_set_address()
578 ms_usb_set_device_state(pUdev, USB_STATE_ADDRESS); in ms_usb_set_address()
589 int ms_usb_new_device(struct usb_device *pUdev, struct device_s *parent) in ms_usb_new_device() argument
599 pUdev->dev.parent = parent; in ms_usb_new_device()
600 pUdev->dev.driver = &ms_usb_generic_driver; in ms_usb_new_device()
601 pUdev->dev.bus_type = &usb_bus_type; in ms_usb_new_device()
602 pUdev->dev.driver_data = &usb_generic_driver_data; in ms_usb_new_device()
603 strcpy(pUdev->dev.dev_name,"usbdev"); in ms_usb_new_device()
605 ms_usb_get_dev(pUdev); in ms_usb_new_device()
607 if (pUdev->dev.bus_id[0] == 0) in ms_usb_new_device()
608 USB_sprintf(&pUdev->dev.bus_id[0], "%d-%s", (int)pUdev->bus->busnum, pUdev->devpath); in ms_usb_new_device()
609 pUdev->dev.dma_mask = parent->dma_mask; in ms_usb_new_device()
611 switch (pUdev->eSpeed) in ms_usb_new_device()
626 pUdev->pEpMaxPacketIn [0] = i; in ms_usb_new_device()
627 pUdev->pEpMaxPacketOut[0] = i; in ms_usb_new_device()
634 s32Err = ms_usb_set_address(pUdev); in ms_usb_new_device()
639 pUdev->eState == 3 ? "default" : in ms_usb_new_device()
640 pUdev->eState == 4 ? "address": "unknown", i, j); in ms_usb_new_device()
655 … ms_usbhost_err("device not accepting address %d, error %d\n", (int)pUdev->u32DevNum, s32Err); in ms_usb_new_device()
660 s32Err = ms_usb_get_descriptor(pUdev, USB_DT_DEVICE, 0, &pUdev->descriptor, 8); in ms_usb_new_device()
672 if (pUdev->eSpeed == USB_FULL_SPEED) in ms_usb_new_device()
674 pUdev->pEpMaxPacketIn [0] = pUdev->descriptor.bMaxPacketSize0; in ms_usb_new_device()
675 pUdev->pEpMaxPacketOut[0] = pUdev->descriptor.bMaxPacketSize0; in ms_usb_new_device()
676 u8MaxPacketSize = pUdev->descriptor.bMaxPacketSize0; in ms_usb_new_device()
679 s32Err = ms_usb_get_dev_descriptor(pUdev); in ms_usb_new_device()
680 if (s32Err < (signed)sizeof(pUdev->descriptor)) in ms_usb_new_device()
687 if (pUdev->parent) // not root hub in ms_usb_new_device()
688 …diag_printf("usb new device VID = %4x, PID = %4x\n", pUdev->descriptor.idVendor, pUdev->descriptor… in ms_usb_new_device()
691 if (pUdev->parent ) // not root hub in ms_usb_new_device()
696 if (ms_usb_test_proc_vid(pUdev->descriptor.idVendor, pUdev->descriptor.idProduct) == 1) in ms_usb_new_device()
697 ms_usb_high_speed_test_proc(pUdev, 1); in ms_usb_new_device()
701 s32Err = ms_usb_get_config(pUdev); in ms_usb_new_device()
705 (int)pUdev->u32DevNum, s32Err); in ms_usb_new_device()
709 if (pUdev->descriptor.bNumConfigurations != 1) in ms_usb_new_device()
712 pUdev->config[0].desc.bConfigurationValue, in ms_usb_new_device()
713 pUdev->descriptor.bNumConfigurations); in ms_usb_new_device()
716 if (pUdev->descriptor.iManufacturer) in ms_usb_new_device()
720 … retv = ms_usb_string(pUdev, pUdev->descriptor.iManufacturer, usb_manufacturer_string_buf, 64); in ms_usb_new_device()
722 pUdev->pManufacturerString = usb_manufacturer_string_buf; in ms_usb_new_device()
724 pUdev->pManufacturerString = NULL; in ms_usb_new_device()
727 pUdev->pManufacturerString = NULL; in ms_usb_new_device()
728 if (pUdev->pManufacturerString) in ms_usb_new_device()
729 …_msg("USB device manufacturer string (index %d) = %s\n", pUdev->descriptor.iManufacturer, pUdev->p… in ms_usb_new_device()
730 if (pUdev->descriptor.iProduct) in ms_usb_new_device()
734 retv = ms_usb_string(pUdev, pUdev->descriptor.iProduct, usb_product_string_buf, 64); in ms_usb_new_device()
736 pUdev->pProductString = usb_product_string_buf; in ms_usb_new_device()
738 pUdev->pProductString = NULL; in ms_usb_new_device()
741 pUdev->pProductString = NULL; in ms_usb_new_device()
742 if (pUdev->pProductString) in ms_usb_new_device()
743 …_usbhost_msg("USB device product string (index %d) = %s\n", pUdev->descriptor.iProduct, pUdev->pPr… in ms_usb_new_device()
744 if (pUdev->descriptor.iSerialNumber) in ms_usb_new_device()
748 … retv = ms_usb_string(pUdev, pUdev->descriptor.iSerialNumber, usb_serialnumber_string_buf, 64); in ms_usb_new_device()
750 pUdev->pSerialNumberString = usb_serialnumber_string_buf; in ms_usb_new_device()
752 pUdev->pSerialNumberString = NULL; in ms_usb_new_device()
755 pUdev->pSerialNumberString = NULL; in ms_usb_new_device()
756 if (pUdev->pSerialNumberString) in ms_usb_new_device()
757 …msg("USB device serial number string (index %d) = %s\n", pUdev->descriptor.iSerialNumber, pUdev->p… in ms_usb_new_device()
762 s32Err = ms_usb_set_config(pUdev, pUdev->config[0].desc.bConfigurationValue); in ms_usb_new_device()
767 (int)pUdev->u32DevNum, s32Err); in ms_usb_new_device()
772 if (pUdev->parent ) // not root hub in ms_usb_new_device()
774 if (ms_usb_test_proc_vid(pUdev->descriptor.idVendor, pUdev->descriptor.idProduct) == 2) in ms_usb_new_device()
775 ms_usb_high_speed_test_proc(pUdev, 2); in ms_usb_new_device()
779 s32Err = ms_device_add (&pUdev->dev); in ms_usb_new_device()
783 for (i = 0; i < pUdev->actconfig->desc.bNumInterfaces; i++) in ms_usb_new_device()
785 struct usb_interface *iface = pUdev->actconfig->interface[i]; in ms_usb_new_device()
789 iface->dev.parent = &pUdev->dev; in ms_usb_new_device()
796 (int)pUdev->bus->busnum, pUdev->devpath, in ms_usb_new_device()
798 …ms_usbhost_msg("%s %s - registering interface %s\n", pUdev->dev.dev_name, pUdev->dev.bus_id, iface… in ms_usb_new_device()
805 ms_usb_set_device_state(pUdev, USB_STATE_NOTATTACHED); // patch from Linux 3.1.10 in ms_usb_new_device()
807 ms_devmap_clear_bit(pUdev->u32DevNum, pUdev->bus->devmap.usb_devicemap); in ms_usb_new_device()
808 pUdev->u32DevNum = -1; in ms_usb_new_device()
809 ms_usb_put_dev(pUdev); in ms_usb_new_device()
814 struct usb_device *pUdev, in ms_usb_buffer_alloc() argument
820 …if (!pUdev || !pUdev->bus /*|| !pUdev->bus->bus_ops || !pUdev->bus->bus_ops->ms_alloc_hcd_buffer*/) in ms_usb_buffer_alloc()
823 return ms_hcd_buffer_alloc(pUdev->bus, size, mem_flags, dma); in ms_usb_buffer_alloc()
827 struct usb_device *pUdev, in ms_usb_buffer_free() argument
833 if (!pUdev || !pUdev->bus /*|| !pUdev->bus->bus_ops || !pUdev->bus->bus_ops->ms_free_hcd_buffer*/) in ms_usb_buffer_free()
838 ms_hcd_buffer_free(pUdev->bus, size, addr, dma); in ms_usb_buffer_free()