-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A database of USB identifiers -- -- Functions to find the names associated with various identifiers from -- the USB specification. This is useful if you want to display full -- human-readable names instead of cryptic numeric codes. @package usb-id-database @version 0.4 -- | Functions to acquire a database from http://www.usb.org. module System.USB.IDDB.UsbDotOrg -- | Construct a database from a string in the format used by usb.org. parseDb :: String -> Maybe IDDB -- | Load a database from a snapshot of the usb.org database which is -- supplied with the package. staticDb :: IO IDDB -- | Load a vendor database from file. If the file can not be read for some -- reason an error will be thrown. fromFile :: FilePath -> IO (Maybe IDDB) -- | http://www.usb.org/developers/tools/comp_dump -- -- The source of the database. Download this file for the most up-to-date -- version. dbURL :: String -- | Functions to acquire a database from http://linux-usb.org. module System.USB.IDDB.LinuxUsbIdRepo -- | Construct a database from a string in the format used by -- http://linux-usb.org. parseDb :: String -> Maybe IDDB -- | Load a database from a snapshot of the linux-usb.org database which is -- supplied with the package. staticDb :: IO IDDB -- | Load a database from file. If the file can not be read for some reason -- an error will be thrown. fromFile :: FilePath -> IO (Maybe IDDB) -- | http://linux-usb.org/usb.ids -- -- The source of the database. Download this file for the most up-to-date -- version. dbURL :: String -- | A database of USB identifiers. -- -- Databases with vendor names and identifiers can be loaded from string -- or file. -- -- To get the most up-to-date database download the files directly from -- http://www.usb.org or http://linux-usb.org. -- -- Each database's module contains an URL to the database file. -- -- Example usage: -- --
-- import System.USB.IDDB -- import System.USB.IDDB.LinuxUsbIdRepo (staticDb) -- import Text.Printf (printf) -- -- main :: IO () -- main = do -- Load a snapshot from the linux-usb.org database. -- db <- staticDb ---- --
-- -- Print the name of vendor 0x1d6b -- putStrLn $ maybe "unknown VID!" id -- $ vendorName db 0x1d6b ---- --
-- -- Print the ID of "Linux Foundation" -- putStrLn $ maybe "unknown vendor name!" (printf "0x%04x") -- $ vendorId db "Linux Foundation" ---- --
-- -- Print the name of the product with ID 0x0101 from the -- -- vendor with ID 0x1d6b. -- putStrLn $ maybe "unknown PID!" id -- $ productName db 0x1d6b 0x0101 ---- --
-- -- Print the ID of the product with the name "Audio Gadget" -- -- from the vendor with ID 0x1d6b. -- putStrLn $ maybe "unknown product name!" (printf "0x%04x") -- $ productId db 0x1d6b "Audio Gadget" --module System.USB.IDDB -- | A database of USB identifiers. Contains both vendor identifiers and -- product identifiers. data IDDB -- | An empty database. emptyDb :: IDDB vendorName :: IDDB -> Int -> Maybe String vendorId :: IDDB -> String -> Maybe Int productName :: IDDB -> Int -> Int -> Maybe String productId :: IDDB -> Int -> String -> Maybe Int className :: IDDB -> Int -> Maybe String subClassName :: IDDB -> Int -> Int -> Maybe String protocolName :: IDDB -> Int -> Int -> Int -> Maybe String audioClassTerminalTypeName :: IDDB -> Int -> Maybe String videoClassTerminalTypeName :: IDDB -> Int -> Maybe String hidDescTypeName :: IDDB -> Int -> Maybe String hidDescItemName :: IDDB -> Int -> Maybe String hidDescCountryCodeName :: IDDB -> Int -> Maybe String hidUsagePageName :: IDDB -> Int -> Maybe String hidUsageName :: IDDB -> Int -> Int -> Maybe String physicalDescBiasName :: IDDB -> Int -> Maybe String physicalDescItemName :: IDDB -> Int -> Maybe String langName :: IDDB -> Int -> Maybe String subLangName :: IDDB -> Int -> Int -> Maybe String