Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56b31cdc authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: f_gsi: Check USB connection status in ioctl"

parents 13345f8a 3881e137
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1439,9 +1439,9 @@ static long gsi_ctrl_dev_ioctl(struct file *fp, unsigned int cmd,
	gsi = inst_cur->opts->gsi;
	c_port = &gsi->c_port;

	if (!c_port) {
		log_event_err("%s: gsi ctrl port %pK", __func__, c_port);
		return -ENODEV;
	if (!atomic_read(&gsi->connected)) {
		log_event_err("USB cable not connected\n");
		return -ECONNRESET;
	}

	switch (cmd) {
@@ -1807,7 +1807,7 @@ static int gsi_ctrl_send_notification(struct f_gsi *gsi)
	__le32 *data;
	struct usb_cdc_notification *event;
	struct usb_request *req = gsi->c_port.notify_req;
	struct usb_composite_dev *cdev = gsi->function.config->cdev;
	struct usb_composite_dev *cdev;
	struct gsi_ctrl_pkt *cpkt;
	unsigned long flags;
	bool del_free_cpkt = false;
@@ -1838,6 +1838,7 @@ static int gsi_ctrl_send_notification(struct f_gsi *gsi)
	log_event_dbg("%s: cpkt->type:%d\n", __func__, cpkt->type);

	event = req->buf;
	cdev = gsi->function.config->cdev;

	switch (cpkt->type) {
	case GSI_CTRL_NOTIFY_CONNECT: