-- 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.0.9


-- | 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
--   <a>http://www.usb.org</a> or <a>http://linux-usb.org</a>.
--   
--   Each database's module contains an URL to the database file.
--   
--   Example usage:
--   
--   <pre>
--   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 &lt;- <tt>staticDb</tt>
--   </pre>
--   
--   <pre>
--   -- Print the name of vendor 0x1d6b
--   putStrLn $ maybe "unknown VID!" id
--            $ <a>vendorName</a> db 0x1d6b
--   </pre>
--   
--   <pre>
--   -- Print the ID of "Linux Foundation"
--   putStrLn $ maybe "unknown vendor name!" (<tt>printf</tt> "0x%04x")
--            $ <a>vendorId</a> db "Linux Foundation"
--   </pre>
--   
--   <pre>
--   -- Print the name of the product with ID 0x0101 from the
--   -- vendor with ID 0x1d6b.
--   putStrLn $ maybe "unknown PID!" id
--            $ <a>productName</a> db 0x1d6b 0x0101
--   </pre>
--   
--   <pre>
--   -- Print the ID of the product with the name "Audio Gadget"
--   -- from the vendor with ID 0x1d6b.
--   putStrLn $ maybe "unknown product name!" (<tt>printf</tt> "0x%04x")
--            $ <a>productId</a> db 0x1d6b "Audio Gadget"
--   </pre>
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


-- | Functions to acquire a database from <a>http://linux-usb.org</a>.
module System.USB.IDDB.LinuxUsbIdRepo

-- | Construct a database from a string in the format used by
--   <a>http://linux-usb.org</a>.
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)

-- | <a>http://linux-usb.org/usb.ids</a>
--   
--   The source of the database. Download this file for the most up-to-date
--   version.
dbURL :: String


-- | Functions to acquire a database from <a>http://www.usb.org</a>.
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)

-- | <a>http://www.usb.org/developers/tools/comp_dump</a>
--   
--   The source of the database. Download this file for the most up-to-date
--   version.
dbURL :: String
