[libhid-discuss] usb_control_msg

Jorgen Lundman lundman at lundman.net
Wed Jun 27 00:47:50 UTC 2007



> 
> I should rephrase that: libhid (and libusb) can't claim a HID device 
> exclusively under OS X *without the help of a kext*.
> 
> So you could have cross-platform code if you can get the kext working.
> 

If there was a method to load and unload the kext without reboot, or
even unplugging the device (a USB reset command? HIDAPI to detach it?)
then that would be perfectly acceptable. Better yet would be to have HID
API calls that uses the OS underlying API, even if that is just libusb
on Unix.


> 
> Where did you install the kext? Or did you just load it in place?
> 

# mkdir /System/Library/Extensions/usbb2k.kext/
# cat <<EOF > /System/Library/Extensions/usbb2k.kext/Info.plist
    <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
     <plist version="1.0">
     <dict>
         <key>CFBundleDevelopmentRegion</key> <string>English</string>
         <key>CFBundleGetInfoString</key> <string>Libusb USB device
Shield</string>
         <key>CFBundleIdentifier</key>
<string>com.libusb.USB_Shield</string>
         <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
         <key>CFBundleName</key> <string>Libusb USB device Shield</string>
         <key>CFBundlePackageType</key> <string>KEXT</string>
         <key>CFBundleSignature</key> <string>????</string>
         <key>CFBundleVersion</key> <string>6.0</string>
         <key>IOKitPersonalities</key>
         <dict>
             <key>B2K</key>
             <dict>
                 <key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBComposite</string>
                 <key>IOClass</key> <string>AppleUSBComposite</string>
                 <key>IOProviderClass</key> <string>IOUSBDevice</string>
                 <key>idVendor</key> <integer>27027</integer>
                 <key>idProduct</key> <integer>45057</integer>
             </dict>
         </dict>
         <key>OSBundleCompatibleVersion</key> <string>1.8</string>
         <key>OSBundleLibraries</key>
         <dict>
             <key>com.apple.kernel.iokit</key> <string>6.0</string>
         </dict>
     </dict>
</plist>
EOF

 From Graeme Hill I believe.

# kextload -n -t /System/Library/Extensions/usbb2k.kext/
kext appears valid.
# kextload  /System/Library/Extensions/usbb2k.kext/
Or for fun, this also works:
# kextload -b com.libusb.USB_Shield


With -v 6

kextload: extension /System/Library/Extensions/usbb2k.kext is authentic
kextload: extension /System/Library/Extensions/usbb2k.kext/ has no
executable
kextload: loading personalities for extension
/System/Library/Extensions/usbb2k.kext
kextload: loading personalities named:
kextload:     B2K
kextload: sending 1 personality to the kernel
kextload: matching started for /System/Library/Extensions/usbb2k.kext/





> 
> The trunk doesn't have much beyond 0.2.16 yet. What SVN revision and/or 
> branch are you referring to?
> 

I skimmed it, and saw calls to things like HIDGetItemValue() and got
excited, but checking it again, it seems that was just what you called
your functions, which in turn call usb_get_report(). (What are the
set/get report calls? Any chance I can use them to talk to the device?
Or presumably they need endpoints enumerated too)

http://www.ghz.cc/~clepple/libHID/doc/html/libhid-generic_8c-source.html



-- 
Jorgen Lundman       | <lundman at lundman.net>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)




More information about the libhid-discuss mailing list