资源简介
libusb is a library for USB device access from Linux userspace.
代码片段和文件信息
/*
* (Free|Open|Net)BSD USB support
*
* Derived from Linux version by Richard Tobin.
*
* $Id: bsd.cv 1.33 2006/03/04 01:16:10 jerdfelt Exp $
* $Name: $
*
* This library is covered by the LGPL read LICENSE for details.
*/
/*
* Note: I don‘t have a clue what I‘m doing. I just looked at the
* man pages and source to try and find things that did the same as
* the Linux version. -- Richard
*
* johnjen@reynoldsnet.org - minor fixes with debug mode output. Consistent brace
* use as well as indenting. More error messages put in to test for failure
* modes with /dev/ permissions (when it happens). Note: I like Richard have
* no clue what I‘m doing. Patches to increase/fix functionality happily
* accepted!
*/
/* dirkx@webweaving.org - minor changes to make things actually work
* for both read and write.
*/
#if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
#define __FreeBSD_kernel__ __FreeBSD__
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “usbi.h“
#ifdef HAVE_CONFIG_H
#include “config.h“
#endif
#ifdef HAVE_OLD_DEV_USB_USB_H
/*
* It appears some of the BSD‘s (OpenBSD atleast) have switched over to a
* new naming convention so we setup some macro‘s for backward
* compability with older versions --jerdfelt
*/
/* struct usb_ctl_request */
#define ucr_addr addr
#define ucr_request request
#define ucr_data data
#define ucr_flags flags
#define ucr_actlen actlen
/* struct usb_alt_interface */
#define uai_config_index config_index
#define uai_interface_index interface_index
#define uai_alt_no alt_no
/* struct usb_config_desc */
#define ucd_config_index config_index
#define ucd_desc desc
/* struct usb_interface_desc */
#define uid_config_index config_index
#define uid_interface_index interface_index
#define uid_alt_index alt_index
#define uid_desc desc
/* struct usb_endpoint_desc */
#define ued_config_index config_index
#define ued_interface_index interface_index
#define ued_alt_index alt_index
#define ued_endpoint_index endpoint_index
#define ued_desc desc
/* struct usb_full_desc */
#define ufd_config_index config_index
#define ufd_size size
#define ufd_data data
/* struct usb_string_desc */
#define usd_string_index string_index
#define usd_language_id language_id
#define usd_desc desc
/* struct usb_ctl_report_desc */
#define ucrd_size size
#define ucrd_data data
/* struct usb_device_info */
#define udi_bus bus
#define udi_addr addr
#define udi_cookie cookie
#define udi_product product
#define udi_vendor vendor
#define udi_release release
#define udi_productNo productNo
#define udi_vendorNo vendorNo
#define udi_releaseNo releaseNo
#define udi_class class
#define udi_subclass subclass
#define udi_protocol protocol
#define udi_config config
#define udi_lowspeed lowspeed
#define udi_power power
#define udi_
评论
共有 条评论