getDeviceHandleByName :: DeviceManager -> String -> FlowT (ErrorCode ': OpenErrors) Sys Handle
getDeviceHandleByName dm path = do
   dev <- lift <| deviceLookup dm (Text.pack path)
   case dev >>= deviceDevice of
      Just d  -> getDeviceHandle dm d
      Nothing -> throwE DeviceNotFound

-- | Get a handle on a device
--
-- Linux doesn't provide an API to open a device directly from its major and
-- minor numbers. Instead we must create a special device file with mknod in
-- the VFS and open it. This is what this function does. Additionally, we
-- remove the file once it is opened.
getDeviceHandleByName :: DeviceManager -> String -> FlowT (ErrorCode ': OpenErrors) Sys Handle
getDeviceHandleByName dm path = do
   dev <- lift <| deviceLookup dm (Text.pack path)
   case dev >>= deviceDevice of
      Just d  -> getDeviceHandle dm d
      Nothing -> throwE DeviceNotFound

-- | Get a handle on a device
--
-- Linux doesn't provide an API to open a device directly from its major and
-- minor numbers. Instead we must create a special device file with mknod in
-- the VFS and open it. This is what this function does. Additionally, we
-- remove the file once it is opened.
getDeviceHandleByName dm path = do
   dev <- lift <| deviceLookup dm (Text.pack path)
   case dev >>= deviceDevice of
      Just d  -> getDeviceHandle dm d
      Nothing -> throwE DeviceNotFound

-- | Get a handle on a device
--
-- Linux doesn't provide an API to open a device directly from its major and
-- minor numbers. Instead we must create a special device file with mknod in
-- the VFS and open it. This is what this function does. Additionally, we
-- remove the file once it is opened.