linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Plato <tom@redant.freeserve.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: Re: 2.2 bcdDevice munging patch
Date: Tue, 04 Dec 2001 01:44:59 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-100743016425669@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-100743001825350@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

On Tue, Dec 04, 2001 at 01:41:05AM +0000, Plato wrote:
OK.  I should be more careful before I post to a public mailing list!  Darn.

> I do not believe that your `munging' of bcdDevice numbers is working
> correctly.  For instance, if PRODUCT is of the form

I should say that this specifically refers to the environment variable
PRODUCT as seen by /etc/hotplug/usb.agent.

> The attached patch seeks to rectify this.  Please let me know if it is any
> use and whether or not it will be included in your releases.

Hmmm ... here it is.  This time :-)

Plato



[-- Attachment #2: hotplug-bcd_fix.patch --]
[-- Type: text/plain, Size: 1908 bytes --]

diff -u -r hotplug-2001_09_19/ChangeLog hotplug-bcd_fix/ChangeLog
--- hotplug-2001_09_19/ChangeLog	Thu Sep 20 01:20:02 2001
+++ hotplug-bcd_fix/ChangeLog	Tue Dec  4 01:20:13 2001
@@ -1,3 +1,6 @@
+Tue Dec 4 2001  Tom Huckstep <tom@redant.freeserve.co.uk>
+	- Fixed munging of usb_bcdDevice for 2.2 kernels
+
 Sun Sep 16 2001 kroah/dbrownell
 	- Added ieee1394.agent from Kristian Hogsberg
 	  <hogsberg@users.sourceforge.net>
diff -u -r hotplug-2001_09_19/etc/hotplug/usb.agent hotplug-bcd_fix/etc/hotplug/usb.agent
--- hotplug-2001_09_19/etc/hotplug/usb.agent	Tue Dec  4 01:17:19 2001
+++ hotplug-bcd_fix/etc/hotplug/usb.agent	Tue Dec  4 01:17:59 2001
@@ -120,8 +120,28 @@
     # work around 2.2 brokenness
     # munges the usb_bcdDevice such that it is a integer rather
     # than a float: e.g. 1.0 become 0100
-    PRODUCT=`echo $PRODUCT | sed -e "s+\.\([0-9]\)$+.\10+" -e "s/\.$/00/" \
-                                  -e "s+/\([0-9]\)\.\([0-9][0-9]\)+/0\1\2+"`
+
+    # In PRODUCT=x/y/z if z has only one digit after a decimal point then a
+    # trailing zero is added.  If z has only one digit before a decimal
+    # point then a leading zero is added.  The decimal point is then
+    # removed.
+
+    # e.g. a.b  -> 0ab0
+    #     ab.c  -> cab0
+    #      a.bc -> 0abc
+    #     ab.cd -> abcd
+
+    # Why does the kernel give us this in such a weird format?  I don't
+    # know, but looking at usb/usb.c in your 2.2 kernel source may help.
+    # N.B. to_bcd()
+
+    # Add the trailing zero
+    PRODUCT=`echo $PRODUCT | sed -e "s+\.\([0-9]\)$+.\10+"`
+    # Add the leading zero
+    PRODUCT=`echo $PRODUCT | sed -e "s/\/\([0-9].[0-9][0-9]\)$/\/0\1/"`
+    # Remove the decimal point
+    PRODUCT=`echo $PRODUCT | sed -e "s/\/\([0-9][0-9]\)\.\([0-9][0-9]\)/\/\1\2/"`
+
     set `echo $PRODUCT | $AWK -F/ '{print "0x" $1, "0x" $2, "0x" $3 }'` ''
     usb_idVendor=$1
     usb_idProduct=$2

  reply	other threads:[~2001-12-04  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04  1:41 2.2 bcdDevice munging patch Plato
2001-12-04  1:44 ` Plato [this message]
2001-12-04  3:32 ` Greg KH
2001-12-04  3:49 ` David Brownell
2001-12-05  0:42 ` Plato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-100743016425669@msgid-missing \
    --to=tom@redant.freeserve.co.uk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).