packages feed

uacpid 0.0.4 → 1.0.1

raw patch · 11 files changed

+63/−21 lines, 11 filessetup-changed

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright Dino Morelli 2009+Copyright Dino Morelli 2009, 2010  All rights reserved. 
Setup.hs view
@@ -1,6 +1,6 @@ #! /usr/bin/env runhaskell --- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> 
TODO view
@@ -5,3 +5,7 @@ - Need to be careful about when acpid is stopped and the socket goes away on a running uacpid. Must deal with this gracefully.  - If acpid has run but is not now running, the socket file in /var/run/ can still be there. What happens then is that the connection is refused and you get no message in the uacpid log. You do get a message to stderr, but this is likely to be missed when running from .xinitrc  Need to fix this soon.++- Add version number output to logging when daemon is started++- Need to develop a simulator event server to use for automated testing and development
+ doc/hcar-uacpid.tex view
@@ -0,0 +1,30 @@+\documentclass{scrreprt}+\usepackage{paralist}+\usepackage{graphicx}+\usepackage{hcar}++\begin{document}++\begin{hcarentry}{uacpid}+\report{Dino Morelli}+\status{experimental, actively developed}+\makeheader++uacpid is a daemon designed to be run in userspace that will monitor the local system's acpid socket for hardware events. These events can then be acted upon by handlers with access to the user's environment.++uacpid is available in binary form for Arch Linux through the AUR and can be acquired using darcs or other methods. See the project page below for more.++\FurtherReading+\begin{compactitem}+\item Project page:++\url{http://ui3.info/d/proj/uacpid.html}++\item Source repository:++\texttt{darcs get} \url{http://ui3.info/darcs/uacpid}+\end{compactitem}++\end{hcarentry}++\end{document}
resources/man/uacpid.1 view
@@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -Tascii uacpid.1 .\"-.TH UACPID 1 "2009-Jul-15" Linux "User Manuals"+.TH UACPID 1 "2010-Apr-06" Linux "User Manuals" .SH NAME uacpid \- Userspace Advanced Configuration and Power Interface event daemon .SH SYNOPSIS
src/Uacpid/Conf.hs view
@@ -1,4 +1,4 @@--- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> 
src/Uacpid/Control/Monad/Error.hs view
@@ -1,4 +1,4 @@--- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> 
src/Uacpid/Events.hs view
@@ -1,4 +1,4 @@--- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> 
src/Uacpid/Log.hs view
@@ -1,4 +1,4 @@--- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> 
src/main.hs view
@@ -1,21 +1,20 @@--- Copyright: 2009 Dino Morelli+-- Copyright: 2009, 2010 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>  {-# LANGUAGE FlexibleContexts #-}  import Control.Concurrent-import Control.Concurrent.MVar import Control.Monad.Error import Data.Map hiding ( null ) import Data.Maybe import Prelude hiding ( lookup ) import Network.Socket-import System.Directory import System.Environment import System.Exit import System.IO import System.Log+import System.Posix.Files import System.Posix.Signals hiding ( Handler )  import Uacpid.Conf@@ -28,6 +27,10 @@    deriving Eq  +throwSocketFileError :: (MonadError String m) => String -> m a+throwSocketFileError msgPrefix = throwError $ msgPrefix ++ " Make sure acpid is installed, is running, and that this path is correct. This config setting is in ~/.uacpid/uacpid.conf under the key acpidSocket"++ openAcpidSocket :: (MonadError String m, MonadIO m) =>    ConfMap -> m Handle openAcpidSocket conf = do@@ -35,10 +38,14 @@     acpidSocketPath <- lookupEString "acpidSocket" conf -   exists <- liftIO $ doesFileExist acpidSocketPath-   unless exists $-      throwError $ "Socket " ++ acpidSocketPath ++ " does not exist. Make sure acpid is installed, is running, and that this path is correct. This config setting is in ~/.uacpid/uacpid.conf under the key acpidSocket"+   pathExists <- liftIO $ fileExist acpidSocketPath+   unless pathExists $ throwSocketFileError $+      "File " ++ acpidSocketPath ++ " does not exist." +   pathIsASocket <- liftIO $ liftM isSocket $ getFileStatus acpidSocketPath+   unless pathIsASocket $ throwSocketFileError $+      "File " ++ acpidSocketPath ++ " is not a socket."+    hdl <- liftIO $ do       -- Open the UNIX domain socket       s <- socket AF_UNIX Stream defaultProtocol@@ -72,7 +79,7 @@       eHdl <- runErrorT $ openAcpidSocket conf       either exitFail          (\hdl -> do-            takeMVar mvRunStatus+            _ <- takeMVar mvRunStatus             putMVar mvRunStatus RUN             listenAcpi handlers mvRunStatus hdl          )@@ -118,7 +125,7 @@  handleExitSignals :: MVar RunLevel -> IO () handleExitSignals mvRunStatus = do-   takeMVar mvRunStatus+   _ <- takeMVar mvRunStatus     logM NOTICE "uacpid daemon stopped" @@ -127,7 +134,7 @@  handleHupSignal :: MVar RunLevel -> IO () handleHupSignal mvRunStatus = do-   takeMVar mvRunStatus+   _ <- takeMVar mvRunStatus     logM NOTICE "sigHUP received" @@ -147,7 +154,8 @@    -- Install signal handlers    mapM_ (\signal -> installHandler signal        (Catch $ handleExitSignals mvRunStatus) Nothing) [sigINT, sigTERM]-   installHandler sigHUP (Catch $ handleHupSignal mvRunStatus) Nothing+   _ <- installHandler+      sigHUP (Catch $ handleHupSignal mvRunStatus) Nothing     logM NOTICE "uacpid daemon started"    logM NOTICE $ "Logging level " ++@@ -167,7 +175,7 @@       , ""       , "Please see man uacpid for detailed info"       , ""-      , "Version 0.0.4  2009-Jul-19  Dino Morelli <dino@ui3.info>"+      , "Version 1.0.1  Dino Morelli <dino@ui3.info>"       ]     exitWith ExitSuccess
uacpid.cabal view
@@ -1,10 +1,10 @@ name:                uacpid-version:             0.0.4+version:             1.0.1 cabal-version:       >= 1.2 build-type:          Simple license:             BSD3 license-file:        LICENSE-copyright:           2009 Dino Morelli+copyright:           2009, 2010 Dino Morelli author:              Dino Morelli maintainer:          Dino Morelli <dino@ui3.info> stability:           experimental@@ -17,7 +17,7 @@                      upon by handlers with access to the user's                      environment. category:            System-tested-with:         GHC>=6.10.3+tested-with:         GHC>=6.12.1 data-dir:            resources data-files:          uacpid/uacpid.conf, uacpid/events/anything