[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#415904: marked as done ([Linux, ti_usb-serial] Removing (obsolete) firmware blobs, making driver usable (without udev scripts))



Your message dated Sun, 25 Mar 2007 08:36:18 +0200
with message-id <20070325063618.GB2520@flower.upol.cz>
and subject line Linux ti_usb-serial: just making driver usable (without udev scripts)
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: linux-source-2.6.18
Version: 2.6.18.dfsg.1-11
Severity: important
Tags: patch

1) In current form, i.e. without udev scripts, driver is unusable.

2) Two binary firmware blobs for different devices are staticaly included
   in the driver. While they are written to be GPL, Windows(R) driver
   package for such devices includes separate fimware files, thus providing
   updated ones and making blobs useless. Userspace helper was adopted to
   load that files. Filenames were taken from standard TI ez430 USB device
   driver package, where usb-serial is an interface.

3) To make driver usable usb_driver_set_configuration() crutch from
   2.6.19 was taken, it applies without conflicts on usb sources. This
   one is used to setup device and driver without need of any hotplug
   scripts.

4) Initial version was made in hurry in December, but updated patch was
   sent and conformed by upsteam author to work.

5) The upstream author lastly updated driver in 2.6.11. Some work was made
   to 2.6.13, but it wasn't posted to mainline. Now author wants to update
   his patch set, include some more binary blobs in the driver, or use
   userspace helper. Anything from my patch set he may include, but i asked
   him to provide his update first, and then i will post my.

Result: ~24k of RAM is saved, works without additional udev scripts, uses
        default (udev) userspace firmware load helper.

Cons: User must symlink or copy firmware files from standard driver
      package to '/lib/firmware/'.

Patches were posted in debian-kernel and can be downloaded via Gmane
news gate if lost. Head of patch set thread is:

Message-ID: <[🔎] 20070223082430.591244000@deen.upol.cz.local>
Archived-At: <http://permalink.gmane.org/gmane.linux.debian.devel.kernel/27125>

It would be nice to have this woring in Etch.

Thanks.

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
____


--- End Message ---
--- Begin Message ---
On Fri, Mar 23, 2007 at 12:05:50AM +0100, Oleg Verych wrote:
> Package: linux-source-2.6.18
> Version: 2.6.18.dfsg.1-11
> Severity: important
> Tags: patch
> 
> 1) In current form, i.e. without udev scripts, driver is unusable.

