ifacePciBusAddr :: String -> IO (Maybe PciBusAddr)
ifacePciBusAddr face = do
    p <- (sysfsnet </>) <$> readSymbolicLink (sysfsnet </> face)
    scan (reverse $ splitPath p)
    where
      fromHex s = maybeRead ("0x" ++ s)
      scan :: [String] -> IO (Maybe PciBusAddr)
      scan [] = return Nothing
      scan ("../" : _) = return Nothing
      scan (iname : "net/" : addr : xs) = return $
          let addr' = reverse $ drop 1 (reverse addr) in
          case () of
            _ |   [a,b,x] <- split ':' addr'
                , [c,d]   <- split '.' x     ->
                  let h = fromHex in
                  BDF <$> h a <*> h b <*> h c <*> h d
              | otherwise -> Nothing
      scan (x : xs) = scan xs
ifacePciBusAddr :: String -> IO (Maybe PciBusAddr)
ifacePciBusAddr face = do
    p <- (sysfsnet </>) <$> readSymbolicLink (sysfsnet </> face)
    scan (reverse $ splitPath p)
    where
      fromHex s = maybeRead ("0x" ++ s)
      scan :: [String] -> IO (Maybe PciBusAddr)
      scan [] = return Nothing
      scan ("../" : _) = return Nothing
      scan (iname : "net/" : addr : xs) = return $
          let addr' = reverse $ drop 1 (reverse addr) in
          case () of
            _ |   [a,b,x] <- split ':' addr'
                , [c,d]   <- split '.' x     ->
                  let h = fromHex in
                  BDF <$> h a <*> h b <*> h c <*> h d
              | otherwise -> Nothing
      scan (x : xs) = scan xs
ifacePciBusAddr face = do
    p <- (sysfsnet </>) <$> readSymbolicLink (sysfsnet </> face)
    scan (reverse $ splitPath p)
    where
      fromHex s = maybeRead ("0x" ++ s)
      scan :: [String] -> IO (Maybe PciBusAddr)
      scan [] = return Nothing
      scan ("../" : _) = return Nothing
      scan (iname : "net/" : addr : xs) = return $
          let addr' = reverse $ drop 1 (reverse addr) in
          case () of
            _ |   [a,b,x] <- split ':' addr'
                , [c,d]   <- split '.' x     ->
                  let h = fromHex in
                  BDF <$> h a <*> h b <*> h c <*> h d
              | otherwise -> Nothing
      scan (x : xs) = scan xs