Logo Search packages:      
Sourcecode: nut version File versions  Download package

libusb.c File Reference


Detailed Description

HID Library - Generic USB communication sub driver (using libusb).

Author:
Copyright (C) 2003 - 2007 Arnaud Quette <aquette.dev@gmail.com> 2005 - 2007 Peter Selinger <selinger@users.sourceforge.net>
This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com

The logic of this file is ripped from mge-shut driver (also from Arnaud Quette), which is a "HID over serial link" UPS driver for Network UPS Tools <http://www.networkupstools.org/>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

--------------------------------------------------------------------------

Definition in file libusb.c.

#include "config.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <regex.h>
#include <usb.h>
#include "libusb.h"
#include "common.h"

Go to the source code of this file.

Classes

struct  regex_matcher_data_s

Defines

#define MAX_REPORT_SIZE   0x1800
#define usb_control_msg   typesafe_control_msg
#define USB_DRIVER_NAME   "USB communication driver"
#define USB_DRIVER_VERSION   "0.29"
#define USB_TIMEOUT   4000

Typedefs

typedef struct regex_matcher_data_s regex_matcher_data_t

Functions

static int compile_regex (regex_t **compiled, char *regex, int cflags)
static void libusb_close (usb_dev_handle *udev)
static int libusb_get_interrupt (usb_dev_handle *udev, unsigned char *buf, int bufsize, int timeout)
static int libusb_get_report (usb_dev_handle *udev, int ReportId, unsigned char *raw_buf, int ReportSize)
static int libusb_get_string (usb_dev_handle *udev, int StringIdx, char *buf, size_t buflen)
static int libusb_open (usb_dev_handle **udevp, USBDevice_t *curDevice, USBDeviceMatcher_t *matcher, int(*callback)(usb_dev_handle *udev, USBDevice_t *hd, unsigned char *rdbuf, int rdlen))
static int libusb_set_report (usb_dev_handle *udev, int ReportId, unsigned char *raw_buf, int ReportSize)
static int match_function_exact (USBDevice_t *hd, void *privdata)
static int match_function_regex (USBDevice_t *hd, void *privdata)
static int match_regex (regex_t *preg, char *str)
static int match_regex_hex (regex_t *preg, int n)
static int strcmp_null (char *s1, char *s2)
static int typesafe_control_msg (usb_dev_handle *dev, unsigned char requesttype, unsigned char request, int value, int index, unsigned char *bytes, unsigned size, int timeout)
void USBFreeExactMatcher (USBDeviceMatcher_t *matcher)
void USBFreeRegexMatcher (USBDeviceMatcher_t *matcher)
int USBNewExactMatcher (USBDeviceMatcher_t **matcher, USBDevice_t *hd)
int USBNewRegexMatcher (USBDeviceMatcher_t **matcher, char **regex, int cflags)

Variables

usb_communication_subdriver_t usb_subdriver


Generated by  Doxygen 1.6.0   Back to index