[kernel] r6309 - people/waldi/linux-kbuild-2.6/src/mod

Bastian Blank waldi at costa.debian.org
Tue Mar 28 13:38:31 UTC 2006


Author: waldi
Date: Tue Mar 28 13:38:29 2006
New Revision: 6309

Modified:
   people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.cpp
   people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.hpp
   people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.tpp
Log:
src/mod/module_devicetable_impl_2_6_16.cpp,
src/mod/module_devicetable_impl_2_6_16.hpp,
src/mod/module_devicetable_impl_2_6_16.tpp: Support expanded usb entries.


Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.cpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.cpp	(original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.cpp	Tue Mar 28 13:38:29 2006
@@ -126,8 +126,6 @@
 table_entry_version<device_usb, version_2_6_16>::table_entry_version () throw () :
   idVendor ("v"),
   idProduct ("p"),
-  bcdDevice_lo ("dl"),
-  bcdDevice_hi ("dh"),
   bDeviceClass ("dc"),
   bDeviceSubClass ("dsc"),
   bDeviceProtocol ("dp"),
@@ -144,8 +142,19 @@
   out << "usb:";
   idVendor.write (out, match_flags & USB_DEVICE_ID_MATCH_VENDOR);
   idProduct.write (out, match_flags & USB_DEVICE_ID_MATCH_PRODUCT);
-  bcdDevice_lo.write (out, match_flags & USB_DEVICE_ID_MATCH_DEV_LO);
-  bcdDevice_hi.write (out, match_flags & USB_DEVICE_ID_MATCH_DEV_HI);
+  out << 'd';
+  if (bcdDevice_initial_digits)
+  {
+    char buf[12];
+    snprintf (buf, sizeof (buf), "%0*X", bcdDevice_initial_digits, bcdDevice_initial);
+    out << buf;
+  }
+  if (range_lo == range_hi)
+    out << static_cast<int> (range_lo);
+  else if (range_lo > 0 || range_hi < 9)
+    out << '[' << static_cast<int> (range_lo) << '-' << static_cast<int> (range_hi) << ']';
+  if (bcdDevice_initial_digits < 3)
+    out << '*';
   bDeviceClass.write (out, match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS);
   bDeviceSubClass.write (out, match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS);
   bDeviceProtocol.write (out, match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL);

Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.hpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.hpp	(original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.hpp	Tue Mar 28 13:38:29 2006
@@ -218,8 +218,14 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_ccw, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_ccw, version_2_6_16>
       {
-        public:
+        protected:
           table_entry_data (const device_id<device_ccw, Elf_class> &) throw ();
+
+        public:
+          static void add (const device_id<device_ccw, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+          {
+            table.push_back (new table_entry_data<device_ccw, version_2_6_16, Elf_class, Elf_data> (id));
+          }
       };
 
     template<>
@@ -239,8 +245,14 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_ieee1394, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_ieee1394, version_2_6_16>
       {
-        public:
+        protected:
           table_entry_data (const device_id<device_ieee1394, Elf_class> &) throw ();
+
+        public:
+          static void add (const device_id<device_ieee1394, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+          {
+            table.push_back (new table_entry_data<device_ieee1394, version_2_6_16, Elf_class, Elf_data> (id));
+          }
       };
 
     template<>
@@ -258,8 +270,14 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_pci, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_pci, version_2_6_16>
       {
-        public:
+        protected:
           table_entry_data (const device_id<device_pci, Elf_class> &) throw ();
+
+        public:
+          static void add (const device_id<device_pci, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+          {
+            table.push_back (new table_entry_data<device_pci, version_2_6_16, Elf_class, Elf_data> (id));
+          }
       };
 
     template<>
@@ -274,8 +292,14 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_pnp, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_pnp, version_2_6_16>
       {
-        public:
+        protected:
           table_entry_data (const device_id<device_pnp, Elf_class> &) throw ();
+
+        public:
+          static void add (const device_id<device_pnp, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+          {
+            table.push_back (new table_entry_data<device_pnp, version_2_6_16, Elf_class, Elf_data> (id));
+          }
       };
 
     template<>
@@ -290,8 +314,14 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_pnp_card, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_pnp_card, version_2_6_16>
       {
-        public:
+        protected:
           table_entry_data (const device_id<device_pnp_card, Elf_class> &) throw ();
+
+        public:
+          static void add (const device_id<device_pnp_card, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+          {
+            table.push_back (new table_entry_data<device_pnp_card, version_2_6_16, Elf_class, Elf_data> (id));
+          }
       };
 
     template<>
@@ -304,8 +334,10 @@
           identifier_value<uint16_t> match_flags;
           identifier<uint16_t> idVendor;
           identifier<uint16_t> idProduct;
-          identifier<uint16_t> bcdDevice_lo;
-          identifier<uint16_t> bcdDevice_hi;
+          unsigned int bcdDevice_initial;
+          int bcdDevice_initial_digits;
+          unsigned char range_lo;
+          unsigned char range_hi;
           identifier<uint8_t> bDeviceClass;
           identifier<uint8_t> bDeviceSubClass;
           identifier<uint8_t> bDeviceProtocol;
@@ -317,12 +349,15 @@
     template<typename Elf_class, typename Elf_data>
       class table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data> : public table_entry_version<device_usb, version_2_6_16>
       {
+        protected:
+          table_entry_data (const device_id<device_usb, Elf_class> &, uint16_t bcdDevice_initial, int bcdDevice_initial_digits, unsigned char range_lo, unsigned char range_hi) throw ();
+
         public:
-          table_entry_data (const device_id<device_usb, Elf_class> &) throw ();
+          static void add (const device_id<device_usb, Elf_class> &, std::vector<table_entry *> &table) throw ();
       };
 
     template<typename device, typename Elf_class, typename Elf_data>
-      class table_data<device, version_2_6_16, Elf_class, Elf_data> : public table<device_ccw, Elf_class, Elf_data>
+      class table_data<device, version_2_6_16, Elf_class, Elf_data> : public table<device, Elf_class, Elf_data>
       {
         protected:
           typedef device_id<device, Elf_class> devin;

Modified: people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.tpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.tpp	(original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.tpp	Tue Mar 28 13:38:29 2006
@@ -86,19 +86,69 @@
       }
 
     template<typename Elf_class, typename Elf_data>
-      table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data>::table_entry_data (const device_id<device_usb, Elf_class> &id) throw ()
+      table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data>::table_entry_data (const device_id<device_usb, Elf_class> &id, uint16_t _bcdDevice_initial, int _bcdDevice_initial_digits, unsigned char _range_lo, unsigned char _range_hi) throw ()
       {
         _do_convert (match_flags);
         _do_convert (idVendor);
         _do_convert (idProduct);
-        _do_convert (bcdDevice_lo);
-        _do_convert (bcdDevice_hi);
         _do_convert (bDeviceClass);
         _do_convert (bDeviceSubClass);
         _do_convert (bDeviceProtocol);
         _do_convert (bInterfaceClass);
         _do_convert (bInterfaceSubClass);
         _do_convert (bInterfaceProtocol);
+	bcdDevice_initial = _bcdDevice_initial;
+	bcdDevice_initial_digits = _bcdDevice_initial_digits;
+	range_lo = _range_lo;
+	range_hi = _range_hi;
+      }
+
+    template<typename Elf_class, typename Elf_data>
+      void table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data>::add
+      (const device_id<device_usb, Elf_class> &id, std::vector<table_entry *> &table) throw ()
+      {
+        uint16_t match_flags;
+        uint16_t idVendor;
+        uint16_t bcdDevice_lo = 0;
+        uint16_t bcdDevice_hi = ~0;
+        uint8_t bDeviceClass;
+        uint8_t bInterfaceClass;
+
+        _do_convert (match_flags);
+        _do_convert (idVendor);
+        if (match_flags & USB_DEVICE_ID_MATCH_DEV_LO)
+          _do_convert (bcdDevice_lo);
+        if (match_flags & USB_DEVICE_ID_MATCH_DEV_HI)
+          _do_convert (bcdDevice_hi);
+        _do_convert (bDeviceClass);
+        _do_convert (bInterfaceClass);
+
+        if (!(idVendor | bDeviceClass | bInterfaceClass))
+          return;
+
+        for (int ndigits = 3; bcdDevice_lo <= bcdDevice_hi; ndigits--)
+        {
+          unsigned char clo = bcdDevice_lo & 0xf;
+          unsigned char chi = bcdDevice_hi & 0xf;
+
+          if (chi > 9)    /* it's bcd not hex */
+            chi = 9;
+
+          bcdDevice_lo >>= 4;
+          bcdDevice_hi >>= 4;
+
+          if (bcdDevice_lo == bcdDevice_hi || !ndigits)
+          {
+            table.push_back (new table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data> (id, bcdDevice_lo, ndigits, clo, chi));
+            return;
+          }
+
+          if (clo > 0)
+            table.push_back (new table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data> (id, bcdDevice_lo++, ndigits, clo, 9));
+
+          if (chi < 9)
+            table.push_back (new table_entry_data<device_usb, version_2_6_16, Elf_class, Elf_data> (id, bcdDevice_hi--, ndigits, 0, chi));
+        }
       }
 
     template<typename device, typename Elf_class, typename Elf_data>
@@ -112,7 +162,7 @@
         const devin *e = static_cast <const devin *> (mem);
         this->entries.reserve (len);
         for (size_t i = 0; i < len; ++i)
-          this->entries.push_back (new table_entry_data<device, version_2_6_16, Elf_class, Elf_data> (e[i]));
+          table_entry_data<device, version_2_6_16, Elf_class, Elf_data>::add (e[i], this->entries);
       }
   }
 }



More information about the Kernel-svn-changes mailing list