usb 1.1 → 1.1.0.1
raw patch · 3 files changed
+26/−13 lines, 3 files
Files
- NEWS +11/−0
- System/USB/Base.hs +13/−11
- usb.cabal +2/−2
NEWS view
@@ -1,3 +1,14 @@+1.1++(Released on: Sat Jan 7 20:54:10 UTC 2012)++* Support base-4.5++* Mark the safe modules as Trustworthy and the unsafe ones as Unsafe.++* Replaced getEvtMgr with getWait++ 1.0 (Released on: Mon Sep 12 19:50:37 UTC 2011)
System/USB/Base.hs view
@@ -21,7 +21,7 @@ -- from base: import Prelude ( Num, (+), (-), (*), Integral, fromIntegral, div- , Enum, fromEnum, error, String+ , Enum, fromEnum, error, String, ($!), seq ) import Foreign.C.Types ( CUChar, CInt, CUInt ) import Foreign.C.String ( CStringLen )@@ -238,23 +238,25 @@ C'libusb_pollfd fd evt ← peek pollFdPtr fdKey ← register fd evt return (fromIntegral fd, fdKey)- fdKeyMapRef ← newIORef (fromList fdKeys ∷ IntMap FdKey)+ fdKeyMapRef ← newIORef $! (fromList fdKeys ∷ IntMap FdKey) free pollFdPtrLst -- Be notified when libusb file descriptors are added or removed: aFP ← mk'libusb_pollfd_added_cb $ \fd evt _ → mask_ $ do fdKey ← register fd evt- atomicModifyIORef fdKeyMapRef $ \fdKeyMap →- (insert (fromIntegral fd) fdKey fdKeyMap, ())+ newFdKeyMap <- atomicModifyIORef fdKeyMapRef $ \fdKeyMap →+ let newFdKeyMap = insert (fromIntegral fd) fdKey fdKeyMap+ in (newFdKeyMap, newFdKeyMap)+ newFdKeyMap `seq` return () rFP ← mk'libusb_pollfd_removed_cb $ \fd _ → mask_ $ do- fdKey ← atomicModifyIORef fdKeyMapRef $ \fdKeyMap →- let (Just fdKey, newFdKeyMap) =- updateLookupWithKey (\_ _ → Nothing)- (fromIntegral fd)- fdKeyMap- in (newFdKeyMap, fdKey)- unregisterFd evtMgr fdKey+ (newFdKeyMap, fdKey) ← atomicModifyIORef fdKeyMapRef $ \fdKeyMap →+ let (Just fdKey, newFdKeyMap) =+ updateLookupWithKey (\_ _ → Nothing)+ (fromIntegral fd)+ fdKeyMap+ in (newFdKeyMap, (newFdKeyMap, fdKey))+ newFdKeyMap `seq` unregisterFd evtMgr fdKey c'libusb_set_pollfd_notifiers ctxPtr aFP rFP nullPtr
usb.cabal view
@@ -1,5 +1,5 @@ name: usb-version: 1.1+version: 1.1.0.1 cabal-version: >=1.6 build-type: Custom license: BSD3@@ -7,7 +7,7 @@ copyright: 2009–2012 Bas van Dijk <v.dijk.bas@gmail.com> author: Bas van Dijk <v.dijk.bas@gmail.com> maintainer: Bas van Dijk <v.dijk.bas@gmail.com>-homepage: https://github.com/basvandijk/usb+homepage: http://basvandijk.github.com/usb bug-reports: https://github.com/basvandijk/usb/issues category: System, Hardware synopsis: Communicate with USB devices