1 Reply
      Latest reply on Jul 4, 2019 10:26 PM by kingeaglewang
      kingeaglewang Level 1 Level 1 (0 points)

        Hello everyone,

         

        I just read the document in Apple IOKit fundamentals

         

        https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Matching/Matching.html

         

        I

        Driver Matching

        When a nub detects a device, the I/O Kit finds and loads a driver for the nub in three distinct phases, using a subtractive process. In each phase, drivers that are notconsidered to be likely candidates for a match are subtracted from the total pool of possible candidates until a successful candidate is found.

        The matching process proceeds as follows:

        1. In the class matching step, the I/O Kit narrows the list of potential drivers by eliminating any drivers of the wrong class for the provider service (that is, the nub). For example, all driver objects that descend from a SCSI class can be ruled out when the search is for a USB driver.
        2. In the passive matching step, the driver’s personality (specified in a driver’s XML information property list) is examined for properties specific to the provider’s family. For example, the personality might specify a particular vendor name.
        3. In the active matching step, the driver’s probe function is called with reference to the nub it is being matched against. This function allows the driver to communicate with the device and verify that it can in fact drive it. The driver returns a probe score that reflects its ability to drive the device. Device Probingfor more information. During active matching, the I/O Kit loads and probes all candidate drivers, then sorts them in order of highest to lowest probe score.

         

        I am curious about the process 2 (passive matching step). In my Info.plist, I define the IOKitPersonalities

        I restict the device I want is idProduct= 20480 and idVendor= 34148.

         

        According to the document, when I plug a device, such as idProduct=1234 and idVendor=5678, the process should stop in process 2.

         

        But I read the kernel log in Console, it still goes to the driver's probe function, which is process 3 (active matching step).

         

        I have tried Product Identification, USB Vendor Name, and USB Product Name.   When these three are not equal, it still goes to the driver's probe function.

         

        Only the property Vendor Identification, I have tried.  When this is not equal, it won't go to the driver's probe function.

         

        What's I want to ask is this document correct or not ?

         

        If it is correct, why idProduct, idVendor, Product Identification, USB Vendor Name, and USB Product Name are not equal to the device, it still goes to process 3 ?

         

        Thanks for you reply.

        • Re: IOKitPersonalities for Driver Matching
          kingeaglewang Level 1 Level 1 (0 points)

          Sorry for forgetting my Info.plist

           

          <key>IOKitPersonalities</key>
            <dict>
            <key>DPBSCSIDriver</key>
            <dict>
            <key>CFBundleIdentifier</key>
            <string>com.xxxxx.yyyyy.zzzzzDriver</string>
            <key>IOClass</key>
            <string>com_xxxxx_yyyyy_zzzzzDriver</string>
            <key>IOKitDebug</key>
            <integer>65535</integer>
            <key>IOProbeScore</key>
            <integer>4004</integer>
            <key>IOProviderClass</key>
            <string>IOSCSIPeripheralDeviceNub</string>
            <key>IOUserClientClass</key>
            <string>com_xxxxx_yyyyy_zzzzzDriverUserClient</string>
            <key>Peripheral Device Type</key>
            <integer>0</integer>
            <key>idProduct</key>
            <integer>20480</integer>
            <key>idVendor</key>
            <integer>34148</integer>
            </dict>
          </dict>