packages feed

bindings-libusb (empty) → 0.0.1

raw patch · 10 files changed

+2218/−0 lines, 10 filesdep +basedep +bindings-commonsetup-changed

Dependencies added: base, bindings-common

Files

+ LICENSE view
@@ -0,0 +1,29 @@+Copyright (c) <2009>, <Maurício C. Antunes>+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++    * Redistributions of source code must retain the above copyright+    notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above copyright+    notice, this list of conditions and the following disclaimer in the+    documentation and/or other materials provided with the distribution.++    * Neither the name of the author nor the names of contributors+    may be used to endorse or promote products derived from this+    software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,6 @@+#!/usr/bin/env runhaskell++module Main (main) where+import Distribution.Simple++main = defaultMain
+ bindings-libusb.cabal view
@@ -0,0 +1,33 @@+cabal-version: >= 1.2.3+name: bindings-libusb+homepage: http://bitbucket.org/mauricio/bindings+synopsis:+  Check bindings-common package for directions.+version: 0.0.1+license: BSD3+license-file: LICENSE+maintainer: Maurício C. Antunes+author: Maurício C. Antunes+build-type: Simple+category: FFI+library+  hs-source-dirs: src+  c-sources:+    src/constants.c+    src/functions.c+    src/types.c+  extensions:+    ForeignFunctionInterface+    TypeSynonymInstances+    ScopedTypeVariables+    EmptyDataDecls+    TypeFamilies+  build-depends: base, bindings-common+  exposed-modules:+    Bindings.Libusb+  pkgconfig-depends:+    libusb-1.0 >= 1.0.0+  other-modules:+    LibusbConstants+    LibusbFunctions+    LibusbTypes
+ src/Bindings/Libusb.hs view
@@ -0,0 +1,200 @@+module Bindings.Libusb (++    -- * Library initialization/deinitialization+    -- <http://libusb.sourceforge.net/api-1.0/group__lib.html>++    Libusb_context,+    libusb_set_debug,+    libusb_init,+    libusb_exit,++    -- * Device handling and enumeration+    -- <http://libusb.sourceforge.net/api-1.0/group__dev.html>++    Libusb_device,+    Libusb_device_handle,+    libusb_get_device_list,+    libusb_free_device_list,+    libusb_get_bus_number,+    libusb_get_device_address,+    libusb_get_max_packet_size,+    libusb_ref_device,+    libusb_unref_device,+    libusb_open,+    libusb_open_device_with_vid_pid,+    libusb_close,+    libusb_get_device,+    libusb_get_configuration,+    libusb_set_configuration,+    libusb_claim_interface,+    libusb_release_interface,+    libusb_clear_halt,+    libusb_reset_device,+    libusb_kernel_driver_active,+    libusb_attach_kernel_driver,++    -- * Miscellaneous+    -- <http://libusb.sourceforge.net/api-1.0/group__misc.html>++    libusb_cpu_to_le16,+    libusb_le16_to_cpu,+    Libusb_standard_request,+    _LIBUSB_REQUEST_GET_STATUS,+    _LIBUSB_REQUEST_CLEAR_FEATURE,+    _LIBUSB_REQUEST_SET_FEATURE,+    _LIBUSB_REQUEST_SET_ADDRESS,+    _LIBUSB_REQUEST_GET_DESCRIPTOR,+    _LIBUSB_REQUEST_SET_DESCRIPTOR,+    _LIBUSB_REQUEST_GET_CONFIGURATION,+    _LIBUSB_REQUEST_SET_CONFIGURATION,+    _LIBUSB_REQUEST_GET_INTERFACE,+    _LIBUSB_REQUEST_SET_INTERFACE,+    _LIBUSB_REQUEST_SYNCH_FRAME,+    Libusb_request_type,+    _LIBUSB_REQUEST_TYPE_STANDARD,+    _LIBUSB_REQUEST_TYPE_CLASS,+    _LIBUSB_REQUEST_TYPE_VENDOR,+    _LIBUSB_REQUEST_TYPE_RESERVED,+    Libusb_request_recipient,+    _LIBUSB_RECIPIENT_DEVICE,+    _LIBUSB_RECIPIENT_INTERFACE,+    _LIBUSB_RECIPIENT_ENDPOINT,+    _LIBUSB_RECIPIENT_OTHER,+    Libusb_error,+    _LIBUSB_SUCCESS,+    _LIBUSB_ERROR_IO,+    _LIBUSB_ERROR_INVALID_PARAM,+    _LIBUSB_ERROR_ACCESS,+    _LIBUSB_ERROR_NO_DEVICE,+    _LIBUSB_ERROR_NOT_FOUND,+    _LIBUSB_ERROR_BUSY,+    _LIBUSB_ERROR_TIMEOUT,+    _LIBUSB_ERROR_OVERFLOW,+    _LIBUSB_ERROR_PIPE,+    _LIBUSB_ERROR_INTERRUPTED,+    _LIBUSB_ERROR_NO_MEM,+    _LIBUSB_ERROR_NOT_SUPPORTED,+    _LIBUSB_ERROR_OTHER,++    -- * USB descriptors+    -- <http://libusb.sourceforge.net/api-1.0/group__desc.html>++    Libusb_device_descriptor,+    Libusb_endpoint_descriptor,+    Libusb_interface_descriptor,+    Libusb_interface,+    Libusb_config_descriptor,+    Libusb_class_code,+    _LIBUSB_CLASS_PER_INTERFACE,+    _LIBUSB_CLASS_AUDIO,+    _LIBUSB_CLASS_COMM,+    _LIBUSB_CLASS_HID,+    _LIBUSB_CLASS_PRINTER,+    _LIBUSB_CLASS_PTP,+    _LIBUSB_CLASS_MASS_STORAGE,+    _LIBUSB_CLASS_HUB,+    _LIBUSB_CLASS_DATA,+    _LIBUSB_CLASS_VENDOR_SPEC,+    Libusb_descriptor_type,+    _LIBUSB_DT_DEVICE,+    _LIBUSB_DT_CONFIG,+    _LIBUSB_DT_STRING,+    _LIBUSB_DT_INTERFACE,+    _LIBUSB_DT_ENDPOINT,+    _LIBUSB_DT_HID,+    _LIBUSB_DT_REPORT,+    _LIBUSB_DT_PHYSICAL,+    _LIBUSB_DT_HUB,+    Libusb_endpoint_direction,+    _LIBUSB_ENDPOINT_IN,+    _LIBUSB_ENDPOINT_OUT,+    Libusb_transfer_type,+    _LIBUSB_TRANSFER_TYPE_CONTROL,+    _LIBUSB_TRANSFER_TYPE_ISOCHRONOUS,+    _LIBUSB_TRANSFER_TYPE_BULK,+    _LIBUSB_TRANSFER_TYPE_INTERRUPT,+    Libusb_iso_sync_type,+    _LIBUSB_ISO_SYNC_TYPE_NONE,+    _LIBUSB_ISO_SYNC_TYPE_ASYNC,+    _LIBUSB_ISO_SYNC_TYPE_ADAPTIVE,+    _LIBUSB_ISO_SYNC_TYPE_SYNC,+    Libusb_iso_usage_type,+    _LIBUSB_ISO_USAGE_TYPE_DATA,+    _LIBUSB_ISO_USAGE_TYPE_FEEDBACK,+    _LIBUSB_ISO_USAGE_TYPE_IMPLICIT,+    libusb_get_device_descriptor,+    libusb_get_active_config_descriptor,+    libusb_get_config_descriptor,+    libusb_get_config_descriptor_by_value,+    libusb_free_config_descriptor,+    libusb_get_string_descriptor_ascii,+    libusb_get_descriptor,+    libusb_get_string_descriptor,++    -- * Asynchronous device I/O+    -- <http://libusb.sourceforge.net/api-1.0/group__asyncio.html>++    Libusb_control_setup,+    Libusb_iso_packet_descriptor,+    Libusb_transfer,+    Libusb_transfer_cb_fn,+    Libusb_transfer_status,+    _LIBUSB_TRANSFER_COMPLETED,+    _LIBUSB_TRANSFER_ERROR,+    _LIBUSB_TRANSFER_TIMED_OUT,+    _LIBUSB_TRANSFER_CANCELLED,+    _LIBUSB_TRANSFER_STALL,+    _LIBUSB_TRANSFER_NO_DEVICE,+    _LIBUSB_TRANSFER_OVERFLOW,+    Libusb_transfer_flags,+    _LIBUSB_TRANSFER_SHORT_NOT_OK,+    _LIBUSB_TRANSFER_FREE_BUFFER,+    _LIBUSB_TRANSFER_FREE_TRANSFER,+    libusb_alloc_transfer,+    libusb_free_transfer,+    libusb_submit_transfer,+    libusb_cancel_transfer,+    libusb_control_transfer_get_data,+    libusb_control_transfer_get_setup,+    libusb_fill_control_setup,+    libusb_fill_control_transfer,+    libusb_fill_bulk_transfer,+    libusb_fill_interrupt_transfer,+    libusb_fill_iso_transfer,+    libusb_set_iso_packet_lengths,+    libusb_get_iso_packet_buffer,+    libusb_get_iso_packet_buffer_simple,++    -- * Polling and timing+    -- <http://libusb.sourceforge.net/api-1.0/group__poll.html>++    Libusb_pollfd,+    Libusb_pollfd_added_cb,+    Libusb_pollfd_removed_cb,+    libusb_try_lock_events,+    libusb_lock_events,+    libusb_unlock_events,+    libusb_event_handling_ok,+    libusb_event_handler_active,+    libusb_lock_event_waiters,+    libusb_unlock_event_waiters,+    libusb_wait_for_event,+    libusb_handle_events_timeout,+    libusb_handle_events,+    libusb_handle_events_locked,+    libusb_get_next_timeout,+    libusb_set_pollfd_notifiers,+    libusb_get_pollfds,++    -- * Synchronous device I/O+    -- <http://libusb.sourceforge.net/api-1.0/group__syncio.html>++    libusb_interrupt_transfer,+    libusb_bulk_transfer,+    libusb_control_transfer++ ) where++import LibusbTypes+import LibusbFunctions+import LibusbConstants
+ src/LibusbConstants.hs view
@@ -0,0 +1,229 @@+module LibusbConstants where+import Foreign+import LibusbTypes++foreign import ccall "_LIBUSB_REQUEST_GET_STATUS"+ _LIBUSB_REQUEST_GET_STATUS :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_CLEAR_FEATURE"+ _LIBUSB_REQUEST_CLEAR_FEATURE :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SET_FEATURE"+ _LIBUSB_REQUEST_SET_FEATURE :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SET_ADDRESS"+ _LIBUSB_REQUEST_SET_ADDRESS :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_GET_DESCRIPTOR"+ _LIBUSB_REQUEST_GET_DESCRIPTOR :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SET_DESCRIPTOR"+ _LIBUSB_REQUEST_SET_DESCRIPTOR :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_GET_CONFIGURATION"+ _LIBUSB_REQUEST_GET_CONFIGURATION :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SET_CONFIGURATION"+ _LIBUSB_REQUEST_SET_CONFIGURATION :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_GET_INTERFACE"+ _LIBUSB_REQUEST_GET_INTERFACE :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SET_INTERFACE"+ _LIBUSB_REQUEST_SET_INTERFACE :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_SYNCH_FRAME"+ _LIBUSB_REQUEST_SYNCH_FRAME :: Libusb_standard_request++foreign import ccall "_LIBUSB_REQUEST_TYPE_STANDARD"+ _LIBUSB_REQUEST_TYPE_STANDARD :: Libusb_request_type++foreign import ccall "_LIBUSB_REQUEST_TYPE_CLASS"+ _LIBUSB_REQUEST_TYPE_CLASS :: Libusb_request_type++foreign import ccall "_LIBUSB_REQUEST_TYPE_VENDOR"+ _LIBUSB_REQUEST_TYPE_VENDOR :: Libusb_request_type++foreign import ccall "_LIBUSB_REQUEST_TYPE_RESERVED"+ _LIBUSB_REQUEST_TYPE_RESERVED :: Libusb_request_type++foreign import ccall "_LIBUSB_RECIPIENT_DEVICE"+ _LIBUSB_RECIPIENT_DEVICE :: Libusb_request_recipient++foreign import ccall "_LIBUSB_RECIPIENT_INTERFACE"+ _LIBUSB_RECIPIENT_INTERFACE :: Libusb_request_recipient++foreign import ccall "_LIBUSB_RECIPIENT_ENDPOINT"+ _LIBUSB_RECIPIENT_ENDPOINT :: Libusb_request_recipient++foreign import ccall "_LIBUSB_RECIPIENT_OTHER"+ _LIBUSB_RECIPIENT_OTHER :: Libusb_request_recipient++foreign import ccall "_LIBUSB_SUCCESS"+ _LIBUSB_SUCCESS :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_IO"+ _LIBUSB_ERROR_IO :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_INVALID_PARAM"+ _LIBUSB_ERROR_INVALID_PARAM :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_ACCESS"+ _LIBUSB_ERROR_ACCESS :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_NO_DEVICE"+ _LIBUSB_ERROR_NO_DEVICE :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_NOT_FOUND"+ _LIBUSB_ERROR_NOT_FOUND :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_BUSY"+ _LIBUSB_ERROR_BUSY :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_TIMEOUT"+ _LIBUSB_ERROR_TIMEOUT :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_OVERFLOW"+ _LIBUSB_ERROR_OVERFLOW :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_PIPE"+ _LIBUSB_ERROR_PIPE :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_INTERRUPTED"+ _LIBUSB_ERROR_INTERRUPTED :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_NO_MEM"+ _LIBUSB_ERROR_NO_MEM :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_NOT_SUPPORTED"+ _LIBUSB_ERROR_NOT_SUPPORTED :: Libusb_error++foreign import ccall "_LIBUSB_ERROR_OTHER"+ _LIBUSB_ERROR_OTHER :: Libusb_error++foreign import ccall "_LIBUSB_CLASS_PER_INTERFACE"+ _LIBUSB_CLASS_PER_INTERFACE :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_AUDIO"+ _LIBUSB_CLASS_AUDIO :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_COMM"+ _LIBUSB_CLASS_COMM :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_HID"+ _LIBUSB_CLASS_HID :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_PRINTER"+ _LIBUSB_CLASS_PRINTER :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_PTP"+ _LIBUSB_CLASS_PTP :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_MASS_STORAGE"+ _LIBUSB_CLASS_MASS_STORAGE :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_HUB"+ _LIBUSB_CLASS_HUB :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_DATA"+ _LIBUSB_CLASS_DATA :: Libusb_class_code++foreign import ccall "_LIBUSB_CLASS_VENDOR_SPEC"+ _LIBUSB_CLASS_VENDOR_SPEC :: Libusb_class_code++foreign import ccall "_LIBUSB_DT_DEVICE"+ _LIBUSB_DT_DEVICE :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_CONFIG"+ _LIBUSB_DT_CONFIG :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_STRING"+ _LIBUSB_DT_STRING :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_INTERFACE"+ _LIBUSB_DT_INTERFACE :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_ENDPOINT"+ _LIBUSB_DT_ENDPOINT :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_HID"+ _LIBUSB_DT_HID :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_REPORT"+ _LIBUSB_DT_REPORT :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_PHYSICAL"+ _LIBUSB_DT_PHYSICAL :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_DT_HUB"+ _LIBUSB_DT_HUB :: Libusb_descriptor_type++foreign import ccall "_LIBUSB_ENDPOINT_IN"+ _LIBUSB_ENDPOINT_IN :: Libusb_endpoint_direction++foreign import ccall "_LIBUSB_ENDPOINT_OUT"+ _LIBUSB_ENDPOINT_OUT :: Libusb_endpoint_direction++foreign import ccall "_LIBUSB_TRANSFER_TYPE_CONTROL"+ _LIBUSB_TRANSFER_TYPE_CONTROL :: Libusb_transfer_type++foreign import ccall "_LIBUSB_TRANSFER_TYPE_ISOCHRONOUS"+ _LIBUSB_TRANSFER_TYPE_ISOCHRONOUS :: Libusb_transfer_type++foreign import ccall "_LIBUSB_TRANSFER_TYPE_BULK"+ _LIBUSB_TRANSFER_TYPE_BULK :: Libusb_transfer_type++foreign import ccall "_LIBUSB_TRANSFER_TYPE_INTERRUPT"+ _LIBUSB_TRANSFER_TYPE_INTERRUPT :: Libusb_transfer_type++foreign import ccall "_LIBUSB_ISO_SYNC_TYPE_NONE"+ _LIBUSB_ISO_SYNC_TYPE_NONE :: Libusb_iso_sync_type++foreign import ccall "_LIBUSB_ISO_SYNC_TYPE_ASYNC"+ _LIBUSB_ISO_SYNC_TYPE_ASYNC :: Libusb_iso_sync_type++foreign import ccall "_LIBUSB_ISO_SYNC_TYPE_ADAPTIVE"+ _LIBUSB_ISO_SYNC_TYPE_ADAPTIVE :: Libusb_iso_sync_type++foreign import ccall "_LIBUSB_ISO_SYNC_TYPE_SYNC"+ _LIBUSB_ISO_SYNC_TYPE_SYNC :: Libusb_iso_sync_type++foreign import ccall "_LIBUSB_ISO_USAGE_TYPE_DATA"+ _LIBUSB_ISO_USAGE_TYPE_DATA :: Libusb_iso_usage_type++foreign import ccall "_LIBUSB_ISO_USAGE_TYPE_FEEDBACK"+ _LIBUSB_ISO_USAGE_TYPE_FEEDBACK :: Libusb_iso_usage_type++foreign import ccall "_LIBUSB_ISO_USAGE_TYPE_IMPLICIT"+ _LIBUSB_ISO_USAGE_TYPE_IMPLICIT :: Libusb_iso_usage_type++foreign import ccall "_LIBUSB_TRANSFER_COMPLETED"+ _LIBUSB_TRANSFER_COMPLETED :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_ERROR"+ _LIBUSB_TRANSFER_ERROR :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_TIMED_OUT"+ _LIBUSB_TRANSFER_TIMED_OUT :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_CANCELLED"+ _LIBUSB_TRANSFER_CANCELLED :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_STALL"+ _LIBUSB_TRANSFER_STALL :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_NO_DEVICE"+ _LIBUSB_TRANSFER_NO_DEVICE :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_OVERFLOW"+ _LIBUSB_TRANSFER_OVERFLOW :: Libusb_transfer_status++foreign import ccall "_LIBUSB_TRANSFER_SHORT_NOT_OK"+ _LIBUSB_TRANSFER_SHORT_NOT_OK :: Libusb_transfer_flags++foreign import ccall "_LIBUSB_TRANSFER_FREE_BUFFER"+ _LIBUSB_TRANSFER_FREE_BUFFER :: Libusb_transfer_flags++foreign import ccall "_LIBUSB_TRANSFER_FREE_TRANSFER"+ _LIBUSB_TRANSFER_FREE_TRANSFER :: Libusb_transfer_flags+
+ src/LibusbFunctions.hs view
@@ -0,0 +1,255 @@+module LibusbFunctions where+import Bindings.C+import Foreign+import Foreign.C+import LibusbTypes++foreign import ccall "libusb_set_debug" libusb_set_debug+    :: Ptr Libusb_context -> CInt -> IO () ; ++foreign import ccall "libusb_init" libusb_init+    :: Ptr (Ptr Libusb_context) -> IO CInt++foreign import ccall "libusb_exit" libusb_exit+    :: Ptr Libusb_context -> IO ()++foreign import ccall "libusb_get_device_list" libusb_get_device_list+    :: Ptr Libusb_context -> Ptr (Ptr Libusb_device) -> IO CInt++foreign import ccall "libusb_free_device_list" libusb_free_device_list+   :: Ptr (Ptr Libusb_device) -> CInt -> IO ()++foreign import ccall "libusb_get_bus_number" libusb_get_bus_number+    :: Ptr Libusb_device -> IO Word8++foreign import ccall "libusb_get_device_address"+ libusb_get_device_address+    :: Ptr libusb_device -> IO Word8++foreign import ccall "libusb_get_max_packet_size"+ libusb_get_max_packet_size+    :: Ptr Libusb_device -> CUChar -> IO CInt++foreign import ccall "libusb_ref_device" libusb_ref_device+    :: Ptr Libusb_device -> IO (Ptr Libusb_device)++foreign import ccall "libusb_unref_device" libusb_unref_device+    :: Ptr Libusb_device -> IO ()++foreign import ccall "libusb_open" libusb_open+    :: Ptr Libusb_device -> Ptr (Ptr Libusb_device_handle) -> IO CInt++foreign import ccall "libusb_open_device_with_vid_pid"+ libusb_open_device_with_vid_pid+    :: Ptr Libusb_context -> Word16 -> Word16 ->+       IO (Ptr Libusb_device_handle)++foreign import ccall "libusb_close" libusb_close+    :: Ptr Libusb_device_handle -> IO ()++foreign import ccall "libusb_get_device" libusb_get_device+    :: Ptr Libusb_device_handle -> IO (Ptr Libusb_device)++foreign import ccall "libusb_get_configuration"+ libusb_get_configuration+    :: Ptr Libusb_device_handle -> Ptr CInt -> IO CInt++foreign import ccall "libusb_set_configuration"+ libusb_set_configuration+    :: Ptr Libusb_device_handle -> CInt -> IO CInt++foreign import ccall "libusb_claim_interface" libusb_claim_interface+    :: Ptr Libusb_device_handle -> CInt -> IO CInt++foreign import ccall "libusb_release_interface"+ libusb_release_interface+    :: Ptr Libusb_device_handle -> CInt -> IO CInt++foreign import ccall "libusb_set_interface_alt_setting"+ libusb_set_interface_alt_setting+    :: Ptr Libusb_device_handle -> CInt -> CInt -> IO CInt++foreign import ccall "libusb_clear_halt" libusb_clear_halt+    :: Ptr Libusb_device_handle -> CUChar -> IO CInt++foreign import ccall "libusb_reset_device" libusb_reset_device+    :: Ptr Libusb_device_handle -> IO CInt++foreign import ccall "libusb_kernel_driver_active"+ libusb_kernel_driver_active+    :: Ptr Libusb_device_handle -> CInt   -> IO CInt++foreign import ccall "libusb_detach_kernel_driver"+ libusb_detach_kernel_driver+    :: Ptr Libusb_device_handle -> CInt -> IO CInt++foreign import ccall "libusb_attach_kernel_driver"+ libusb_attach_kernel_driver+    :: Ptr Libusb_device_handle -> CInt -> IO CInt++foreign import ccall "_libusb_cpu_to_le16" libusb_cpu_to_le16+    :: Word16 -> Word16++foreign import ccall "_libusb_le16_to_cpu" libusb_le16_to_cpu+    :: Word16 -> Word16++foreign import ccall "libusb_get_device_descriptor"+ libusb_get_device_descriptor+    :: Ptr Libusb_device -> Ptr Libusb_device_descriptor -> IO CInt++foreign import ccall "libusb_get_active_config_descriptor"+ libusb_get_active_config_descriptor+    :: Ptr Libusb_device -> Ptr+       (Ptr Libusb_config_descriptor) -> IO CInt++foreign import ccall "libusb_get_config_descriptor"+ libusb_get_config_descriptor+    :: Ptr Libusb_device -> Word8 -> Ptr+       (Ptr Libusb_config_descriptor) -> IO CInt++foreign import ccall "libusb_get_config_descriptor_by_value"+ libusb_get_config_descriptor_by_value+    :: Ptr Libusb_device -> Word8 -> Ptr (Ptr Libusb_config_descriptor) ->+       IO CInt++foreign import ccall "libusb_free_config_descriptor"+ libusb_free_config_descriptor+    :: Ptr Libusb_config_descriptor -> IO ()++foreign import ccall "libusb_get_string_descriptor_ascii"+ libusb_get_string_descriptor_ascii+    :: Ptr Libusb_device_handle -> Word8 -> Ptr CUChar -> CInt -> IO CInt++foreign import ccall "libusb_get_descriptor" libusb_get_descriptor+    :: Ptr Libusb_device_handle -> Word8 -> Word8 -> Ptr CUChar ->+       CInt -> IO CInt++foreign import ccall "libusb_get_string_descriptor"+ libusb_get_string_descriptor+    :: Ptr Libusb_device_handle -> Word8 ->+       Word16 -> Ptr CUChar -> CInt -> IO CInt++foreign import ccall "libusb_alloc_transfer" libusb_alloc_transfer+    :: CInt -> IO (Ptr (Libusb_transfer a))++foreign import ccall "libusb_free_transfer" libusb_free_transfer+    :: Ptr (Libusb_transfer a)++foreign import ccall "libusb_submit_transfer" libusb_submit_transfer+    :: Ptr (Libusb_transfer a) -> IO CInt++foreign import ccall "libusb_cancel_transfer" libusb_cancel_transfer+    :: Ptr (Libusb_transfer a) -> IO CInt++foreign import ccall "libusb_control_transfer_get_data"+ libusb_control_transfer_get_data+    :: Ptr (Libusb_transfer a) -> IO (Ptr CUChar)++foreign import ccall "libusb_control_transfer_get_setup"+ libusb_control_transfer_get_setup+    :: Ptr (Libusb_transfer a) -> IO (Ptr Libusb_control_setup)++foreign import ccall "libusb_fill_control_setup"+ libusb_fill_control_setup+    :: Ptr CUChar -> Word8 -> Word8 ->+       Word16 -> Word16 -> Word16 -> IO ()++foreign import ccall "libusb_fill_control_transfer"+ libusb_fill_control_transfer+    :: Ptr (Libusb_transfer a) -> Ptr Libusb_device_handle ->+       Ptr CUChar -> FunPtr (Libusb_transfer_cb_fn a) ->+       Ptr a -> CUInt -> IO ()++foreign import ccall "libusb_fill_bulk_transfer"+ libusb_fill_bulk_transfer+    :: Ptr (Libusb_transfer a) -> Ptr Libusb_device_handle -> CUChar ->+       Ptr CUChar -> CInt -> FunPtr (Libusb_transfer_cb_fn a) ->+       Ptr a -> CUInt -> IO ()++foreign import ccall "libusb_fill_interrupt_transfer"+ libusb_fill_interrupt_transfer+    :: Ptr (Libusb_transfer a) -> Ptr Libusb_device_handle -> CUChar -> +       Ptr CUChar -> CInt -> FunPtr (Libusb_transfer_cb_fn a) -> +       Ptr a -> CUInt -> IO ()++foreign import ccall "libusb_fill_iso_transfer"+ libusb_fill_iso_transfer+    :: Ptr (Libusb_transfer a) -> Ptr Libusb_device_handle -> CUChar ->+       Ptr CUChar -> CInt -> CInt -> FunPtr (Libusb_transfer_cb_fn a) ->+       Ptr a -> CUInt -> IO ()++foreign import ccall "libusb_set_iso_packet_lengths"+ libusb_set_iso_packet_lengths+    :: Ptr (Libusb_transfer a) -> CUInt -> IO ()++foreign import ccall "libusb_get_iso_packet_buffer"+ libusb_get_iso_packet_buffer+    :: Ptr (Libusb_transfer a) -> CUInt -> IO (Ptr CUChar)++foreign import ccall "libusb_get_iso_packet_buffer_simple"+ libusb_get_iso_packet_buffer_simple+    :: Ptr (Libusb_transfer a) -> CUInt -> IO (Ptr CUChar)++foreign import ccall "libusb_try_lock_events" libusb_try_lock_events+    :: Ptr Libusb_context -> IO CInt++foreign import ccall "libusb_lock_events" libusb_lock_events+    :: Ptr Libusb_context -> IO ()++foreign import ccall "libusb_unlock_events" libusb_unlock_events+    :: Ptr Libusb_context -> IO ()++foreign import ccall "libusb_event_handling_ok"+ libusb_event_handling_ok+    :: Ptr Libusb_context -> IO CInt++foreign import ccall "libusb_event_handler_active"+ libusb_event_handler_active+    :: Ptr Libusb_context -> IO CInt++foreign import ccall "libusb_lock_event_waiters"+ libusb_lock_event_waiters+    :: Ptr Libusb_context -> IO ()++foreign import ccall "libusb_unlock_event_waiters"+ libusb_unlock_event_waiters+    :: Ptr Libusb_context -> IO ()++foreign import ccall "libusb_wait_for_event" libusb_wait_for_event+    :: Ptr Libusb_context -> Ptr Timeval -> IO CInt++foreign import ccall "libusb_handle_events_timeout"+ libusb_handle_events_timeout+    :: Ptr Libusb_context -> Ptr Timeval -> IO CInt++foreign import ccall "libusb_handle_events" libusb_handle_events+    :: Ptr Libusb_context -> IO CInt++foreign import ccall "libusb_handle_events_locked"+ libusb_handle_events_locked+    :: Ptr Libusb_context -> Ptr Timeval -> IO CInt++foreign import ccall "libusb_get_next_timeout" libusb_get_next_timeout+   :: Ptr Libusb_context -> Ptr Timeval -> IO CInt++foreign import ccall "libusb_set_pollfd_notifiers"+ libusb_set_pollfd_notifiers+    :: Ptr Libusb_context -> Libusb_pollfd_added_cb a ->+       Libusb_pollfd_removed_cb a -> Ptr a -> IO ()++foreign import ccall "libusb_get_pollfds" libusb_get_pollfds+    :: Ptr Libusb_context -> IO (Ptr (Ptr Libusb_pollfd)) ;++foreign import ccall "libusb_interrupt_transfer"+ libusb_interrupt_transfer+    :: Ptr Libusb_device_handle -> CUChar -> Ptr CUChar ->+       CInt -> Ptr CInt -> CUInt -> IO CInt++foreign import ccall "libusb_bulk_transfer" libusb_bulk_transfer+    :: Ptr Libusb_device_handle -> CUChar -> Ptr CUChar -> CInt ->+       Ptr CInt -> CUInt -> IO CInt++foreign import ccall "libusb_control_transfer" libusb_control_transfer+   :: Ptr Libusb_device_handle -> Word8 -> Word8 -> Word16 -> Word16 ->+      Ptr CUChar -> Word16 -> CUInt -> IO CInt+
+ src/LibusbTypes.hs view
@@ -0,0 +1,651 @@+module LibusbTypes where+import Bindings.Utilities+import Foreign+import Foreign.C++data Libusb_context++data Libusb_device++data Libusb_device_handle++type Libusb_standard_request = Word8++type Libusb_request_type = Word8++type Libusb_request_recipient = Word8++type Libusb_error = CInt++type Libusb_descriptor_type = Word8++data Libusb_device_descriptor = Libusb_device_descriptor {+    libusb_device_descriptor'bLength,+    libusb_device_descriptor'bDescriptorType :: Word8,+    libusb_device_descriptor'bcdUSB :: Word16,+    libusb_device_descriptor'bDeviceClass,+    libusb_device_descriptor'bDeviceSubClass,+    libusb_device_descriptor'bDeviceProtocol,+    libusb_device_descriptor'bMaxPacketSize0 :: Word8,+    libusb_device_descriptor'idVendor,+    libusb_device_descriptor'idProduct,+    libusb_device_descriptor'bcdDevice :: Word16,+    libusb_device_descriptor'iManufacturer,+    libusb_device_descriptor'iProduct,+    libusb_device_descriptor'iSerialNumber,+    libusb_device_descriptor'bNumConfigurations :: Word8 }++instance Storable Libusb_device_descriptor where+    sizeOf _ = fromIntegral size_of_libusb_device_descriptor++    alignment = sizeOf++    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->+        with 0 $ \p6 ->+        with 0 $ \p7 ->+        with 0 $ \p8 ->+        with 0 $ \p9 ->+        with 0 $ \p10 ->+        with 0 $ \p11 ->+        with 0 $ \p12 ->+        with 0 $ \p13 ->+        with 0 $ \p14 ->++        c2hs_libusb_device_descriptor p p1 p2 p3 p4 p5 p6 p7 p8+            p9 p10 p11 p12 p13 p14 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->+        peek p6 >>= \v6 ->+        peek p7 >>= \v7 ->+        peek p8 >>= \v8 ->+        peek p9 >>= \v9 ->+        peek p10 >>= \v10 ->+        peek p11 >>= \v11 ->+        peek p12 >>= \v12 ->+        peek p13 >>= \v13 ->+        peek p14 >>= \v14 ->++        return $ Libusb_device_descriptor v1 v2 v3 v4 v5 v6 v7 v8+               v9 v10 v11 v12 v13 v14++    poke p v = hs2c_libusb_device_descriptor p+        (libusb_device_descriptor'bLength v)+        (libusb_device_descriptor'bDescriptorType v)+        (libusb_device_descriptor'bcdUSB v)+        (libusb_device_descriptor'bDeviceClass v)+        (libusb_device_descriptor'bDeviceSubClass v)+        (libusb_device_descriptor'bDeviceProtocol v)+        (libusb_device_descriptor'bMaxPacketSize0 v)+        (libusb_device_descriptor'idVendor v)+        (libusb_device_descriptor'idProduct v)+        (libusb_device_descriptor'bcdDevice v)+        (libusb_device_descriptor'iManufacturer v)+        (libusb_device_descriptor'iProduct v)+        (libusb_device_descriptor'iSerialNumber v)+        (libusb_device_descriptor'bNumConfigurations v)++data Libusb_endpoint_descriptor = Libusb_endpoint_descriptor {+    libusb_endpoint_descriptor'bLength  ,+    libusb_endpoint_descriptor'bDescriptorType  ,+    libusb_endpoint_descriptor'bEndpointAddress  ,+    libusb_endpoint_descriptor'bmAttributes :: Word8 ,+    libusb_endpoint_descriptor'wMaxPacketSize :: Word16 ,+    libusb_endpoint_descriptor'bInterval  ,+    libusb_endpoint_descriptor'bRefresh  ,+    libusb_endpoint_descriptor'bSynchAddress :: Word8 ,+    libusb_endpoint_descriptor'extra :: Ptr CUChar ,+    libusb_endpoint_descriptor'extra_length :: CInt }++instance Storable Libusb_endpoint_descriptor where+    sizeOf _ = fromIntegral size_of_libusb_endpoint_descriptor++    alignment = sizeOf++    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->+        with 0 $ \p6 ->+        with 0 $ \p7 ->+        with 0 $ \p8 ->+        with nullPtr $ \p9 ->+        with 0 $ \p10 ->++        c2hs_libusb_endpoint_descriptor p p1 p2 p3 p4 p5 p6+            p7 p8 p9 p10 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->+        peek p6 >>= \v6 ->+        peek p7 >>= \v7 ->+        peek p8 >>= \v8 ->+        peek p9 >>= \v9 ->+        peek p10 >>= \v10 ->++        return $ Libusb_endpoint_descriptor+            v1 v2 v3 v4 v5 v6 v7 v8 v9 v10++    poke p v = hs2c_libusb_endpoint_descriptor p+        (libusb_endpoint_descriptor'bLength v)+        (libusb_endpoint_descriptor'bDescriptorType v)+        (libusb_endpoint_descriptor'bEndpointAddress v)+        (libusb_endpoint_descriptor'bmAttributes v)+        (libusb_endpoint_descriptor'wMaxPacketSize v)+        (libusb_endpoint_descriptor'bInterval v)+        (libusb_endpoint_descriptor'bRefresh v)+        (libusb_endpoint_descriptor'bSynchAddress v)+        (libusb_endpoint_descriptor'extra v)+        (libusb_endpoint_descriptor'extra_length v)++data Libusb_interface_descriptor = Libusb_interface_descriptor {+    libusb_interface_descriptor'bLength,+    libusb_interface_descriptor'bDescriptorType,+    libusb_interface_descriptor'bInterfaceNumber,+    libusb_interface_descriptor'bAlternateSetting,+    libusb_interface_descriptor'bNumEndpoints,+    libusb_interface_descriptor'bInterfaceClass,+    libusb_interface_descriptor'bInterfaceSubClass,+    libusb_interface_descriptor'bInterfaceProtocol,+    libusb_interface_descriptor'iInterface+        :: Word8,+    libusb_interface_descriptor'endpoint+        :: Ptr Libusb_endpoint_descriptor,+    libusb_interface_descriptor'extra+        :: Ptr CUChar,+    libusb_interface_descriptor'extra_length+        :: CInt }++instance Storable Libusb_interface_descriptor where+    sizeOf _ = fromIntegral size_of_libusb_interface_descriptor++    alignment = sizeOf++    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->+        with 0 $ \p6 ->+        with 0 $ \p7 ->+        with 0 $ \p8 ->+        with 0 $ \p9 ->+        with nullPtr $ \p10 ->+        with nullPtr $ \p11 ->+        with 0 $ \p12 ->++        c2hs_libusb_interface_descriptor p p1 p2 p3 p4 p5+            p6 p7 p8 p9 p10 p11 p12 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->+        peek p6 >>= \v6 ->+        peek p7 >>= \v7 ->+        peek p8 >>= \v8 ->+        peek p9 >>= \v9 ->+        peek p10 >>= \v10 ->+        peek p11 >>= \v11 ->+        peek p12 >>= \v12 ->++        return $ Libusb_interface_descriptor+            v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12++    poke p v = hs2c_libusb_interface_descriptor p +        (libusb_interface_descriptor'bLength v)+        (libusb_interface_descriptor'bDescriptorType v)+        (libusb_interface_descriptor'bInterfaceNumber v)+        (libusb_interface_descriptor'bAlternateSetting v)+        (libusb_interface_descriptor'bNumEndpoints v)+        (libusb_interface_descriptor'bInterfaceClass v)+        (libusb_interface_descriptor'bInterfaceSubClass v)+        (libusb_interface_descriptor'bInterfaceProtocol v)+        (libusb_interface_descriptor'iInterface v)+        (libusb_interface_descriptor'endpoint v)+        (libusb_interface_descriptor'extra v)+        (libusb_interface_descriptor'extra_length v)+    +data Libusb_interface = Libusb_interface {+    libusb_interface'altsetting :: Ptr Libusb_interface_descriptor,+    libusb_interface'num_altsetting :: CInt }++instance Storable Libusb_interface where+    sizeOf _ = fromIntegral size_of_libusb_interface++    alignment = sizeOf++    peek p =+        with nullPtr $ \p1 -> +        with 0 $ \p2 ->++        c2hs_libusb_interface p p1 p2 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->++        return $ Libusb_interface v1 v2++    poke p v = hs2c_libusb_interface p+        (libusb_interface'altsetting v)+        (libusb_interface'num_altsetting v)++data Libusb_config_descriptor = Libusb_config_descriptor {+    libusb_config_descriptor'bLength  ,+    libusb_config_descriptor'bDescriptorType :: Word8 ,+    libusb_config_descriptor'wTotalLength :: Word16 ,+    libusb_config_descriptor'bNumInterfaces  ,+    libusb_config_descriptor'bConfigurationValue  ,+    libusb_config_descriptor'iConfiguration  ,+    libusb_config_descriptor'bmAttributes  ,+    libusb_config_descriptor'maxPower :: Word8 ,+    libusb_config_descriptor'interface :: Ptr Libusb_interface ,+    libusb_config_descriptor'extra :: Ptr CUChar ,+    libusb_config_descriptor'extra_length :: CInt }++instance Storable Libusb_config_descriptor where+    sizeOf _ = fromIntegral size_of_libusb_config_descriptor++    alignment = sizeOf++    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->+        with 0 $ \p6 ->+        with 0 $ \p7 ->+        with 0 $ \p8 ->+        with nullPtr $ \p9 ->+        with nullPtr $ \p10 ->+        with 0 $ \p11 ->++        c2hs_libusb_config_descriptor p p1 p2 p3 p4 p5 p6 p7+            p8 p9 p10 p11 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->+        peek p6 >>= \v6 ->+        peek p7 >>= \v7 ->+        peek p8 >>= \v8 ->+        peek p9 >>= \v9 ->+        peek p10 >>= \v10 ->+        peek p11 >>= \v11 ->++        return $ Libusb_config_descriptor+            v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11++    poke p v = hs2c_libusb_config_descriptor p+        (libusb_config_descriptor'bLength v)+        (libusb_config_descriptor'bDescriptorType v)+        (libusb_config_descriptor'wTotalLength v)+        (libusb_config_descriptor'bNumInterfaces v)+        (libusb_config_descriptor'bConfigurationValue v)+        (libusb_config_descriptor'iConfiguration v)+        (libusb_config_descriptor'bmAttributes v)+        (libusb_config_descriptor'maxPower v)+        (libusb_config_descriptor'interface v)+        (libusb_config_descriptor'extra v)+        (libusb_config_descriptor'extra_length v)++type Libusb_class_code = Word8++type Libusb_endpoint_direction = Word8++type Libusb_transfer_type = Word8++type Libusb_iso_sync_type = Word8++type Libusb_iso_usage_type = Word8++data Libusb_control_setup = Libusb_control_setup {+    libusb_control_setup'bmRequestType  ,+    libusb_control_setup'bRequest :: Word8 ,+    libusb_control_setup'wValue  ,+    libusb_control_setup'wIndex  ,+    libusb_control_setup'wLength :: Word16 }++instance Storable Libusb_control_setup where+    sizeOf _ = fromIntegral size_of_libusb_control_setup++    alignment = sizeOf++    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->++        c2hs_libusb_control_setup p p1 p2 p3 p4 p5 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->++        return $ Libusb_control_setup v1 v2 v3 v4 v5++    poke p v = hs2c_libusb_control_setup p+        (libusb_control_setup'bmRequestType v)+        (libusb_control_setup'bRequest v)+        (libusb_control_setup'wValue v)+        (libusb_control_setup'wIndex v)+        (libusb_control_setup'wLength v)++data Libusb_iso_packet_descriptor = Libusb_iso_packet_descriptor {+    libusb_iso_packet_descriptor'length  ,+    libusb_iso_packet_descriptor'actual_length :: CUInt ,+    libusb_iso_packet_descriptor'status :: Libusb_transfer_status }++instance Storable Libusb_iso_packet_descriptor where+    sizeOf _ = fromIntegral size_of_libusb_iso_packet_descriptor+    alignment = sizeOf+    peek p =+        with 0 $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->++        c2hs_libusb_iso_packet_descriptor p p1 p2 p3 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->++        return $ Libusb_iso_packet_descriptor v1 v2 v3++    poke p v = hs2c_libusb_iso_packet_descriptor p+        (libusb_iso_packet_descriptor'length v)+        (libusb_iso_packet_descriptor'actual_length v)+        (libusb_iso_packet_descriptor'status v)++data Libusb_transfer a = Libusb_transfer {+        libusb_transfer'dev_handle :: Ptr Libusb_device_handle ,+        libusb_transfer'flags :: Word8 ,+        libusb_transfer'endpoint  ,+        libusb_transfer'type :: CUChar ,+        libusb_transfer'timeout :: CUInt ,+        libusb_transfer'status :: Libusb_transfer_status ,+        libusb_transfer'length  ,+        libusb_transfer'actual_length :: CInt ,+        libusb_transfer'callback :: Libusb_transfer_cb_fn a,+        libusb_transfer'user_data :: Ptr a ,+        libusb_transfer'buffer :: Ptr CUChar ,+        libusb_transfer'num_iso_packets :: CInt ,+        libusb_transfer'iso_packet_desc :: () }++instance Storable (Libusb_transfer a) where+    sizeOf _ = fromIntegral size_of_libusb_transfer++    alignment = sizeOf++    peek p =+        with nullPtr $ \p1 ->+        with 0 $ \p2 ->+        with 0 $ \p3 ->+        with 0 $ \p4 ->+        with 0 $ \p5 ->+        with 0 $ \p6 ->+        with 0 $ \p7 ->+        with 0 $ \p8 ->+        with nullCallback $ \p9 ->+        with nullPtr $ \p10 ->+        with nullPtr $ \p11 ->+        with 0 $ \p12 ->++        c2hs_libusb_transfer p p1 p2 p3 p4 p5 p6 p7 p8 p9+            p10 p11 p12 >>++        peek p1 >>= \v1 ->+        peek p2 >>= \v2 ->+        peek p3 >>= \v3 ->+        peek p4 >>= \v4 ->+        peek p5 >>= \v5 ->+        peek p6 >>= \v6 ->+        peek p7 >>= \v7 ->+        peek p8 >>= \v8 ->+        peek p9 >>= \v9 ->+        peek p10 >>= \v10 ->+        peek p11 >>= \v11 ->+        peek p12 >>= \v12 ->++        return $ Libusb_transfer+            v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 ()++    poke p v = hs2c_libusb_transfer p+        (libusb_transfer'dev_handle v)+        (libusb_transfer'flags v)+        (libusb_transfer'endpoint v)+        (libusb_transfer'type v)+        (libusb_transfer'timeout v)+        (libusb_transfer'status v)+        (libusb_transfer'length v)+        (libusb_transfer'actual_length v)+        (libusb_transfer'callback v)+        (libusb_transfer'user_data v)+        (libusb_transfer'buffer v)+        (libusb_transfer'num_iso_packets v)++newtype Libusb_transfer_cb_fn a = Libusb_transfer_cb_fn+    (FunPtr ((Ptr (Libusb_transfer a)) -> IO ()))++instance Storable (Libusb_transfer_cb_fn a) where+    sizeOf _ = sizeOf (undefined :: FunPtr ())+    alignment = sizeOf+    peek p = (peek $ castPtr p) >>= (return . Libusb_transfer_cb_fn)+    poke p (Libusb_transfer_cb_fn v) = poke (castPtr p) v++instance Callback (Libusb_transfer_cb_fn a) where+    type F (Libusb_transfer_cb_fn a) = Ptr (Libusb_transfer a) -> IO ()+    nullCallback = Libusb_transfer_cb_fn nullFunPtr+    makeCallback f = mkCbTransfer f >>= (return . Libusb_transfer_cb_fn)+    freeCallback (Libusb_transfer_cb_fn f) = freeHaskellFunPtr f++type Libusb_transfer_status = CInt++type Libusb_transfer_flags = Word8++data Libusb_pollfd = Libusb_pollfd {+        pollfd'fd :: CInt ,+        pollfd'events :: CShort }++instance Storable Libusb_pollfd where+    sizeOf _ = fromIntegral size_of_libusb_pollfd+    alignment = sizeOf++    peek p = with 0 $ \p1 -> with 0 $ \p2 ->+        c2hs_libusb_pollfd p p1 p2 >>+        peek p1 >>= \v1 -> peek p2 >>= \v2 ->+        return Libusb_pollfd {pollfd'fd = v1, pollfd'events = v2}++    poke p v = hs2c_libusb_pollfd p+        (pollfd'fd v)+        (pollfd'events v)++newtype Libusb_pollfd_added_cb a = Libusb_pollfd_added_cb (FunPtr (CInt ->+    CShort -> Ptr a -> IO ()))++instance Storable (Libusb_pollfd_added_cb a) where+    sizeOf _ = sizeOf (undefined :: FunPtr ())+    alignment = sizeOf+    peek p = (peek $ castPtr p) >>= (return . Libusb_pollfd_added_cb)+    poke p (Libusb_pollfd_added_cb v) = poke (castPtr p) v++instance Callback (Libusb_pollfd_added_cb a) where+    type F (Libusb_pollfd_added_cb a) = CInt -> CShort -> Ptr a -> IO ()+    nullCallback = Libusb_pollfd_added_cb nullFunPtr+    makeCallback f = mkCbAdded f >>= (return . Libusb_pollfd_added_cb)+    freeCallback (Libusb_pollfd_added_cb f) = freeHaskellFunPtr f++newtype Libusb_pollfd_removed_cb a = Libusb_pollfd_removed_cb (FunPtr+    (CInt -> Ptr a -> IO ()))++instance Storable (Libusb_pollfd_removed_cb a) where+    sizeOf _ = sizeOf (undefined :: FunPtr ())+    alignment = sizeOf+    peek p = (peek $ castPtr p) >>= (return . Libusb_pollfd_removed_cb)+    poke p (Libusb_pollfd_removed_cb v) = poke (castPtr p) v++instance Callback (Libusb_pollfd_removed_cb a) where+    type F (Libusb_pollfd_removed_cb a) = CInt -> Ptr a -> IO ()+    nullCallback = Libusb_pollfd_removed_cb nullFunPtr+    makeCallback f = mkCbRemoved f >>= (return . Libusb_pollfd_removed_cb)+    freeCallback (Libusb_pollfd_removed_cb f) = freeHaskellFunPtr f++type Cb1 a = Ptr a -> IO ()+type Cb2 a = CInt -> CShort -> Ptr a -> IO ()+type Cb3 a = CInt -> Ptr a -> IO ()++foreign import ccall "wrapper" mkCbTransfer+    :: Cb1 a -> IO (FunPtr (Cb1 a))++foreign import ccall "wrapper" mkCbAdded+    :: Cb2 a -> IO (FunPtr (Cb2 a))++foreign import ccall "wrapper" mkCbRemoved+    :: Cb3 a -> IO (FunPtr (Cb3 a))++foreign import ccall "size_of_libusb_device_descriptor"+ size_of_libusb_device_descriptor+    :: CInt++foreign import ccall "size_of_libusb_endpoint_descriptor"+ size_of_libusb_endpoint_descriptor+    :: CInt++foreign import ccall "size_of_libusb_interface_descriptor"+ size_of_libusb_interface_descriptor+    :: CInt++foreign import ccall "size_of_libusb_interface"+ size_of_libusb_interface+    :: CInt++foreign import ccall "size_of_libusb_config_descriptor"+ size_of_libusb_config_descriptor+    :: CInt++foreign import ccall "size_of_libusb_control_setup"+ size_of_libusb_control_setup+    :: CInt++foreign import ccall "size_of_libusb_iso_packet_descriptor"+ size_of_libusb_iso_packet_descriptor+    :: CInt++foreign import ccall "size_of_libusb_transfer"+ size_of_libusb_transfer+    :: CInt++foreign import ccall "size_of_libusb_pollfd"+ size_of_libusb_pollfd+    :: CInt++foreign import ccall "hs2c_libusb_device_descriptor"+ hs2c_libusb_device_descriptor+    :: Ptr a -> Word8 -> Word8 -> Word16 -> Word8 -> Word8 ->+       Word8 -> Word8 -> Word16 -> Word16 -> Word16 -> Word8 ->+       Word8 -> Word8 -> Word8 -> IO ()++foreign import ccall "hs2c_libusb_endpoint_descriptor"+ hs2c_libusb_endpoint_descriptor+  :: Ptr a -> Word8 -> Word8 -> Word8 -> Word8 -> Word16 -> Word8 ->+     Word8 -> Word8 -> Ptr CUChar -> CInt -> IO ()++foreign import ccall "hs2c_libusb_interface_descriptor"+ hs2c_libusb_interface_descriptor+    :: Ptr a -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 ->+       Word8 -> Word8 -> Word8 -> Word8 -> Ptr b ->+       Ptr CUChar -> CInt -> IO ()++foreign import ccall "hs2c_libusb_interface" hs2c_libusb_interface+    :: Ptr a -> Ptr b -> CInt -> IO ()++foreign import ccall "hs2c_libusb_config_descriptor"+ hs2c_libusb_config_descriptor+    :: Ptr a -> Word8 -> Word8 -> Word16 -> Word8 -> Word8 -> Word8 ->+       Word8 -> Word8 -> Ptr b -> Ptr CUChar -> CInt -> IO ()++foreign import ccall "hs2c_libusb_control_setup"+ hs2c_libusb_control_setup+    :: Ptr a -> Word8 -> Word8 -> Word16 -> Word16 -> Word16 -> IO ()++foreign import ccall "hs2c_libusb_iso_packet_descriptor"+ hs2c_libusb_iso_packet_descriptor+    :: Ptr a -> CUInt -> CUInt -> CInt -> IO ()++foreign import ccall "hs2c_libusb_transfer" hs2c_libusb_transfer+    :: Ptr a -> Ptr b -> Word8 -> CUChar -> CUChar -> CUInt ->+       CInt -> CInt -> CInt -> Libusb_transfer_cb_fn c ->+       Ptr d -> Ptr CUChar -> CInt -> IO ()++foreign import ccall "hs2c_libusb_pollfd" hs2c_libusb_pollfd+    :: Ptr a -> CInt -> CShort -> IO ()++foreign import ccall "c2hs_libusb_device_descriptor"+ c2hs_libusb_device_descriptor+    :: Ptr a -> Ptr Word8 -> Ptr Word8 -> Ptr Word16 -> Ptr Word8 ->+       Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word16 ->+       Ptr Word16 -> Ptr Word16 -> Ptr Word8 -> Ptr Word8 ->+       Ptr Word8 -> Ptr Word8 -> IO ()++foreign import ccall "c2hs_libusb_endpoint_descriptor"+ c2hs_libusb_endpoint_descriptor+    :: Ptr a -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 ->+       Ptr Word16 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 ->+       Ptr (Ptr CUChar) -> Ptr CInt -> IO ()++foreign import ccall "c2hs_libusb_interface_descriptor"+ c2hs_libusb_interface_descriptor+    :: Ptr a -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 ->+       Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 ->+       Ptr (Ptr b) -> Ptr (Ptr CUChar) -> Ptr CInt -> IO ()++foreign import ccall "c2hs_libusb_interface" c2hs_libusb_interface+    ::+ Ptr a -> Ptr (Ptr b) -> Ptr CInt -> IO ()++foreign import ccall "c2hs_libusb_config_descriptor"+ c2hs_libusb_config_descriptor+    :: Ptr a -> Ptr Word8 -> Ptr Word8 -> Ptr Word16 ->+       Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 ->+       Ptr Word8 -> Ptr (Ptr b) -> Ptr (Ptr CUChar) ->+       Ptr CInt -> IO ()++foreign import ccall "c2hs_libusb_control_setup"+ c2hs_libusb_control_setup+    :: Ptr a -> Ptr Word8 -> Ptr Word8 -> Ptr Word16 ->+       Ptr Word16 -> Ptr Word16 -> IO ()++foreign import ccall "c2hs_libusb_iso_packet_descriptor"+ c2hs_libusb_iso_packet_descriptor+    :: Ptr a -> Ptr CUInt -> Ptr CUInt -> Ptr CInt -> IO ()++foreign import ccall "c2hs_libusb_transfer" c2hs_libusb_transfer+    :: Ptr a -> Ptr (Ptr b) -> Ptr Word8 -> Ptr CUChar ->+       Ptr CUChar -> Ptr CUInt -> Ptr CInt -> Ptr CInt -> Ptr CInt ->+       Ptr (Libusb_transfer_cb_fn c) -> Ptr (Ptr d) ->+       Ptr (Ptr CUChar) -> Ptr CInt ->   IO ()++foreign import ccall "c2hs_libusb_pollfd" c2hs_libusb_pollfd+    :: Ptr a -> Ptr CInt -> Ptr CShort -> IO ()
+ src/constants.c view
@@ -0,0 +1,377 @@+#include <libusb.h>++uint8_t _LIBUSB_REQUEST_GET_STATUS (void)+{+    return LIBUSB_REQUEST_GET_STATUS;+}++uint8_t _LIBUSB_REQUEST_CLEAR_FEATURE (void)+{+    return LIBUSB_REQUEST_CLEAR_FEATURE;+}++uint8_t _LIBUSB_REQUEST_SET_FEATURE (void)+{+    return LIBUSB_REQUEST_SET_FEATURE;+}++uint8_t _LIBUSB_REQUEST_SET_ADDRESS (void)+{+    return LIBUSB_REQUEST_SET_ADDRESS;+}++uint8_t _LIBUSB_REQUEST_GET_DESCRIPTOR (void)+{+    return LIBUSB_REQUEST_GET_DESCRIPTOR;+}++uint8_t _LIBUSB_REQUEST_SET_DESCRIPTOR (void)+{+    return LIBUSB_REQUEST_SET_DESCRIPTOR;+}++uint8_t _LIBUSB_REQUEST_GET_CONFIGURATION (void)+{+    return LIBUSB_REQUEST_GET_CONFIGURATION;+}++uint8_t _LIBUSB_REQUEST_SET_CONFIGURATION (void)+{+    return LIBUSB_REQUEST_SET_CONFIGURATION;+}++uint8_t _LIBUSB_REQUEST_GET_INTERFACE (void)+{+    return LIBUSB_REQUEST_GET_INTERFACE;+}++uint8_t _LIBUSB_REQUEST_SET_INTERFACE (void)+{+    return LIBUSB_REQUEST_SET_INTERFACE;+}++uint8_t _LIBUSB_REQUEST_SYNCH_FRAME (void)+{+    return LIBUSB_REQUEST_SYNCH_FRAME;+}++uint8_t _LIBUSB_REQUEST_TYPE_STANDARD (void)+{+    return LIBUSB_REQUEST_TYPE_STANDARD;+}++uint8_t _LIBUSB_REQUEST_TYPE_CLASS (void)+{+    return LIBUSB_REQUEST_TYPE_CLASS;+}++uint8_t _LIBUSB_REQUEST_TYPE_VENDOR (void)+{+    return LIBUSB_REQUEST_TYPE_VENDOR;+}++uint8_t _LIBUSB_REQUEST_TYPE_RESERVED (void)+{+    return LIBUSB_REQUEST_TYPE_RESERVED;+}++uint8_t _LIBUSB_RECIPIENT_DEVICE (void)+{+    return LIBUSB_RECIPIENT_DEVICE;+}++uint8_t _LIBUSB_RECIPIENT_INTERFACE (void)+{+    return LIBUSB_RECIPIENT_INTERFACE;+}++uint8_t _LIBUSB_RECIPIENT_ENDPOINT (void)+{+    return LIBUSB_RECIPIENT_ENDPOINT;+}++uint8_t _LIBUSB_RECIPIENT_OTHER (void)+{+    return LIBUSB_RECIPIENT_OTHER;+}++int _LIBUSB_SUCCESS (void)+{+    return LIBUSB_SUCCESS;+}++int _LIBUSB_ERROR_IO (void)+{+    return LIBUSB_ERROR_IO;+}++int _LIBUSB_ERROR_INVALID_PARAM (void)+{+    return LIBUSB_ERROR_INVALID_PARAM;+}++int _LIBUSB_ERROR_ACCESS (void)+{+    return LIBUSB_ERROR_ACCESS;+}++int _LIBUSB_ERROR_NO_DEVICE (void)+{+    return LIBUSB_ERROR_NO_DEVICE;+}++int _LIBUSB_ERROR_NOT_FOUND (void)+{+    return LIBUSB_ERROR_NOT_FOUND;+}++int _LIBUSB_ERROR_BUSY (void)+{+    return LIBUSB_ERROR_BUSY;+}++int _LIBUSB_ERROR_TIMEOUT (void)+{+    return LIBUSB_ERROR_TIMEOUT;+}++int _LIBUSB_ERROR_OVERFLOW (void)+{+    return LIBUSB_ERROR_OVERFLOW;+}++int _LIBUSB_ERROR_PIPE (void)+{+    return LIBUSB_ERROR_PIPE;+}++int _LIBUSB_ERROR_INTERRUPTED (void)+{+    return LIBUSB_ERROR_INTERRUPTED;+}++int _LIBUSB_ERROR_NO_MEM (void)+{+    return LIBUSB_ERROR_NO_MEM;+}++int _LIBUSB_ERROR_NOT_SUPPORTED (void)+{+    return LIBUSB_ERROR_NOT_SUPPORTED;+}++int _LIBUSB_ERROR_OTHER (void)+{+    return LIBUSB_ERROR_OTHER;+}++uint8_t _LIBUSB_CLASS_PER_INTERFACE (void)+{+    return LIBUSB_CLASS_PER_INTERFACE;+}++uint8_t _LIBUSB_CLASS_AUDIO (void)+{+    return LIBUSB_CLASS_AUDIO;+}++uint8_t _LIBUSB_CLASS_COMM (void)+{+    return LIBUSB_CLASS_COMM;+}++uint8_t _LIBUSB_CLASS_HID (void)+{+    return LIBUSB_CLASS_HID;+}++uint8_t _LIBUSB_CLASS_PRINTER (void)+{+    return LIBUSB_CLASS_PRINTER;+}++uint8_t _LIBUSB_CLASS_PTP (void)+{+    return LIBUSB_CLASS_PTP;+}++uint8_t _LIBUSB_CLASS_MASS_STORAGE (void)+{+    return LIBUSB_CLASS_MASS_STORAGE;+}++uint8_t _LIBUSB_CLASS_HUB (void)+{+    return LIBUSB_CLASS_HUB;+}++uint8_t _LIBUSB_CLASS_DATA (void)+{+    return LIBUSB_CLASS_DATA;+}++uint8_t _LIBUSB_CLASS_VENDOR_SPEC (void)+{+    return LIBUSB_CLASS_VENDOR_SPEC;+}++uint8_t _LIBUSB_DT_DEVICE (void)+{+    return LIBUSB_DT_DEVICE;+}++uint8_t _LIBUSB_DT_CONFIG (void)+{+    return LIBUSB_DT_CONFIG;+}++uint8_t _LIBUSB_DT_STRING (void)+{+    return LIBUSB_DT_STRING;+}++uint8_t _LIBUSB_DT_INTERFACE (void)+{+    return LIBUSB_DT_INTERFACE;+}++uint8_t _LIBUSB_DT_ENDPOINT (void)+{+    return LIBUSB_DT_ENDPOINT;+}++uint8_t _LIBUSB_DT_HID (void)+{+    return LIBUSB_DT_HID;+}++uint8_t _LIBUSB_DT_REPORT (void)+{+    return LIBUSB_DT_REPORT;+}++uint8_t _LIBUSB_DT_PHYSICAL (void)+{+    return LIBUSB_DT_PHYSICAL;+}++uint8_t _LIBUSB_DT_HUB (void)+{+    return LIBUSB_DT_HUB;+}++uint8_t _LIBUSB_ENDPOINT_IN (void)+{+    return LIBUSB_ENDPOINT_IN;+}++uint8_t _LIBUSB_ENDPOINT_OUT (void)+{+    return LIBUSB_ENDPOINT_OUT;+}++uint8_t _LIBUSB_TRANSFER_TYPE_CONTROL (void)+{+    return LIBUSB_TRANSFER_TYPE_CONTROL;+}++uint8_t _LIBUSB_TRANSFER_TYPE_ISOCHRONOUS (void)+{+    return LIBUSB_TRANSFER_TYPE_ISOCHRONOUS;+}++uint8_t _LIBUSB_TRANSFER_TYPE_BULK (void)+{+    return LIBUSB_TRANSFER_TYPE_BULK;+}++uint8_t _LIBUSB_TRANSFER_TYPE_INTERRUPT (void)+{+    return LIBUSB_TRANSFER_TYPE_INTERRUPT;+}++uint8_t _LIBUSB_ISO_SYNC_TYPE_NONE (void)+{+    return LIBUSB_ISO_SYNC_TYPE_NONE;+}++uint8_t _LIBUSB_ISO_SYNC_TYPE_ASYNC (void)+{+    return LIBUSB_ISO_SYNC_TYPE_ASYNC;+}++uint8_t _LIBUSB_ISO_SYNC_TYPE_ADAPTIVE (void)+{+    return LIBUSB_ISO_SYNC_TYPE_ADAPTIVE;+}++uint8_t _LIBUSB_ISO_SYNC_TYPE_SYNC (void)+{+    return LIBUSB_ISO_SYNC_TYPE_SYNC;+}++uint8_t _LIBUSB_ISO_USAGE_TYPE_DATA (void)+{+    return LIBUSB_ISO_USAGE_TYPE_DATA;+}++uint8_t _LIBUSB_ISO_USAGE_TYPE_FEEDBACK (void)+{+    return LIBUSB_ISO_USAGE_TYPE_FEEDBACK;+}++uint8_t _LIBUSB_ISO_USAGE_TYPE_IMPLICIT (void)+{+    return LIBUSB_ISO_USAGE_TYPE_IMPLICIT;+}++int _LIBUSB_TRANSFER_COMPLETED (void)+{+    return LIBUSB_TRANSFER_COMPLETED;+}++int _LIBUSB_TRANSFER_ERROR (void)+{+    return LIBUSB_TRANSFER_ERROR;+}++int _LIBUSB_TRANSFER_TIMED_OUT (void)+{+    return LIBUSB_TRANSFER_TIMED_OUT;+}++int _LIBUSB_TRANSFER_CANCELLED (void)+{+    return LIBUSB_TRANSFER_CANCELLED;+}++int _LIBUSB_TRANSFER_STALL (void)+{+    return LIBUSB_TRANSFER_STALL;+}++int _LIBUSB_TRANSFER_NO_DEVICE (void)+{+    return LIBUSB_TRANSFER_NO_DEVICE;+}++int _LIBUSB_TRANSFER_OVERFLOW (void)+{+    return LIBUSB_TRANSFER_OVERFLOW;+}++uint8_t _LIBUSB_TRANSFER_SHORT_NOT_OK (void)+{+    return LIBUSB_TRANSFER_SHORT_NOT_OK;+}++uint8_t _LIBUSB_TRANSFER_FREE_BUFFER (void)+{+    return LIBUSB_TRANSFER_FREE_BUFFER;+}++uint8_t _LIBUSB_TRANSFER_FREE_TRANSFER (void)+{+    return LIBUSB_TRANSFER_FREE_TRANSFER;+}+
+ src/functions.c view
@@ -0,0 +1,11 @@+#include <libusb.h>++uint16_t _libusb_cpu_to_le16 (uint16_t x)+{+    return libusb_cpu_to_le16 (x);+}++uint16_t _libusb_le16_to_cpu (uint16_t x)+{+    return libusb_le16_to_cpu (x);+}
+ src/types.c view
@@ -0,0 +1,427 @@+#include <libusb.h>++/*+  Sizes of structs we are going to+  use in 'sizeOf' method of Storable instances.+*/++int size_of_libusb_device_descriptor (void)+{+    return sizeof (struct libusb_device_descriptor);+}++int size_of_libusb_endpoint_descriptor (void)+{+    return sizeof (struct libusb_endpoint_descriptor);+}++int size_of_libusb_interface_descriptor (void)+{+    return sizeof (struct libusb_interface_descriptor);+}++int size_of_libusb_interface (void)+{+    return sizeof (struct libusb_interface);+}++int size_of_libusb_config_descriptor (void)+{+    return sizeof (struct libusb_config_descriptor);+}++int size_of_libusb_control_setup (void)+{+    return sizeof (struct libusb_control_setup);+}++int size_of_libusb_iso_packet_descriptor (void)+{+    return sizeof (struct libusb_iso_packet_descriptor);+}++int size_of_libusb_transfer (void)+{+    return sizeof (struct libusb_transfer);+}++int size_of_libusb_pollfd (void)+{+    return sizeof (struct libusb_pollfd);+}++/*+  Functions that fill a C struct+  after received parameters. They will+  be used in 'poke' method of Storable+  instances.+*/++void hs2c_libusb_device_descriptor (struct libusb_device_descriptor *p,+    uint8_t p1,+    uint8_t p2,+    uint16_t p3,+    uint8_t p4,+    uint8_t p5,+    uint8_t p6,+    uint8_t p7,+    uint16_t p8,+    uint16_t p9,+    uint16_t p10,+    uint8_t p11,+    uint8_t p12,+    uint8_t p13,+    uint8_t p14)+{+    p->bLength = p1;+    p->bDescriptorType = p2;+    p->bcdUSB = p3;+    p->bDeviceClass = p4;+    p->bDeviceSubClass = p5;+    p->bDeviceProtocol = p6;+    p->bMaxPacketSize0 = p7;+    p->idVendor = p8;+    p->idProduct = p9;+    p->bcdDevice = p10;+    p->iManufacturer = p11;+    p->iProduct = p12;+    p->iSerialNumber = p13;+    p->bNumConfigurations = p14;+}++void hs2c_libusb_endpoint_descriptor (struct libusb_endpoint_descriptor *p,+    uint8_t p1,+    uint8_t p2,+    uint8_t p3,+    uint8_t p4,+    uint16_t p5,+    uint8_t p6,+    uint8_t p7,+    uint8_t p8,+    const unsigned char *p9,+    int p10)+{+    p->bLength = p1;+    p->bDescriptorType = p2;+    p->bEndpointAddress = p3;+    p->bmAttributes = p4;+    p->wMaxPacketSize = p5;+    p->bInterval = p6;+    p->bRefresh = p7;+    p->bSynchAddress = p8;+    p->extra = p9;+    p->extra_length = p10;+}++void hs2c_libusb_interface_descriptor (struct libusb_interface_descriptor *p,+    uint8_t p1,+    uint8_t p2,+    uint8_t p3,+    uint8_t p4,+    uint8_t p5,+    uint8_t p6,+    uint8_t p7,+    uint8_t p8,+    uint8_t p9,+    struct libusb_endpoint_descriptor *p10,+    const unsigned char *p11,+    int p12)+{+    p->bLength = p1;+    p->bDescriptorType = p2;+    p->bInterfaceNumber = p3;+    p->bAlternateSetting = p4;+    p->bNumEndpoints = p5;+    p->bInterfaceClass = p6;+    p->bInterfaceSubClass = p7;+    p->bInterfaceProtocol = p8;+    p->iInterface = p9;+    p->endpoint = p10;+    p->extra = p11;+    p->extra_length = p12;+}++void hs2c_libusb_interface (struct libusb_interface *p,+    struct libusb_interface_descriptor *p1,+    int p2)+{+    p->altsetting = p1;+    p->num_altsetting = p2;+}++void hs2c_libusb_config_descriptor (struct libusb_config_descriptor *p,+    uint8_t p1,+    uint8_t p2,+    uint16_t p3,+    uint8_t p4,+    uint8_t p5,+    uint8_t p6,+    uint8_t p7,+    uint8_t p8,+    struct libusb_interface *p9,+    const unsigned char *p10,+    int p11)+{+    p->bLength = p1;+    p->bDescriptorType = p2;+    p->wTotalLength = p3;+    p->bNumInterfaces = p4;+    p->bConfigurationValue = p5;+    p->iConfiguration = p6;+    p->bmAttributes = p7;+    p->MaxPower = p8;+    p->interface = p9;+    p->extra = p10;+    p->extra_length = p11;+}++void hs2c_libusb_control_setup (+struct libusb_control_setup *p,+    uint8_t p1,+    uint8_t p2,+    uint16_t p3,+    uint16_t p4,+    uint16_t p5)+{+    p->bmRequestType = p1;+    p->bRequest = p2;+    p->wValue = p3;+    p->wIndex = p4;+    p->wLength = p5;+}++void hs2c_libusb_iso_packet_descriptor (+struct libusb_iso_packet_descriptor *p,+    unsigned int p1,+    unsigned int p2,+    enum libusb_transfer_status p3)+{+    p->length = p1;+    p->actual_length = p2;+    p->status = p3;+}++void hs2c_libusb_transfer (struct libusb_transfer *p,+    libusb_device_handle *p1,+    uint8_t p2,+    unsigned char p3,+    unsigned char p4,+    unsigned int p5,+    enum libusb_transfer_status p6,+    int p7,+    int p8,+    libusb_transfer_cb_fn p9,+    void *p10,+    unsigned char *p11,+    int p12)+{+    p->dev_handle = p1;+    p->flags = p2;+    p->endpoint = p3;+    p->type = p4;+    p->timeout = p5;+    p->status = p6;+    p->length = p7;+    p->actual_length = p8;+    p->callback = p9;+    p->user_data = p10;+    p->buffer = p11;+    p->num_iso_packets = p12;+}++void hs2c_libusb_pollfd (struct libusb_pollfd *p,+    int p1,+    short p2)+{+    p->fd = p1;+    p->events = p2;+}++/*+  Functions that read the values of+  a C struct into pointers. They will+  be used at 'peek' method of Storable+  instances.+*/++void c2hs_libusb_device_descriptor (struct libusb_device_descriptor *p,+    uint8_t *p1,+    uint8_t *p2,+    uint16_t *p3,+    uint8_t *p4,+    uint8_t *p5,+    uint8_t *p6,+    uint8_t *p7,+    uint16_t *p8,+    uint16_t *p9,+    uint16_t *p10,+    uint8_t *p11,+    uint8_t *p12,+    uint8_t *p13,+    uint8_t *p14)+{+    *p1 = p->bLength;+    *p2 = p->bDescriptorType;+    *p3 = p->bcdUSB;+    *p4 = p->bDeviceClass;+    *p5 = p->bDeviceSubClass;+    *p6 = p->bDeviceProtocol;+    *p7 = p->bMaxPacketSize0;+    *p8 = p->idVendor;+    *p9 = p->idProduct;+    *p10 = p->bcdDevice;+    *p11 = p->iManufacturer;+    *p12 = p->iProduct;+    *p13 = p->iSerialNumber;+    *p14 = p->bNumConfigurations;+}++void c2hs_libusb_endpoint_descriptor (+struct libusb_endpoint_descriptor *p,+    uint8_t *p1,+    uint8_t *p2,+    uint8_t *p3,+    uint8_t *p4,+    uint16_t *p5,+    uint8_t *p6,+    uint8_t *p7,+    uint8_t *p8,+    const unsigned char **p9,+    int *p10)+{+    *p1 = p->bLength;+    *p2 = p->bDescriptorType;+    *p3 = p->bEndpointAddress;+    *p4 = p->bmAttributes;+    *p5 = p->wMaxPacketSize;+    *p6 = p->bInterval;+    *p7 = p->bRefresh;+    *p8 = p->bSynchAddress;+    *p9 = p->extra;+    *p10 = p->extra_length;+}++void c2hs_libusb_interface_descriptor (+struct libusb_interface_descriptor *p,+    uint8_t *p1,+    uint8_t *p2,+    uint8_t *p3,+    uint8_t *p4,+    uint8_t *p5,+    uint8_t *p6,+    uint8_t *p7,+    uint8_t *p8,+    uint8_t *p9,+    const struct libusb_endpoint_descriptor **p10,+    const unsigned char **p11,+    int *p12)+{+    *p1 = p->bLength;+    *p2 = p->bDescriptorType;+    *p3 = p->bInterfaceNumber;+    *p4 = p->bAlternateSetting;+    *p5 = p->bNumEndpoints;+    *p6 = p->bInterfaceClass;+    *p7 = p->bInterfaceSubClass;+    *p8 = p->bInterfaceProtocol;+    *p9 = p->iInterface;+    *p10 = p->endpoint;+    *p11 = p->extra;+    *p12 = p->extra_length;+}++void c2hs_libusb_interface (struct libusb_interface *p,+    const struct libusb_interface_descriptor **p1,+    int *p2)+{+    *p1 = p->altsetting;+    *p2 = p->num_altsetting;+}++void c2hs_libusb_config_descriptor (struct libusb_config_descriptor *p,+    uint8_t *p1,+    uint8_t *p2,+    uint16_t *p3,+    uint8_t *p4,+    uint8_t *p5,+    uint8_t *p6,+    uint8_t *p7,+    uint8_t *p8,+    const struct libusb_interface **p9,+    const unsigned char **p10,+    int *p11)+{+    *p1 = p->bLength;+    *p2 = p->bDescriptorType;+    *p3 = p->wTotalLength;+    *p4 = p->bNumInterfaces;+    *p5 = p->bConfigurationValue;+    *p6 = p->iConfiguration;+    *p7 = p->bmAttributes;+    *p8 = p->MaxPower;+    *p9 = p->interface;+    *p10 = p->extra;+    *p11 = p->extra_length;+}++void c2hs_libusb_control_setup (struct libusb_control_setup *p,+    uint8_t *p1,+    uint8_t *p2,+    uint16_t *p3,+    uint16_t *p4,+    uint16_t *p5)+{+    *p1 = p->bmRequestType;+    *p2 = p->bRequest;+    *p3 = p->wValue;+    *p4 = p->wIndex;+    *p5 = p->wLength;+}++void c2hs_libusb_iso_packet_descriptor (+struct libusb_iso_packet_descriptor *p,+    unsigned int *p1,+    unsigned int *p2,+    enum libusb_transfer_status *p3)+{+    *p1 = p->length;+    *p2 = p->actual_length;+    *p3 = p->status;+}++void c2hs_libusb_transfer (struct libusb_transfer *p,+    libusb_device_handle **p1,+    uint8_t *p2,+    unsigned char *p3,+    unsigned char *p4,+    unsigned int *p5,+    enum libusb_transfer_status *p6,+    int *p7,+    int *p8,+    libusb_transfer_cb_fn *p9,+    void **p10,+    unsigned char **p11,+    int *p12)+{+    *p1 = p->dev_handle;+    *p2 = p->flags;+    *p3 = p->endpoint;+    *p4 = p->type;+    *p5 = p->timeout;+    *p6 = p->status;+    *p7 = p->length;+    *p8 = p->actual_length;+    *p9 = p->callback;+    *p10 = p->user_data;+    *p11 = p->buffer;+    *p12 = p->num_iso_packets;+}++void c2hs_libusb_pollfd (struct libusb_pollfd *p,+    int *p1,+    short *p2)+{+    *p1 = p->fd;+    *p2 = p->events;+}+