-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A database of USB identifiers -- -- Functions to find the names associated with numerical vendor and -- product identifiers. @package usb-id-database @version 0.3 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 vendor database from file. If the file can not be read for some -- reason an error will be thrown. fromFile :: FilePath -> IO (Maybe IDDB) -- | Construct a database from the data available at -- http://linux-usb.org/usb.ids. fromWeb :: IO (Maybe IDDB) 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) -- | Construct a database from the list of companies available at -- http://www.usb.org/developers/tools/comp_dump. The website -- informs us that: "Remember this list changes almost daily, be -- sure to get a fresh copy when you use the tools". However, the -- list seems to be quite stable. Using this function more than once a -- day is probably overkill. fromWeb :: IO (Maybe IDDB) -- | A database of USB identifiers. -- -- Databases with vendor names and identifiers can be loaded from string, -- file or directly from http://www.usb.org> or -- <http://linux-usb.org. -- -- 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 type ID = Int type Name = String type VendorID = ID type VendorName = Name type ProductID = ID type ProductName = Name type ClassID = ID type ClassName = Name type SubClassID = ID type SubClassName = Name type ProtocolID = ID type ProtocolName = Name -- | An empty database. emptyDb :: IDDB vendorName :: IDDB -> VendorID -> Maybe VendorName vendorId :: IDDB -> VendorName -> Maybe VendorID productName :: IDDB -> VendorID -> ProductID -> Maybe ProductName productId :: IDDB -> VendorID -> ProductName -> Maybe ProductID className :: IDDB -> ClassID -> Maybe ClassName subClassName :: IDDB -> ClassID -> SubClassID -> Maybe SubClassName protocolName :: IDDB -> ClassID -> SubClassID -> ProtocolID -> Maybe ProtocolName