Skip to content

Commit

Permalink
Open devices with write permissions be default
Browse files Browse the repository at this point in the history
One can always use `newDeviceFromFd` if permissions are not available. Though this never seems necessary on my Manjaro device.
  • Loading branch information
georgefst committed Nov 5, 2022
1 parent d246b93 commit 75dfacf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evdev/src/Evdev.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import Foreign.C (CUInt)
import System.Posix.Process (getProcessID)
import System.Posix.Files (readSymbolicLink)
import System.Posix.ByteString (Fd, RawFilePath)
import System.Posix.IO.ByteString (OpenMode (ReadOnly), defaultFileFlags, openFd)
import System.Posix.IO.ByteString (OpenMode (..), defaultFileFlags, openFd)

import qualified Evdev.LowLevel as LL
import Evdev.Codes
Expand Down Expand Up @@ -205,7 +205,7 @@ toCTimeVal t = LL.CTimeVal n (round $ f * 1_000_000)
Use 'newDeviceFromFd' if you need more control over how the device is created.
-}
newDevice :: RawFilePath -> IO Device
newDevice path = newDeviceFromFd =<< openFd path ReadOnly Nothing defaultFileFlags
newDevice path = newDeviceFromFd =<< openFd path ReadWrite Nothing defaultFileFlags

{- | Generalisation of 'newDevice', in case one needs control over the file descriptor,
e.g. in order to set a particular 'System.Posix.FileMode', 'System.Posix.OpenMode', or 'System.Posix.OpenFileFlags'.
Expand Down

0 comments on commit 75dfacf

Please sign in to comment.