From: Stefan Seyfried Date: Tue, 8 Dec 2009 14:21:35 +0000 (+0100) Subject: zd1211rw: improve ejecting of fake CDROM X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=11466f1342a3400dd5e03da3d8c45aa4149c62d4;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git zd1211rw: improve ejecting of fake CDROM The zd1211rw always assumed that the storage device is at endpoint 1, but there are devices (Spairon Homelink 1202) that are at endpoint 0. Try both, starting with 1 to make sure to not break existing setups. Signed-off-by: Stefan Seyfried Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index ac19ecd19cfe..4daf1c94ec04 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c @@ -1078,11 +1078,15 @@ static int eject_installer(struct usb_interface *intf) int r; /* Find bulk out endpoint */ - endpoint = &iface_desc->endpoint[1].desc; - if (usb_endpoint_dir_out(endpoint) && - usb_endpoint_xfer_bulk(endpoint)) { - bulk_out_ep = endpoint->bEndpointAddress; - } else { + for (r = 1; r >= 0; r--) { + endpoint = &iface_desc->endpoint[r].desc; + if (usb_endpoint_dir_out(endpoint) && + usb_endpoint_xfer_bulk(endpoint)) { + bulk_out_ep = endpoint->bEndpointAddress; + break; + } + } + if (r == -1) { dev_err(&udev->dev, "zd1211rw: Could not find bulk out endpoint\n"); return -ENODEV;