usb-0.1.0.1: Communicate with USB devicesSource codeContentsIndex
System.USB.IO.Synchronous
Contents
Control transfers
Bulk transfers
Interrupt transfers
Synopsis
type Timeout = Int
type Size = Int
data RequestType
= Standard
| Class
| Vendor
data Recipient
= ToDevice
| ToInterface
| ToEndpoint
| ToOther
control :: DeviceHandle -> RequestType -> Recipient -> Word8 -> Word16 -> Word16 -> Timeout -> IO ()
readControl :: DeviceHandle -> RequestType -> Recipient -> Word8 -> Word16 -> Word16 -> Size -> Timeout -> IO ByteString
writeControl :: DeviceHandle -> RequestType -> Recipient -> Word8 -> Word16 -> Word16 -> ByteString -> Timeout -> IO Size
readBulk :: DeviceHandle -> EndpointAddress -> Size -> Timeout -> IO ByteString
writeBulk :: DeviceHandle -> EndpointAddress -> ByteString -> Timeout -> IO Size
readInterrupt :: DeviceHandle -> EndpointAddress -> Size -> Timeout -> IO ByteString
writeInterrupt :: DeviceHandle -> EndpointAddress -> ByteString -> Timeout -> IO Size
Documentation
type Timeout = IntSource
A timeout in milliseconds. Use 0 to indicate no timeout.
type Size = IntSource
Number of bytes transferred.
data RequestType Source
Constructors
Standard
Class
Vendor
show/hide Instances
data Recipient Source
Constructors
ToDevice
ToInterface
ToEndpoint
ToOther
show/hide Instances
Control transfers
controlSource
:: DeviceHandleA handle for the device to communicate with.
-> RequestTypeThe type of request.
-> RecipientThe recipient of the request.
-> Word8Request.
-> Word16Value.
-> Word16Index.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO ()

Perform a USB control request that does not transfer data.

The value and index values should be given in host-endian byte order.

Exceptions:

readControlSource
:: DeviceHandleA handle for the device to communicate with.
-> RequestTypeThe type of request.
-> RecipientThe recipient of the request.
-> Word8Request.
-> Word16Value.
-> Word16Index.
-> SizeThe maximum number of bytes to read.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO ByteString

Perform a USB control read.

The value and index values should be given in host-endian byte order.

Exceptions:

writeControlSource
:: DeviceHandleA handle for the device to communicate with.
-> RequestTypeThe type of request.
-> RecipientThe recipient of the request.
-> Word8Request.
-> Word16Value.
-> Word16Index.
-> ByteStringThe ByteString to write,
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO Size

Perform a USB control write.

The value and index values should be given in host-endian byte order.

Exceptions:

Bulk transfers
readBulkSource
:: DeviceHandleA handle for the device to communicate with.
-> EndpointAddressThe address of a valid endpoint to communicate with. Because we are reading, make sure this is an In endpoint!!! If it isn't the behaviour is undefined.
-> SizeThe maximum number of bytes to read.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO ByteStringThe function returns the ByteString that was read. Note that the length of this ByteString <= the requested size to read.

Perform a USB bulk read.

Exceptions:

writeBulkSource
:: DeviceHandleA handle for the device to communicate with.
-> EndpointAddressThe address of a valid endpoint to communicate with. Because we are writing, make sure this is an Out endpoint!!! If it isn't the behaviour is undefined.
-> ByteStringThe ByteString to write.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO SizeThe function returns the number of bytes actually written.

Perform a USB bulk write.

Exceptions:

Interrupt transfers
readInterruptSource
:: DeviceHandleA handle for the device to communicate with.
-> EndpointAddressThe address of a valid endpoint to communicate with. Because we are reading, make sure this is an In endpoint!!! If it isn't the behaviour is undefined.
-> SizeThe maximum number of bytes to read.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO ByteStringThe function returns the ByteString that was read. Note that the length of this ByteString <= the requested size to read.

Perform a USB interrupt read.

Exceptions:

writeInterruptSource
:: DeviceHandleA handle for the device to communicate with.
-> EndpointAddressThe address of a valid endpoint to communicate with. Because we are writing, make sure this is an Out endpoint!!! If it isn't the behaviour is undefined.
-> ByteStringThe ByteString to write.
-> TimeoutTimeout (in milliseconds) that this function should wait before giving up due to no response being received. For no timeout, use value 0.
-> IO SizeThe function returns the number of bytes actually written.

Perform a USB interrupt write.

Exceptions:

Produced by Haddock version 2.4.2