usb 0.5 → 0.5.0.1
raw patch · 3 files changed
+49/−70 lines, 3 filesdep ~text
Dependency ranges changed: text
Files
- Data/BCD.hs +3/−3
- System/USB/Internal.hs +44/−65
- usb.cabal +2/−2
Data/BCD.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-}+{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax, BangPatterns #-} module Data.BCD ( BCD4, unmarshalBCD4, decodeBCD ) where @@ -42,8 +42,8 @@ shftR = bitSize abcd - bitsInDigit go shftL ds | shftL < 0 = ds- | otherwise = go (shftL - bitsInDigit)- (((abcd `shiftL` shftL) `shiftR` shftR) : ds)+ | otherwise = let !d = (abcd `shiftL` shftL) `shiftR` shftR+ in go (shftL - bitsInDigit) (d : ds) -- The End ---------------------------------------------------------------------
System/USB/Internal.hs view
@@ -8,65 +8,50 @@ -------------------------------------------------------------------------------- -- from base:-import Prelude ( Num, (+), (-), (*), fromInteger- , Integral, fromIntegral, div- , Enum, error- )-import Foreign ( unsafePerformIO )-import Foreign.C.Types ( CUChar, CInt, CUInt )-import Foreign.C.String ( CStringLen )-import Foreign.Marshal.Alloc ( alloca )-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 Control.Applicative ( liftA2 )-import Control.Exception ( Exception- , throwIO- , bracket, bracket_- , block, unblock- , onException- , assert- )-import Control.Monad ( Monad, return, (>>=), (>>), (=<<), fail- , when, forM- )-import Control.Arrow ( (&&&) )-import Data.Function ( ($), flip, on )-import Data.Functor ( Functor, fmap, (<$>) )-import Data.Data ( Data )-import Data.Typeable ( Typeable )-import Data.Maybe ( fromMaybe )-import Data.List ( lookup, map, (++) )-import Data.Int ( Int )-import Data.Word ( Word8, Word16 )-import Data.Char ( String )-import Data.Eq ( Eq, (==) )-import Data.Ord ( Ord, (<), (>) )-import Data.Bool ( Bool(False, True), not )-import Data.Bits ( Bits- , (.|.)- , setBit, testBit- , shiftL- )-import System.IO ( IO )-import Text.Show ( Show, show )-import Text.Read ( Read )-import Text.Printf ( printf )+import Prelude ( Num, (+), (-), (*), fromInteger+ , Integral, fromIntegral, div+ , Enum, error+ )+import Foreign ( unsafePerformIO )+import Foreign.C.Types ( CUChar, CInt, CUInt )+import Foreign.C.String ( CStringLen )+import Foreign.Marshal.Alloc ( alloca )+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 Control.Applicative ( liftA2 )+import Control.Exception ( Exception, throwIO, bracket, bracket_+ , block, unblock, onException, assert+ )+import Control.Monad ( Monad, return, (>>=), (>>), (=<<), fail, when, forM )+import Control.Arrow ( (&&&) )+import Data.Function ( ($), flip, on )+import Data.Functor ( Functor, fmap, (<$>) )+import Data.Data ( Data )+import Data.Typeable ( Typeable )+import Data.Maybe ( fromMaybe )+import Data.List ( lookup, map, (++) )+import Data.Int ( Int )+import Data.Word ( Word8, Word16 )+import Data.Char ( String )+import Data.Eq ( Eq, (==) )+import Data.Ord ( Ord, (<), (>) )+import Data.Bool ( Bool(False, True), not )+import Data.Bits ( Bits, (.|.), setBit, testBit, shiftL )+import System.IO ( IO )+import Text.Show ( Show, show )+import Text.Read ( Read )+import Text.Printf ( printf ) -- from base-unicode-symbols:-import Data.Function.Unicode ( (∘) )-import Data.Bool.Unicode ( (∧) )-import Data.Eq.Unicode ( (≢), (≡) )+import Data.Function.Unicode ( (∘) )+import Data.Bool.Unicode ( (∧) )+import Data.Eq.Unicode ( (≢), (≡) ) -- from bytestring:-import qualified Data.ByteString as B ( ByteString- , packCStringLen- , drop- )-import qualified Data.ByteString.Internal as BI ( createAndTrim- , createAndTrim'- )+import qualified Data.ByteString as B ( ByteString, packCStringLen, drop )+import qualified Data.ByteString.Internal as BI ( createAndTrim, createAndTrim' ) import qualified Data.ByteString.Unsafe as BU ( unsafeUseAsCStringLen ) -- from text:@@ -78,13 +63,7 @@ -- from usb: import Data.BCD ( BCD4, unmarshalBCD4 )-import Utils ( bits- , between- , void- , genToEnum, genFromEnum- , mapPeekArray- , ifM- )+import Utils ( bits, between, void, genToEnum, genFromEnum, mapPeekArray, ifM ) --------------------------------------------------------------------------------@@ -753,7 +732,7 @@ -- *** Configuration attributes -------------------------------------------------------------------------------- --- | The USB 2.0 specification specifices that the configuration attributes only+-- | The USB 2.0 specification specifies that the configuration attributes only -- describe the device status. type ConfigAttribs = DeviceStatus @@ -996,10 +975,10 @@ convertInterfaceDesc ∷ C'libusb_interface_descriptor → IO InterfaceDesc convertInterfaceDesc i = do- let n = c'libusb_interface_descriptor'bNumEndpoints i+ let numEndpoints = c'libusb_interface_descriptor'bNumEndpoints i endpoints ← mapPeekArray convertEndpointDesc- (fromIntegral n)+ (fromIntegral numEndpoints) (c'libusb_interface_descriptor'endpoint i) extra ← getExtra (c'libusb_interface_descriptor'extra i)
usb.cabal view
@@ -1,5 +1,5 @@ name: usb-version: 0.5+version: 0.5.0.1 cabal-version: >=1.6 build-type: Custom license: BSD3@@ -63,7 +63,7 @@ , base-unicode-symbols >= 0.1.1 && < 0.3 , bindings-libusb >= 1.3 && < 1.5 , bytestring >= 0.9 && < 0.10- , text >= 0.5 && < 0.8+ , text >= 0.5 && < 0.9 exposed-modules: System.USB System.USB.Initialization System.USB.Enumeration