ADD error message for device init
This commit is contained in:
parent
7432a8f841
commit
2948610785
|
@ -206,7 +206,12 @@ addDeviceRemovedListener state dpy adapter sys =
|
|||
old <- removeDevice state d
|
||||
forM_ old $ liftIO . removeMatch (toClient sys) . btDevSigHandler
|
||||
|
||||
pathCallback :: MonadUnliftIO m => ObjectPath -> m () -> (ObjectPath -> m ()) -> SignalCallback m
|
||||
pathCallback
|
||||
:: MonadUnliftIO m
|
||||
=> ObjectPath
|
||||
-> m ()
|
||||
-> (ObjectPath -> m ())
|
||||
-> SignalCallback m
|
||||
pathCallback adapter dpy f [device, _] = forM_ (fromVariant device) $ \d ->
|
||||
when (adaptorHasDevice adapter d) $ f d >> dpy
|
||||
pathCallback _ _ _ _ = return ()
|
||||
|
@ -303,9 +308,12 @@ addAndInitDevice
|
|||
-> SysClient
|
||||
-> m ()
|
||||
addAndInitDevice state dpy device client = do
|
||||
sh <- addDeviceListener state dpy device client
|
||||
-- TODO add some intelligent error messages here
|
||||
forM_ sh $ \s -> initDevice state s device client
|
||||
res <- addDeviceListener state dpy device client
|
||||
case res of
|
||||
Just handler -> initDevice state handler device client
|
||||
Nothing -> logError $ "could not initialize device at path " <> device_
|
||||
where
|
||||
device_ = displayWrapQuote $ displayObjectPath device
|
||||
|
||||
initDevice
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
|
|
Loading…
Reference in New Issue