usb 1.1.0.3 → 1.1.0.4
raw patch · 2 files changed
+34/−25 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- System/USB/Base.hs +20/−6
- usb.cabal +14/−19
System/USB/Base.hs view
@@ -33,7 +33,7 @@ import Foreign.Marshal.Array ( peekArray, allocaArray ) import Foreign.Storable ( Storable, peek, peekElemOff ) import Foreign.Ptr ( Ptr, castPtr, plusPtr, nullPtr )-import Foreign.ForeignPtr ( ForeignPtr, newForeignPtr, withForeignPtr)+import Foreign.ForeignPtr ( ForeignPtr, withForeignPtr ) import Control.Applicative ( liftA2 ) import Control.Exception ( Exception, throwIO, bracket, bracket_, onException, assert ) import Control.Monad ( Monad, (>>=), (=<<), return, when, forM )@@ -106,8 +106,6 @@ import Control.Concurrent.MVar ( MVar, newEmptyMVar, takeMVar, putMVar ) import System.IO ( hPutStrLn, stderr ) -import qualified Foreign.Concurrent as FC ( newForeignPtr )- #if MIN_VERSION_base(4,4,0) import GHC.Event #else@@ -130,6 +128,14 @@ import SystemEventManager ( getSystemEventManager ) #endif +#if defined(HAS_EVENT_MANAGER) || defined(mingw32_HOST_OS)+import qualified Foreign.Concurrent as FC ( newForeignPtr )+#endif++#if !defined(mingw32_HOST_OS)+import Foreign.ForeignPtr ( newForeignPtr )+#endif+ -------------------------------------------------------------------------------- #ifdef GENERICS@@ -193,7 +199,12 @@ newCtxNoEventManager ∷ (ForeignPtr C'libusb_context → Ctx) → IO Ctx newCtxNoEventManager ctx = mask_ $ do ctxPtr ← libusb_init+#ifdef mingw32_HOST_OS+ ctx <$> FC.newForeignPtr ctxPtr+ (c'libusb_exit ctxPtr)+#else ctx <$> newForeignPtr p'libusb_exit ctxPtr+#endif #ifndef HAS_EVENT_MANAGER -- | Create and initialize a new USB context.@@ -364,9 +375,7 @@ You can only obtain a USB device from the 'getDevices' function. Certain operations can be performed on a device, but in order to do any I/O you-will have to first obtain a 'DeviceHandle' using 'openDevice'. Alternatively you-can use the <http://hackage.haskell.org/package/usb-safe usb-safe> package-which provides type-safe device handling.+will have to first obtain a 'DeviceHandle' using 'openDevice'. Just because you have a reference to a device does not mean it is necessarily usable. The device may have been unplugged, you may not have permission to@@ -446,7 +455,12 @@ where mkDev ∷ Ptr C'libusb_device → IO Device mkDev devPtr = liftA2 (Device ctx)+#ifdef mingw32_HOST_OS+ (FC.newForeignPtr devPtr+ (c'libusb_unref_device devPtr))+#else (newForeignPtr p'libusb_unref_device devPtr)+#endif (getDeviceDesc devPtr) -- Both of the following numbers are static variables in the libusb device
usb.cabal view
@@ -1,5 +1,5 @@ name: usb-version: 1.1.0.3+version: 1.1.0.4 cabal-version: >=1.6 build-type: Custom license: BSD3@@ -13,9 +13,11 @@ synopsis: Communicate with USB devices description: This library enables you to communicate with USB devices from userspace. It is implemented as a high-level wrapper around- <http://hackage.haskell.org/package/bindings-libusb bindings-libusb>+ @bindings-libusb@+ (<http://hackage.haskell.org/package/bindings-libusb>) which is a low-level binding to the C library:- <http://libusb.org/ libusb-1.*>.+ @libusb-1.*@ (<http://libusb.org/>) or its fork:+ @libusbx-1.*@ (<http://libusbx.org/>). . The USB transfer functions in this library have a simple synchronous interface (they block) but are implemented using the @libusb@@@ -32,31 +34,24 @@ devices from a software standpoint (descriptors, configurations, interfaces, endpoints, control\/bulk\/interrupt\/isochronous transfers, etc). Full information can be found in the- <http://www.usb.org/developers/docs/ USB 2.0 specification>.+ USB 2.0 specification (<http://www.usb.org/developers/docs/>). . For an example how to use this library see the- <https://github.com/basvandijk/usb-example usb-example> package- or the <http://hackage.haskell.org/package/ls-usb ls-usb> package.- .- Also see the <http://hackage.haskell.org/package/usb-safe usb-safe>- package which wraps this package and provides some strong safety- guarantees for working with USB devices.- .- Finally have a look at the- <http://hackage.haskell.org/package/usb-iteratee usb-iteratee>- package which provides @iteratee@ enumerators for enumerating- bulk, interrupt and isochronous endpoints:+ @usb-example@ package (<https://github.com/basvandijk/usb-example>)+ or the @ls-usb@ package (<http://hackage.haskell.org/package/ls-usb>). . Besides this API documentation the following sources might be interesting: .- * <http://libusb.sourceforge.net/api-1.0/ The libusb 1.0 documentation>.+ * The @libusb 1.0@ documentation (<http://libusb.sourceforge.net/api-1.0/>). .- * <http://www.usb.org/developers/docs/ The USB 2.0 specification>.+ * The @libusbx 1.0@ documentation (<http://libusbx.sourceforge.net/api-1.0/>). .- * <http://hackage.haskell.org/package/bindings-libusb The bindings-libusb documentation>.+ * The USB 2.0 specification (<http://www.usb.org/developers/docs/>). .- * <http://www.beyondlogic.org/usbnutshell/usb1.htm "USB in a NutShell">.+ * The @bindings-libusb@ documentation (<http://hackage.haskell.org/package/bindings-libusb>).+ .+ * \"USB in a NutShell\" (<http://www.beyondlogic.org/usbnutshell/usb1.htm>). extra-source-files: README.markdown, NEWS