usb-id-database-0.2.1: A database of USB identifiersSource codeContentsIndex
System.USB.IDDB
Contents
Types
Query database
Description

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 Data.ByteString.Char8 (pack, unpack)
import System.USB.IDDB
import System.USB.IDDB.LinuxUsbIdRepo
import Text.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!" unpack
                   $ vendorName db 0x1d6b
          -- Print the ID of "Linux Foundation"
          putStrLn $ maybe "unknown vendor name!" (printf "0x%04x")
                   $ vendorId db (pack Linux Foundation)
          -- Print the name of the product with ID 0x0101 from the
          -- vendor with ID 0x1d6b.
          putStrLn $ maybe "unknown PID!" unpack
                   $ 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 (pack "Audio Gadget")
Synopsis
data IDDB
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
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
Types
data IDDB Source
A database of USB identifiers. Contains both vendor identifiers and product identifiers.
type VendorID = IDSource
type VendorName = NameSource
type ProductID = IDSource
type ProductName = NameSource
type ClassID = IDSource
type ClassName = NameSource
type SubClassID = IDSource
type SubClassName = NameSource
type ProtocolID = IDSource
type ProtocolName = NameSource
emptyDb :: IDDBSource
An empty database./
Query database
vendorName :: IDDB -> VendorID -> Maybe VendorNameSource
vendorId :: IDDB -> VendorName -> Maybe VendorIDSource
productName :: IDDB -> VendorID -> ProductID -> Maybe ProductNameSource
productId :: IDDB -> VendorID -> ProductName -> Maybe ProductIDSource
className :: IDDB -> ClassID -> Maybe ClassNameSource
subClassName :: IDDB -> ClassID -> SubClassID -> Maybe SubClassNameSource
protocolName :: IDDB -> ClassID -> SubClassID -> ProtocolID -> Maybe ProtocolNameSource
Produced by Haddock version 2.4.2