ANDROID: usb: gadget: f_accessory: assign no-op request complete callbacks
The req->complete seems to presist the callback pointer for the control requests. This causes the serial of the accessory to be overridden when an accessory function specific out control request is issued right after the ACCESSORY_SEND_STRING control request. Therefore, assign a no-op req complete function when nothing needs to be done once the request is completed. Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com> Bug: 63867169 Change-Id: I78c1602e9a044b8718b270b8a068cf5afc83f984
This commit is contained in:
parent
f7adc63862
commit
73e51ffa0f
1 changed files with 13 additions and 1 deletions
|
@ -804,6 +804,14 @@ static struct hid_driver acc_hid_driver = {
|
|||
.probe = acc_hid_probe,
|
||||
};
|
||||
|
||||
static void acc_complete_setup_noop(struct usb_ep *ep, struct usb_request *req)
|
||||
{
|
||||
/*
|
||||
* Default no-op function when nothing needs to be done for the
|
||||
* setup request
|
||||
*/
|
||||
}
|
||||
|
||||
int acc_ctrlrequest(struct usb_composite_dev *cdev,
|
||||
const struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
|
@ -831,6 +839,7 @@ int acc_ctrlrequest(struct usb_composite_dev *cdev,
|
|||
schedule_delayed_work(
|
||||
&dev->start_work, msecs_to_jiffies(10));
|
||||
value = 0;
|
||||
cdev->req->complete = acc_complete_setup_noop;
|
||||
} else if (b_request == ACCESSORY_SEND_STRING) {
|
||||
dev->string_index = w_index;
|
||||
cdev->gadget->ep0->driver_data = dev;
|
||||
|
@ -839,10 +848,13 @@ int acc_ctrlrequest(struct usb_composite_dev *cdev,
|
|||
} else if (b_request == ACCESSORY_SET_AUDIO_MODE &&
|
||||
w_index == 0 && w_length == 0) {
|
||||
dev->audio_mode = w_value;
|
||||
cdev->req->complete = acc_complete_setup_noop;
|
||||
value = 0;
|
||||
} else if (b_request == ACCESSORY_REGISTER_HID) {
|
||||
cdev->req->complete = acc_complete_setup_noop;
|
||||
value = acc_register_hid(dev, w_value, w_index);
|
||||
} else if (b_request == ACCESSORY_UNREGISTER_HID) {
|
||||
cdev->req->complete = acc_complete_setup_noop;
|
||||
value = acc_unregister_hid(dev, w_value);
|
||||
} else if (b_request == ACCESSORY_SET_HID_REPORT_DESC) {
|
||||
spin_lock_irqsave(&dev->lock, flags);
|
||||
|
@ -877,7 +889,7 @@ int acc_ctrlrequest(struct usb_composite_dev *cdev,
|
|||
if (b_request == ACCESSORY_GET_PROTOCOL) {
|
||||
*((u16 *)cdev->req->buf) = PROTOCOL_VERSION;
|
||||
value = sizeof(u16);
|
||||
|
||||
cdev->req->complete = acc_complete_setup_noop;
|
||||
/* clear any string left over from a previous session */
|
||||
memset(dev->manufacturer, 0, sizeof(dev->manufacturer));
|
||||
memset(dev->model, 0, sizeof(dev->model));
|
||||
|
|
Loading…
Add table
Reference in a new issue