View | Details | Raw Unified | Return to bug 251856
Collapse All | Expand All

(-)b/sys/compat/linuxkpi/common/src/linux_usb.c (-5 lines)
Lines 931-947 usb_linux_create_usb_device(struct usb_device *udev, device_t dev) Link Here
931
					if (p_ui) {
931
					if (p_ui) {
932
						p_ui->altsetting = p_uhi - 1;
932
						p_ui->altsetting = p_uhi - 1;
933
						p_ui->cur_altsetting = p_uhi - 1;
933
						p_ui->cur_altsetting = p_uhi - 1;
934
						p_ui->num_altsetting = 1;
935
						p_ui->bsd_iface_index = iface_index;
934
						p_ui->bsd_iface_index = iface_index;
936
						p_ui->linux_udev = udev;
935
						p_ui->linux_udev = udev;
937
						p_ui++;
936
						p_ui++;
938
					}
937
					}
939
					iface_no_curr = iface_no;
938
					iface_no_curr = iface_no;
940
					iface_index++;
939
					iface_index++;
941
				} else {
942
					if (p_ui) {
943
						(p_ui - 1)->num_altsetting++;
944
					}
945
				}
940
				}
946
				break;
941
				break;
947
942
(-)b/sys/dev/usb/usb_device.c (+7 lines)
Lines 826-839 usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd) Link Here
826
	uint8_t temp;
826
	uint8_t temp;
827
	uint8_t do_init;
827
	uint8_t do_init;
828
	uint8_t alt_index;
828
	uint8_t alt_index;
829
	uint8_t update_alt_num;
829
830
830
	if (iface_index != USB_IFACE_INDEX_ANY) {
831
	if (iface_index != USB_IFACE_INDEX_ANY) {
831
		/* parameter overload */
832
		/* parameter overload */
832
		alt_index = cmd;
833
		alt_index = cmd;
833
		cmd = USB_CFG_INIT;
834
		cmd = USB_CFG_INIT;
835
		update_alt_num = 0;
834
	} else {
836
	} else {
835
		/* not used */
837
		/* not used */
836
		alt_index = 0;
838
		alt_index = 0;
839
		if (cmd == USB_CFG_INIT)
840
			update_alt_num = 1;
837
	}
841
	}
838
842
839
	err = 0;
843
	err = 0;
Lines 918-923 usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd) Link Here
918
			}
922
			}
919
		}
923
		}
920
924
925
		if ((cmd == USB_CFG_INIT) && update_alt_num) {
926
			iface->num_altsetting++;
927
		}
921
		DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints);
928
		DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints);
922
929
923
		ed = (struct usb_endpoint_descriptor *)id;
930
		ed = (struct usb_endpoint_descriptor *)id;
(-)b/sys/dev/usb/usb_request.c (-1 / +11 lines)
Lines 1436-1441 usbd_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx, Link Here
1436
{
1436
{
1437
	struct usb_interface *iface = usbd_get_iface(udev, iface_index);
1437
	struct usb_interface *iface = usbd_get_iface(udev, iface_index);
1438
	struct usb_device_request req;
1438
	struct usb_device_request req;
1439
	usb_error_t err;
1439
1440
1440
	if ((iface == NULL) || (iface->idesc == NULL))
1441
	if ((iface == NULL) || (iface->idesc == NULL))
1441
		return (USB_ERR_INVAL);
1442
		return (USB_ERR_INVAL);
Lines 1447-1453 usbd_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx, Link Here
1447
	req.wIndex[0] = iface->idesc->bInterfaceNumber;
1448
	req.wIndex[0] = iface->idesc->bInterfaceNumber;
1448
	req.wIndex[1] = 0;
1449
	req.wIndex[1] = 0;
1449
	USETW(req.wLength, 0);
1450
	USETW(req.wLength, 0);
1450
	return (usbd_do_request(udev, mtx, &req, 0));
1451
	err = usbd_do_request(udev, mtx, &req, 0);
1452
	if ((err == USB_ERR_STALLED) && (iface->num_altsetting <= 1)) {
1453
		/* USB spec 9.4.10 says devices don't need this and are free to STALL the
1454
		 * request if the interface only has one alternate setting.
1455
		 */
1456
		err = 0;
1457
		DPRINTF("iface %p, %d, %d\n",
1458
		      iface, err, iface->num_altsetting);
1459
	}
1460
	return (err);
1451
}
1461
}
1452
1462
1453
/*------------------------------------------------------------------------*
1463
/*------------------------------------------------------------------------*

Return to bug 251856