All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fumitoshi UKAI <ukai@debian.or.jp>
To: linux-hotplug@vger.kernel.org
Subject: Fixed munging of usb_bcdDevice for 2.2 kernels
Date: Mon, 07 Jan 2002 17:08:51 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-101042341718901@msgid-missing> (raw)

From debian user Tom Huckstep, I've receive the following patches:

diff -ur hotplug-2001_09_19/etc/hotplug/usb.agent hotplug-bcd_fix/etc/hotplug/usb.agent
--- hotplug-2001_09_19/etc/hotplug/usb.agent	Thu Sep 20 01:20:02 2001
+++ hotplug-bcd_fix/etc/hotplug/usb.agent	Thu Dec  6 23:51:05 2001
@@ -39,6 +39,8 @@
 #
 # HISTORY:
 #
+# 04-Dec-2001	Fixed munging of usb_bcdDevice for 2.2 kernels (Tom
+#		Huckstep)
 # 14-Mar-2001	Cleanup, bitmask the match_flags
 # 26-Feb-2001	Cleanup, support comments (Gioele Barabucci)
 # 23-Jan-2001	Update 2.2 handling; unfortunately there's no "feature
@@ -120,8 +122,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

Thanks,
Fumitoshi UKAI

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

                 reply	other threads:[~2002-01-07 17:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-101042341718901@msgid-missing \
    --to=ukai@debian.or.jp \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.