usb 0.6.0.7 → 0.6.0.8
raw patch · 3 files changed
+15/−13 lines, 3 files
Files
- System/USB/Internal.hs +14/−7
- Utils.hs +0/−5
- usb.cabal +1/−1
System/USB/Internal.hs view
@@ -69,7 +69,6 @@ -- from usb: import Utils ( bits , between- , void , genToEnum, genFromEnum , mapPeekArray , ifM@@ -78,15 +77,22 @@ #if MIN_VERSION_base(4,3,0) import Control.Exception ( mask )+import Control.Monad ( void ) #else import Control.Exception ( blocked, block, unblock ) import Data.Function ( id )+import Data.Functor ( (<$) )+ mask ∷ ((IO α → IO α) → IO β) → IO β mask io = do b ← blocked if b then io id else block $ io unblock++-- | Execute the given action but ignore the result.+void ∷ Functor m ⇒ m α → m ()+void = (() <$) #endif @@ -817,8 +823,9 @@ {-| A structure representing the standard USB endpoint descriptor. -This descriptor is documented in section 9.6.3 of the USB 2.0 specification. All-multiple-byte fields are represented in host-endian format.+This descriptor is documented in section 9.6.3 of the USB 2.0 specification.++This structure can be retrieved by using 'interfaceEndpoints'. -} data EndpointDesc = EndpointDesc { -- | The address of the endpoint described by the descriptor.@@ -840,7 +847,7 @@ -- is provided. , endpointRefresh ∷ !Word8 - -- | /For audio devices only:/ the address if the synch endpoint.+ -- | /For audio devices only:/ the address of the synch endpoint. , endpointSynchAddress ∷ !Word8 -- | Extra descriptors. If @libusb@ encounters unknown endpoint descriptors,@@ -1552,7 +1559,7 @@ -- | @checkUSBException action@ executes @action@. If @action@ returned a -- negative integer the integer is converted to a 'USBException' and thrown. If -- not, the integer is returned.-checkUSBException ∷ IO CInt → IO Int+checkUSBException ∷ Integral α ⇒ IO α → IO Int checkUSBException action = do r ← action if r < 0 then throwIO $ convertUSBException r@@ -1560,14 +1567,14 @@ -- | Convert a C'libusb_error to a 'USBException'. If the C'libusb_error is -- unknown an 'error' is thrown.-convertUSBException ∷ CInt → USBException+convertUSBException ∷ Num α ⇒ α → USBException convertUSBException err = fromMaybe unknownLibUsbError $ lookup err libusb_error_to_USBException where unknownLibUsbError = error $ "Unknown Libusb error code: " ++ show err ++ "!" -- | Association list mapping 'C'libusb_error's to 'USBException's.-libusb_error_to_USBException ∷ [(CInt, USBException)]+libusb_error_to_USBException ∷ Num α ⇒ [(α, USBException)] libusb_error_to_USBException = [ (c'LIBUSB_ERROR_IO, IOException "") , (c'LIBUSB_ERROR_INVALID_PARAM, InvalidParamException)
Utils.hs view
@@ -25,7 +25,6 @@ import Data.Ord ( Ord, (<) ) import Data.Bits ( Bits, shiftL, shiftR, bitSize, (.&.) ) import Data.Int ( Int )-import Data.Functor ( Functor, (<$)) import System.IO ( IO ) -- from base-unicode-symbols:@@ -46,10 +45,6 @@ -- (including). between ∷ Ord α ⇒ α → α → α → Bool between n b e = n ≥ b ∧ n ≤ e---- | Execute the given action but ignore the result.-void ∷ Functor m ⇒ m α → m ()-void = (() <$) -- | A generalized 'toEnum' that works on any 'Integral' type. genToEnum ∷ (Integral i, Enum e) ⇒ i → e
usb.cabal view
@@ -1,5 +1,5 @@ name: usb-version: 0.6.0.7+version: 0.6.0.8 cabal-version: >=1.6 build-type: Custom license: BSD3