If binblobs are OK, patch to adopt firmware loader is big to accept and,
probably, buggy (it wasn't tested on big-endian platforms), maybe just to
make driver to work without bogus error messages and udev scripts will be
acceptable?

Here's backport from 2.6.19 and small patch. I don't know if it is
changing ABI though.

____
From: Alan Stern <stern@rowland.harvard.edu>
Subject: [PATCH] usbcore: help drivers to change device configs
Date: Mon, 21 Aug 2006 12:08:19 -0400 (EDT)

Greg:

It's generally a bad idea for USB interface drivers to try to change a
device's configuration, and usbcore doesn't provide any way for them
to do it.  However in a few exceptional circumstances it can make
sense.  This patch (as767) adds a roundabout mechanism to help drivers
that may need it.

Alan Stern



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

===

Right now this would be used by only one driver, so the code could be put 
into that driver instead of the core.  However I'm submitting it for the 
core, on the theory that if one driver can find a use for it, other ones 
eventually will too.

-
Yes, usbcore design is "a bad idea", thus we must accept this crutch!

comment-by: Oleg Verych
----
---
 drivers/usb/core/message.c |   59 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/usb.h        |    3 ++
 2 files changed, 62 insertions(+)

Index: linux-source-2.6.18/include/linux/usb.h
===================================================================
--- linux-source-2.6.18.orig/include/linux/usb.h	2007-02-23 09:12:21.455400000 +0100
+++ linux-source-2.6.18/include/linux/usb.h	2007-03-25 07:55:00.467261000 +0200
@@ -1042,4 +1042,7 @@ extern int usb_set_interface(struct usb_
 extern int usb_driver_set_configuration(struct usb_device *udev, int config);
 
+/* this request isn't really synchronous, but it belongs with the others */
+extern int usb_driver_set_configuration(struct usb_device *udev, int config);
+
 /*
  * timeouts, in milliseconds, used for sending/receiving control messages
Index: linux-source-2.6.18/drivers/usb/core/message.c
===================================================================
--- linux-source-2.6.18.orig/drivers/usb/core/message.c	2007-02-23 09:12:21.459400250 +0100
+++ linux-source-2.6.18/drivers/usb/core/message.c	2007-03-25 07:55:00.527264750 +0200
@@ -1568,4 +1568,63 @@ int usb_driver_set_configuration(struct 
 EXPORT_SYMBOL_GPL(usb_driver_set_configuration);
 
+struct set_config_request {
+	struct usb_device	*udev;
+	int			config;
+	struct work_struct	work;
+};
+
+/* Worker routine for usb_driver_set_configuration() */
+static void driver_set_config_work(void *_req)
+{
+	struct set_config_request *req = _req;
+
+	usb_lock_device(req->udev);
+	usb_set_configuration(req->udev, req->config);
+	usb_unlock_device(req->udev);
+	usb_put_dev(req->udev);
+	kfree(req);
+}
+
+/**
+ * usb_driver_set_configuration - Provide a way for drivers to change device configurations
+ * @udev: the device whose configuration is being updated
+ * @config: the configuration being chosen.
+ * Context: In process context, must be able to sleep
+ *
+ * Device interface drivers are not allowed to change device configurations.
+ * This is because changing configurations will destroy the interface the
+ * driver is bound to and create new ones; it would be like a floppy-disk
+ * driver telling the computer to replace the floppy-disk drive with a
+ * tape drive!
+ *
+ * Still, in certain specialized circumstances the need may arise.  This
+ * routine gets around the normal restrictions by using a work thread to
+ * submit the change-config request.
+ *
+ * Returns 0 if the request was succesfully queued, error code otherwise.
+ * The caller has no way to know whether the queued request will eventually
+ * succeed.
+ */
+int usb_driver_set_configuration(struct usb_device *udev, int config)
+{
+	struct set_config_request *req;
+
+	req = kmalloc(sizeof(*req), GFP_KERNEL);
+	if (!req)
+		return -ENOMEM;
+	req->udev = udev;
+	req->config = config;
+	INIT_WORK(&req->work, driver_set_config_work, req);
+
+	usb_get_dev(udev);
+	if (!schedule_work(&req->work)) {
+		usb_put_dev(udev);
+		kfree(req);
+		return -EINVAL;
+	}
+	return 0;
+}
+EXPORT_SYMBOL_GPL(usb_driver_set_configuration);
+
 // synchronous request completion model
 EXPORT_SYMBOL(usb_control_msg);


Subject: [patch 02/05] ti_usb, device setup: without any artificial errors, use configuration changing
Content-Disposition: inline; filename=ti_usb-change-config.patch

Using backported interface to change device usb configuration from
configuring to working.

signed-off-by: Oleg Verych
---
 drivers/usb/serial/ti_usb_3410_5052.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-source-2.6.18/drivers/usb/serial/ti_usb_3410_5052.c
===================================================================
--- linux-source-2.6.18.orig/drivers/usb/serial/ti_usb_3410_5052.c	2006-12-04 15:27:13.000000000 +0100
+++ linux-source-2.6.18/drivers/usb/serial/ti_usb_3410_5052.c	2007-03-25 07:58:35.496699500 +0200
@@ -450,11 +450,12 @@ static int ti_startup(struct usb_serial 
 		}
 
-		status = -ENODEV;
+		status = 1; /* positive status -- device to be reconfigured */
 		goto free_tdev;
-	} 
+	}
 
 	/* the second configuration must be set (in sysfs by hotplug script) */
 	if (dev->actconfig->desc.bConfigurationValue == TI_BOOT_CONFIG) {
-		status = -ENODEV;
+		(void) usb_driver_set_configuration(dev, TI_ACTIVE_CONFIG);
+		status = 1;
 		goto free_tdev;
 	}
____

--- End Message ---

Reply to: