Lines Matching refs:udev

138 usbd_get_debug_bits(struct usb_device *udev, struct usb_device_request *req,  in usbd_get_debug_bits()  argument
167 if (usbd_get_bus_index(udev) != usb_ctrl_debug.bus_index) in usbd_get_debug_bits()
170 if (usbd_get_device_index(udev) != usb_ctrl_debug.dev_index) in usbd_get_debug_bits()
214 cv_signal(&xfer->xroot->udev->ctrlreq_cv); in usbd_do_request_callback()
228 struct usb_device *udev; in usb_do_clear_stall_callback() local
235 udev = xfer->xroot->udev; in usb_do_clear_stall_callback()
237 USB_BUS_LOCK(udev->bus); in usb_do_clear_stall_callback()
241 ep = udev->ep_curr; in usb_do_clear_stall_callback()
242 ep_end = udev->endpoints + udev->endpoints_max; in usb_do_clear_stall_callback()
243 ep_first = udev->endpoints; in usb_do_clear_stall_callback()
244 to = udev->endpoints_max; in usb_do_clear_stall_callback()
250 udev->clear_stall_errors = 0; in usb_do_clear_stall_callback()
259 usbd_clear_stall_locked(udev, ep); in usb_do_clear_stall_callback()
292 USB_BUS_UNLOCK(udev->bus); in usb_do_clear_stall_callback()
296 USB_BUS_LOCK(udev->bus); in usb_do_clear_stall_callback()
325 if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) in usb_do_clear_stall_callback()
329 udev->clear_stall_errors = USB_CS_RESET_LIMIT; in usb_do_clear_stall_callback()
331 usbd_start_re_enumerate(udev); in usb_do_clear_stall_callback()
333 udev->clear_stall_errors++; in usb_do_clear_stall_callback()
334 if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) { in usb_do_clear_stall_callback()
336 usbd_start_re_enumerate(udev); in usb_do_clear_stall_callback()
343 udev->ep_curr = ep; in usb_do_clear_stall_callback()
344 USB_BUS_UNLOCK(udev->bus); in usb_do_clear_stall_callback()
348 usbd_get_hr_func(struct usb_device *udev) in usbd_get_hr_func() argument
351 if (udev->flags.usb_mode == USB_MODE_DEVICE) in usbd_get_hr_func()
353 else if (udev->parent_hub == NULL) in usbd_get_hr_func()
354 return (udev->bus->methods->roothub_exec); in usbd_get_hr_func()
414 usbd_do_request_flags(struct usb_device *udev, struct mtx *mtx, in usbd_do_request_flags() argument
445 udev, req->bmRequestType, req->bRequest, in usbd_do_request_flags()
451 if (udev->state < USB_STATE_POWERED) { in usbd_do_request_flags()
475 do_unlock = usbd_ctrl_lock(udev); in usbd_do_request_flags()
477 hr_func = usbd_get_hr_func(udev); in usbd_do_request_flags()
496 USB_BUS_LOCK(udev->bus); in usbd_do_request_flags()
497 err = (hr_func) (udev, req, &desc, &temp); in usbd_do_request_flags()
498 USB_BUS_UNLOCK(udev->bus); in usbd_do_request_flags()
530 usbd_ctrl_transfer_setup(udev); in usbd_do_request_flags()
532 xfer = udev->ctrl_xfer[0]; in usbd_do_request_flags()
541 usbd_get_debug_bits(udev, req, &dbg); in usbd_do_request_flags()
641 cv_wait(&udev->ctrlreq_cv, in usbd_do_request_flags()
720 usbd_ctrl_unlock(udev); in usbd_do_request_flags()
751 usbd_do_request_proc(struct usb_device *udev, struct usb_process *pproc, in usbd_do_request_proc() argument
768 err = usbd_do_request_flags(udev, pproc->up_mtx, in usbd_do_request_proc()
795 usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port) in usbd_req_reset_port() argument
807 udev, mtx, port, UHF_C_PORT_RESET); in usbd_req_reset_port()
811 udev, mtx, port, UHF_PORT_RESET); in usbd_req_reset_port()
821 err = usbd_req_get_port_status(udev, mtx, &ps, port); in usbd_req_reset_port()
853 udev, mtx, port, UHF_C_PORT_RESET); in usbd_req_reset_port()
885 usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, in usbd_req_warm_reset_port() argument
896 err = usbd_req_get_port_status(udev, mtx, &ps, port); in usbd_req_warm_reset_port()
914 usbd_req_clear_port_feature(udev, mtx, in usbd_req_warm_reset_port()
918 err = usbd_req_set_port_feature(udev, mtx, in usbd_req_warm_reset_port()
928 err = usbd_req_get_port_status(udev, mtx, &ps, port); in usbd_req_warm_reset_port()
952 udev, mtx, port, UHF_C_BH_PORT_RESET); in usbd_req_warm_reset_port()
995 usbd_req_get_desc(struct usb_device *udev, in usbd_req_get_desc() argument
1020 err = usbd_do_request_flags(udev, mtx, &req, in usbd_req_get_desc()
1031 err = usbd_do_request_flags(udev, mtx, &req, in usbd_req_get_desc()
1109 usbd_req_get_string_any(struct usb_device *udev, struct mtx *mtx, char *buf, in usbd_req_get_string_any() argument
1129 if (udev->flags.no_strings) { in usbd_req_get_string_any()
1134 (udev, mtx, buf, len, udev->langid, string_index); in usbd_req_get_string_any()
1215 usbd_req_get_string_desc(struct usb_device *udev, struct mtx *mtx, void *sdesc, in usbd_req_get_string_desc() argument
1219 return (usbd_req_get_desc(udev, mtx, NULL, sdesc, 2, max_len, lang_id, in usbd_req_get_string_desc()
1235 usbd_req_get_descriptor_ptr(struct usb_device *udev, in usbd_req_get_descriptor_ptr() argument
1253 hr_func = usbd_get_hr_func(udev); in usbd_req_get_descriptor_ptr()
1258 USB_BUS_LOCK(udev->bus); in usbd_req_get_descriptor_ptr()
1259 err = (hr_func) (udev, &req, &ptr, &len); in usbd_req_get_descriptor_ptr()
1260 USB_BUS_UNLOCK(udev->bus); in usbd_req_get_descriptor_ptr()
1281 usbd_req_get_config_desc(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_config_desc() argument
1288 err = usbd_req_get_desc(udev, mtx, NULL, d, sizeof(*d), in usbd_req_get_config_desc()
1312 usbd_alloc_config_desc(struct usb_device *udev, uint32_t size) in usbd_alloc_config_desc() argument
1321 memset(udev->config_data, 0, sizeof(udev->config_data)); in usbd_alloc_config_desc()
1322 return (udev->config_data); in usbd_alloc_config_desc()
1332 usbd_free_config_desc(struct usb_device *udev, void *ptr) in usbd_free_config_desc() argument
1351 usbd_req_get_config_desc_full(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_config_desc_full() argument
1363 err = usbd_req_get_config_desc(udev, mtx, &cd, index); in usbd_req_get_config_desc_full()
1376 cdesc = usbd_alloc_config_desc(udev, len); in usbd_req_get_config_desc_full()
1379 err = usbd_req_get_desc(udev, mtx, NULL, cdesc, len, len, 0, in usbd_req_get_config_desc_full()
1382 usbd_free_config_desc(udev, cdesc); in usbd_req_get_config_desc_full()
1401 usbd_req_get_device_desc(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_device_desc() argument
1405 return (usbd_req_get_desc(udev, mtx, NULL, d, sizeof(*d), in usbd_req_get_device_desc()
1417 usbd_req_get_alt_interface_no(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_alt_interface_no() argument
1420 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_get_alt_interface_no()
1432 return (usbd_do_request(udev, mtx, &req, alt_iface_no)); in usbd_req_get_alt_interface_no()
1443 usbd_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_alt_interface_no() argument
1446 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_set_alt_interface_no()
1460 err = usbd_do_request(udev, mtx, &req, 0); in usbd_req_set_alt_interface_no()
1481 usbd_req_get_device_status(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_device_status() argument
1491 return (usbd_do_request(udev, mtx, &req, st)); in usbd_req_get_device_status()
1502 usbd_req_get_hub_descriptor(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_hub_descriptor() argument
1513 return (usbd_do_request(udev, mtx, &req, hd)); in usbd_req_get_hub_descriptor()
1524 usbd_req_get_ss_hub_descriptor(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_ss_hub_descriptor() argument
1535 return (usbd_do_request(udev, mtx, &req, hd)); in usbd_req_get_ss_hub_descriptor()
1546 usbd_req_get_hub_status(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_hub_status() argument
1556 return (usbd_do_request(udev, mtx, &req, st)); in usbd_req_get_hub_status()
1570 usbd_req_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t addr) in usbd_req_set_address() argument
1586 if (udev->bus->methods->set_address != NULL) in usbd_req_set_address()
1587 err = (udev->bus->methods->set_address) (udev, mtx, addr); in usbd_req_set_address()
1593 err = usbd_do_request_flags(udev, mtx, &req, NULL, in usbd_req_set_address()
1612 usbd_req_get_port_status(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_port_status() argument
1624 return (usbd_do_request_flags(udev, mtx, &req, ps, 0, NULL, 1000)); in usbd_req_get_port_status()
1635 usbd_req_clear_hub_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_clear_hub_feature() argument
1645 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_clear_hub_feature()
1656 usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_hub_feature() argument
1666 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_hub_feature()
1677 usbd_req_set_hub_u1_timeout(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_hub_u1_timeout() argument
1688 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_hub_u1_timeout()
1699 usbd_req_set_hub_u2_timeout(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_hub_u2_timeout() argument
1710 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_hub_u2_timeout()
1721 usbd_req_set_hub_depth(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_hub_depth() argument
1731 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_hub_depth()
1742 usbd_req_clear_port_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_clear_port_feature() argument
1753 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_clear_port_feature()
1764 usbd_req_set_port_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_port_feature() argument
1775 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_port_feature()
1786 usbd_req_set_protocol(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_protocol() argument
1789 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_set_protocol()
1804 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_protocol()
1815 usbd_req_set_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, in usbd_req_set_report() argument
1818 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_set_report()
1832 return (usbd_do_request(udev, mtx, &req, data)); in usbd_req_set_report()
1843 usbd_req_get_report(struct usb_device *udev, struct mtx *mtx, void *data, in usbd_req_get_report() argument
1846 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_get_report()
1860 return (usbd_do_request(udev, mtx, &req, data)); in usbd_req_get_report()
1871 usbd_req_set_idle(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_idle() argument
1874 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_set_idle()
1888 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_idle()
1899 usbd_req_get_report_descriptor(struct usb_device *udev, struct mtx *mtx, in usbd_req_get_report_descriptor() argument
1902 struct usb_interface *iface = usbd_get_iface(udev, iface_index); in usbd_req_get_report_descriptor()
1914 return (usbd_do_request(udev, mtx, &req, d)); in usbd_req_get_report_descriptor()
1929 usbd_req_set_config(struct usb_device *udev, struct mtx *mtx, uint8_t conf) in usbd_req_set_config() argument
1943 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_config()
1954 usbd_req_get_config(struct usb_device *udev, struct mtx *mtx, uint8_t *pconf) in usbd_req_get_config() argument
1963 return (usbd_do_request(udev, mtx, &req, pconf)); in usbd_req_get_config()
1970 usbd_setup_device_desc(struct usb_device *udev, struct mtx *mtx) in usbd_setup_device_desc() argument
1984 switch (udev->speed) { in usbd_setup_device_desc()
1988 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
1994 err = usbd_req_get_desc(udev, mtx, NULL, &udev->ddesc, in usbd_setup_device_desc()
1999 udev->ddesc.bMaxPacketSize = 8; in usbd_setup_device_desc()
2001 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
2005 udev->ddesc.bMaxPacketSize = 16; in usbd_setup_device_desc()
2007 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
2011 udev->ddesc.bMaxPacketSize = 32; in usbd_setup_device_desc()
2014 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
2023 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
2027 err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); in usbd_setup_device_desc()
2033 "at addr %d failed, %s\n", udev->address, in usbd_setup_device_desc()
2040 udev->address, UGETW(udev->ddesc.bcdUSB), in usbd_setup_device_desc()
2041 udev->ddesc.bDeviceClass, in usbd_setup_device_desc()
2042 udev->ddesc.bDeviceSubClass, in usbd_setup_device_desc()
2043 udev->ddesc.bDeviceProtocol, in usbd_setup_device_desc()
2044 udev->ddesc.bMaxPacketSize, in usbd_setup_device_desc()
2045 udev->ddesc.bLength, in usbd_setup_device_desc()
2046 udev->speed); in usbd_setup_device_desc()
2063 usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx) in usbd_req_re_enumerate() argument
2070 if (udev->flags.usb_mode != USB_MODE_HOST) { in usbd_req_re_enumerate()
2073 old_addr = udev->address; in usbd_req_re_enumerate()
2074 parent_hub = udev->parent_hub; in usbd_req_re_enumerate()
2084 if (udev->parent_hs_hub != NULL && in usbd_req_re_enumerate()
2085 udev->speed != USB_SPEED_HIGH) { in usbd_req_re_enumerate()
2087 if (udev->parent_hs_hub == parent_hub && in usbd_req_re_enumerate()
2092 udev->hs_port_no); in usbd_req_re_enumerate()
2095 err = usbd_req_clear_tt_buffer(udev->parent_hs_hub, NULL, in usbd_req_re_enumerate()
2096 udev->hs_port_no, old_addr, UE_CONTROL, 0); in usbd_req_re_enumerate()
2107 usbd_req_warm_reset_port(parent_hub, mtx, udev->port_no); in usbd_req_re_enumerate()
2110 err = usbd_req_reset_port(parent_hub, mtx, udev->port_no); in usbd_req_re_enumerate()
2121 udev->address = USB_START_ADDR; in usbd_req_re_enumerate()
2124 udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET; in usbd_req_re_enumerate()
2127 usb_set_device_state(udev, USB_STATE_POWERED); in usbd_req_re_enumerate()
2132 err = usbd_req_set_address(udev, mtx, old_addr); in usbd_req_re_enumerate()
2142 if (udev->address == USB_START_ADDR) in usbd_req_re_enumerate()
2143 udev->address = old_addr; in usbd_req_re_enumerate()
2146 err = usbd_setup_device_desc(udev, mtx); in usbd_req_re_enumerate()
2158 if (udev->address == USB_START_ADDR) in usbd_req_re_enumerate()
2159 udev->address = old_addr; in usbd_req_re_enumerate()
2162 usb_set_device_state(udev, USB_STATE_ADDRESSED); in usbd_req_re_enumerate()
2174 usbd_req_clear_device_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_clear_device_feature() argument
2184 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_clear_device_feature()
2195 usbd_req_set_device_feature(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_device_feature() argument
2205 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_device_feature()
2216 usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx, in usbd_req_reset_tt() argument
2223 if (udev->ddesc.bDeviceClass == UDCLASS_HUB && in usbd_req_reset_tt()
2224 udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) in usbd_req_reset_tt()
2233 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_reset_tt()
2246 usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, in usbd_req_clear_tt_buffer() argument
2254 if (udev->ddesc.bDeviceClass == UDCLASS_HUB && in usbd_req_clear_tt_buffer()
2255 udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) in usbd_req_clear_tt_buffer()
2267 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_clear_tt_buffer()
2280 usbd_req_set_port_link_state(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_port_link_state() argument
2291 return (usbd_do_request(udev, mtx, &req, 0)); in usbd_req_set_port_link_state()
2307 usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, in usbd_req_set_lpm_info() argument
2324 err = usbd_do_request(udev, mtx, &req, buf); in usbd_req_set_lpm_info()