Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: libusb-1.0 for NetBSD
On Thu, May 31, 2012 at 9:05 PM, Eric Haszlakiewicz
<erh%nimenees.com@localhost> wrote:
> On Thu, May 31, 2012 at 07:48:00AM +0800, Xiaofan Chen wrote:
>> The other possibility is to learn from Mac OS X where
>> you can use a code-less kext to prevent the existing
>> kernel driver from attaching to a device (or a class
>> of device) based on certain criteria.
>
> I don't know what "code-less kext" is, but in NetBSD you can do this with
> a custom kernel configuration that has a nailed down ugen entry, e.g.:
>
> ugen3 at uhub? port ? vendor 0x06c2 product 0x0031 flags 1
>
> The vendor and product you can get using the
> USB_GET_DEVICE_DESC ioctl, which
> I recently copied over to uhid devices.
Thanks for the tip.
> Unfortunately userconf (boot -c) doesn't seem to be capable enough to
> do this so you actually need to build a new kernel for it.
Ah if that can be done without building a new kernel, that would be great.
A code-less kext is just an XML file which can prevents Apple Mac OS X
default driver to attach to the device, but rather use the generic iokit driver
(and as a result libusb can be used for USB device).
http://developer.apple.com/library/mac/#qa/qa1076/_index.html
http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KEXTConcept/KEXTConceptAnatomy/kext_anatomy.html
An example to use ST ST-Link V1 (using USB mass storage driver by
default) with libusb so that people can use open-source libusb based
program like OpenOCD under Mac OS X.
https://github.com/texane/stlink/tree/master/stlinkv1_macosx_driver
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>CFBundleIdentifier</key>
<string>com.libusb.stlink_shield</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>IOKitPersonalities</key>
<dict>
<key>DeviceDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBDevice</string>
<key>bcdDevice</key>
<integer>256</integer>
<key>idProduct</key>
<integer>14148</integer>
<key>idVendor</key>
<integer>1155</integer>
</dict>
<key>InterfaceDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBInterface</string>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>idProduct</key>
<integer>14148</integer>
<key>idVendor</key>
<integer>1155</integer>
</dict>
</dict>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOUSBFamily</key>
<string>1.8</string>
<key>com.apple.kpi.libkern</key>
<string>11.2.0</string>
</dict>
</dict>
</plist>
--
Xiaofan
Home |
Main Index |
Thread Index |
Old Index