Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1674506

[PATCH 1/3] usb: gadget: f_uac1: Fix endpoint reading

From Julian Scheel <julian@jusst.de>
Newsgroups linux.kernel
Subject [PATCH 1/3] usb: gadget: f_uac1: Fix endpoint reading
Date 2017-06-26 09:40 +0200
Message-ID <tWwMP-7Pq-33@gated-at.bofh.it> (permalink)
References <tWwMO-7Pq-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The endpoint is stored in the lower byte of wIndex, according to USB
Audio 1.0 specification, section 5.2.1.1.

Signed-off-by: Julian Scheel <julian@jusst.de>
---
 drivers/usb/gadget/function/f_uac1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 8656f84e17d9..b955913bd7ea 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -327,7 +327,7 @@ static int audio_set_endpoint_req(struct usb_function *f,
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	int			value = -EOPNOTSUPP;
-	u16			ep = le16_to_cpu(ctrl->wIndex);
+	u8			ep = le16_to_cpu(ctrl->wIndex) & 0xff;
 	u16			len = le16_to_cpu(ctrl->wLength);
 	u16			w_value = le16_to_cpu(ctrl->wValue);
 
@@ -363,7 +363,7 @@ static int audio_get_endpoint_req(struct usb_function *f,
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	int value = -EOPNOTSUPP;
-	u8 ep = ((le16_to_cpu(ctrl->wIndex) >> 8) & 0xFF);
+	u8 ep = le16_to_cpu(ctrl->wIndex) & 0xff;
 	u16 len = le16_to_cpu(ctrl->wLength);
 	u16 w_value = le16_to_cpu(ctrl->wValue);
 
-- 
2.13.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] USB Audio Gadget: Support multiple sampling rates Julian Scheel <julian@jusst.de> - 2017-06-26 09:40 +0200
  [PATCH 1/3] usb: gadget: f_uac1: Fix endpoint reading Julian Scheel <julian@jusst.de> - 2017-06-26 09:40 +0200
  [PATCH 2/3] usb: gadget: f_uac*: Reduce code duplication Julian Scheel <julian@jusst.de> - 2017-06-26 09:40 +0200

csiph-web