亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sync.c

?? 最新的libusb庫
?? C
字號:
/* * Synchronous I/O functions for libusb * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */#include <config.h>#include <errno.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include "libusbi.h"/** * @defgroup syncio Synchronous device I/O * * This page documents libusb's synchronous (blocking) API for USB device I/O. * This interface is easy to use but has some limitations. More advanced users * may wish to consider using the \ref asyncio "asynchronous I/O API" instead. */static void ctrl_transfer_cb(struct libusb_transfer *transfer){	int *completed = transfer->user_data;	*completed = 1;	usbi_dbg("actual_length=%d", transfer->actual_length);	/* caller interprets result and frees transfer */}/** \ingroup syncio * Perform a USB control transfer. * * The direction of the transfer is inferred from the bmRequestType field of * the setup packet. * * The wValue, wIndex and wLength fields values should be given in host-endian * byte order. * * \param dev_handle a handle for the device to communicate with * \param bmRequestType the request type field for the setup packet * \param bRequest the request field for the setup packet * \param wValue the value field for the setup packet * \param wIndex the index field for the setup packet * \param data a suitably-sized data buffer for either input or output * (depending on direction bits within bmRequestType) * \param wLength the length field for the setup packet. The data buffer should * be at least this size. * \param timeout timeout (in millseconds) that this function should wait * before giving up due to no response being received. For no timeout, use * value 0. * \returns on success, the number of bytes actually transferred * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out * \returns LIBUSB_ERROR_PIPE if the control request was not supported by the * device * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected * \returns another LIBUSB_ERROR code on other failures */API_EXPORTED int libusb_control_transfer(libusb_device_handle *dev_handle,	uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,	unsigned char *data, uint16_t wLength, unsigned int timeout){	struct libusb_transfer *transfer = libusb_alloc_transfer(0);	unsigned char *buffer;	int completed = 0;	int r;	if (!transfer)		return LIBUSB_ERROR_NO_MEM;		buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);	if (!buffer) {		libusb_free_transfer(transfer);		return LIBUSB_ERROR_NO_MEM;	}	libusb_fill_control_setup(buffer, bmRequestType, bRequest, wValue, wIndex,		wLength);	if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_OUT)		memcpy(buffer + LIBUSB_CONTROL_SETUP_SIZE, data, wLength);	libusb_fill_control_transfer(transfer, dev_handle, buffer,		ctrl_transfer_cb, &completed, timeout);	transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;	r = libusb_submit_transfer(transfer);	if (r < 0) {		libusb_free_transfer(transfer);		return r;	}	while (!completed) {		r = libusb_handle_events(HANDLE_CTX(dev_handle));		if (r < 0) {			libusb_cancel_transfer(transfer);			while (!completed)				if (libusb_handle_events(HANDLE_CTX(dev_handle)) < 0)					break;			libusb_free_transfer(transfer);			return r;		}	}	if ((bmRequestType & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)		memcpy(data, libusb_control_transfer_get_data(transfer),			transfer->actual_length);	switch (transfer->status) {	case LIBUSB_TRANSFER_COMPLETED:		r = transfer->actual_length;		break;	case LIBUSB_TRANSFER_TIMED_OUT:		r = LIBUSB_ERROR_TIMEOUT;		break;	case LIBUSB_TRANSFER_STALL:		r = LIBUSB_ERROR_PIPE;		break;	case LIBUSB_TRANSFER_NO_DEVICE:		r = LIBUSB_ERROR_NO_DEVICE;		break;	default:		usbi_warn(HANDLE_CTX(dev_handle),			"unrecognised status code %d", transfer->status);		r = LIBUSB_ERROR_OTHER;	}	libusb_free_transfer(transfer);	return r;}static void bulk_transfer_cb(struct libusb_transfer *transfer){	int *completed = transfer->user_data;	*completed = 1;	usbi_dbg("actual_length=%d", transfer->actual_length);	/* caller interprets results and frees transfer */}static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,	unsigned char endpoint, unsigned char *buffer, int length,	int *transferred, unsigned int timeout, unsigned char type){	struct libusb_transfer *transfer = libusb_alloc_transfer(0);	int completed = 0;	int r;	if (!transfer)		return LIBUSB_ERROR_NO_MEM;	libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,		bulk_transfer_cb, &completed, timeout);	transfer->type = type;	r = libusb_submit_transfer(transfer);	if (r < 0) {		libusb_free_transfer(transfer);		return r;	}	while (!completed) {		r = libusb_handle_events(HANDLE_CTX(dev_handle));		if (r < 0) {			libusb_cancel_transfer(transfer);			while (!completed)				if (libusb_handle_events(HANDLE_CTX(dev_handle)) < 0)					break;			libusb_free_transfer(transfer);			return r;		}	}	*transferred = transfer->actual_length;	switch (transfer->status) {	case LIBUSB_TRANSFER_COMPLETED:		r = 0;		break;	case LIBUSB_TRANSFER_TIMED_OUT:		r = LIBUSB_ERROR_TIMEOUT;		break;	case LIBUSB_TRANSFER_STALL:		r = LIBUSB_ERROR_PIPE;		break;	case LIBUSB_TRANSFER_OVERFLOW:		r = LIBUSB_ERROR_OVERFLOW;		break;	case LIBUSB_TRANSFER_NO_DEVICE:		r = LIBUSB_ERROR_NO_DEVICE;		break;	default:		usbi_warn(HANDLE_CTX(dev_handle),			"unrecognised status code %d", transfer->status);		r = LIBUSB_ERROR_OTHER;	}	libusb_free_transfer(transfer);	return r;}/** \ingroup syncio * Perform a USB bulk transfer. The direction of the transfer is inferred from * the direction bits of the endpoint address. * * For bulk reads, the <tt>length</tt> field indicates the maximum length of * data you are expecting to receive. If less data arrives than expected, * this function will return that data, so be sure to check the * <tt>transferred</tt> output parameter. * * You should also check the <tt>transferred</tt> parameter for bulk writes. * Not all of the data may have been written. * * Also check <tt>transferred</tt> when dealing with a timeout error code. * libusb may have to split your transfer into a number of chunks to satisfy * underlying O/S requirements, meaning that the timeout may expire after * the first few chunks have completed. libusb is careful not to lose any data * that may have been transferred; do not assume that timeout conditions * indicate a complete lack of I/O. * * \param dev_handle a handle for the device to communicate with * \param endpoint the address of a valid endpoint to communicate with * \param data a suitably-sized data buffer for either input or output * (depending on endpoint) * \param length for bulk writes, the number of bytes from data to be sent. for * bulk reads, the maximum number of bytes to receive into the data buffer. * \param transferred output location for the number of bytes actually * transferred. * \param timeout timeout (in millseconds) that this function should wait * before giving up due to no response being received. For no timeout, use * value 0. * * \returns 0 on success (and populates <tt>transferred</tt>) * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates * <tt>transferred</tt>) * \returns LIBUSB_ERROR_PIPE if the endpoint halted * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see * \ref packetoverflow * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected * \returns another LIBUSB_ERROR code on other failures */API_EXPORTED int libusb_bulk_transfer(struct libusb_device_handle *dev_handle,	unsigned char endpoint, unsigned char *data, int length, int *transferred,	unsigned int timeout){	return do_sync_bulk_transfer(dev_handle, endpoint, data, length,		transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK);}/** \ingroup syncio * Perform a USB interrupt transfer. The direction of the transfer is inferred * from the direction bits of the endpoint address. * * For interrupt reads, the <tt>length</tt> field indicates the maximum length * of data you are expecting to receive. If less data arrives than expected, * this function will return that data, so be sure to check the * <tt>transferred</tt> output parameter. * * You should also check the <tt>transferred</tt> parameter for interrupt * writes. Not all of the data may have been written. * * Also check <tt>transferred</tt> when dealing with a timeout error code. * libusb may have to split your transfer into a number of chunks to satisfy * underlying O/S requirements, meaning that the timeout may expire after * the first few chunks have completed. libusb is careful not to lose any data * that may have been transferred; do not assume that timeout conditions * indicate a complete lack of I/O. * * The default endpoint bInterval value is used as the polling interval. * * \param dev_handle a handle for the device to communicate with * \param endpoint the address of a valid endpoint to communicate with * \param data a suitably-sized data buffer for either input or output * (depending on endpoint) * \param length for bulk writes, the number of bytes from data to be sent. for * bulk reads, the maximum number of bytes to receive into the data buffer. * \param transferred output location for the number of bytes actually * transferred. * \param timeout timeout (in millseconds) that this function should wait * before giving up due to no response being received. For no timeout, use * value 0. * * \returns 0 on success (and populates <tt>transferred</tt>) * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out * \returns LIBUSB_ERROR_PIPE if the endpoint halted * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see * \ref packetoverflow * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected * \returns another LIBUSB_ERROR code on other error */API_EXPORTED int libusb_interrupt_transfer(	struct libusb_device_handle *dev_handle, unsigned char endpoint,	unsigned char *data, int length, int *transferred, unsigned int timeout){	return do_sync_bulk_transfer(dev_handle, endpoint, data, length,		transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人免费视频| 激情综合网天天干| 欧美久久久一区| 亚洲444eee在线观看| 欧美精品在线视频| 久久国产综合精品| 久久精品一二三| 成人h精品动漫一区二区三区| 国产精品九色蝌蚪自拍| 92国产精品观看| 亚洲一区二区三区四区不卡| 欧美日韩dvd在线观看| 麻豆久久一区二区| 国产免费久久精品| 在线看国产一区| 日韩av一级电影| 欧美激情在线免费观看| 在线国产电影不卡| 久久精品国产亚洲5555| 国产欧美一区二区三区网站| 91美女视频网站| 日韩有码一区二区三区| 久久网站热最新地址| 91麻豆免费看片| 免费成人深夜小野草| 国产精品毛片高清在线完整版| 欧美性生活久久| 激情小说欧美图片| 亚洲乱码精品一二三四区日韩在线 | 亚洲一二三区视频在线观看| 日韩欧美亚洲一区二区| 97久久久精品综合88久久| 全国精品久久少妇| 欧美激情一区二区三区全黄| 欧美日韩国产片| youjizz久久| 免费人成黄页网站在线一区二区| 久久九九99视频| 欧美日韩国产经典色站一区二区三区| 久色婷婷小香蕉久久| 综合欧美亚洲日本| 欧美大片在线观看| 欧美视频日韩视频在线观看| 国产精品乡下勾搭老头1| 亚洲国产精品一区二区久久| 久久久久国产免费免费| 欧美精品tushy高清| www.久久久久久久久| 亚洲成av人片在www色猫咪| 国产目拍亚洲精品99久久精品| 欧美美女直播网站| 91丝袜呻吟高潮美腿白嫩在线观看| 久久国产剧场电影| 亚洲成人黄色影院| 亚洲精品视频在线看| 欧美激情在线观看视频免费| 日韩欧美一区二区视频| 欧美三级电影在线观看| 91色九色蝌蚪| 成av人片一区二区| 国产精品性做久久久久久| 精品中文字幕一区二区小辣椒| 亚洲成人在线网站| 亚洲一区视频在线| 亚洲精品国产视频| 亚洲人成伊人成综合网小说| 中文字幕国产精品一区二区| 亚洲精品一区二区三区福利| 欧美一区二区三区在| 欧美亚洲尤物久久| 暴力调教一区二区三区| 精品写真视频在线观看 | 中文字幕亚洲电影| 欧美精品一区二区三区蜜臀| 欧美色中文字幕| 99久免费精品视频在线观看| 国产一区二区三区在线看麻豆| 午夜亚洲国产au精品一区二区| 亚洲欧洲性图库| 国产三级欧美三级| 日本一区二区高清| 久久久亚洲高清| 日韩欧美一级精品久久| av中文字幕在线不卡| 国产精品乡下勾搭老头1| 精品一区二区三区蜜桃| 日本在线不卡一区| 亚洲午夜在线视频| 日韩av成人高清| 日韩电影在线一区| 午夜久久福利影院| 亚洲午夜精品网| 亚洲二区在线视频| 亚洲一二三区不卡| 亚洲成a天堂v人片| 亚洲自拍偷拍图区| 亚洲欧美日韩在线播放| 亚洲天天做日日做天天谢日日欢| 中文字幕欧美三区| 中文字幕欧美国产| 国产精品久久夜| 中文字幕一区三区| 亚洲人成人一区二区在线观看| 亚洲女与黑人做爰| 中文字幕欧美激情| 性欧美大战久久久久久久久| 视频在线观看一区| 蜜桃视频第一区免费观看| 久久aⅴ国产欧美74aaa| 国产一区二区电影| 成人精品小蝌蚪| 懂色中文一区二区在线播放| 成人v精品蜜桃久久一区| 色婷婷综合久久久中文字幕| 欧美在线免费视屏| 91精品国产综合久久久久| 精品噜噜噜噜久久久久久久久试看 | 国产欧美精品一区二区三区四区 | 国产精品传媒入口麻豆| 亚洲品质自拍视频网站| 午夜成人免费视频| 国产麻豆午夜三级精品| 国产精品一区二区男女羞羞无遮挡| 国产精品一区二区三区四区| 不卡av免费在线观看| 欧美日韩一区二区三区在线| 精品国免费一区二区三区| 国产精品无圣光一区二区| 亚洲香肠在线观看| 精品一区精品二区高清| 极品美女销魂一区二区三区 | 亚洲精品写真福利| 蜜桃视频一区二区| 97精品久久久久中文字幕| 欧美日本韩国一区二区三区视频 | 欧美国产乱子伦| 五月天精品一区二区三区| 国产精品一区免费视频| 欧洲av在线精品| 久久伊99综合婷婷久久伊| 三级在线观看一区二区| 99久久免费视频.com| 91精品国产91热久久久做人人| 中文字幕高清一区| 日日骚欧美日韩| 91免费国产在线| 日韩欧美中文字幕精品| 亚洲一区二区三区四区五区黄| 国产精品一区专区| 7777精品伊人久久久大香线蕉经典版下载| 久久久久久9999| 日韩激情视频在线观看| 不卡一区中文字幕| 亚洲精品一区二区在线观看| 亚洲综合清纯丝袜自拍| 风间由美中文字幕在线看视频国产欧美 | 成人免费视频一区| 欧美一区二区日韩一区二区| 亚洲视频一区在线观看| 国内精品嫩模私拍在线| 91.com视频| 亚洲国产精品传媒在线观看| 国产永久精品大片wwwapp| 欧美久久免费观看| 夜夜爽夜夜爽精品视频| 99免费精品视频| 国产精品视频一二三区| 久久国产生活片100| 555www色欧美视频| 亚洲国产一区二区视频| 成人黄动漫网站免费app| 国产亚洲精品中文字幕| 国产在线视频一区二区| 日韩精品专区在线影院重磅| 五月激情综合网| 欧美在线你懂得| 一区二区三区高清在线| 91福利小视频| 亚洲嫩草精品久久| 91麻豆国产福利在线观看| 国产精品久久久久久久久免费丝袜 | 美女免费视频一区二区| 在线亚洲人成电影网站色www| 亚洲精品日韩专区silk| www.欧美亚洲| 亚洲欧美日韩在线播放| 在线免费观看日本一区| 亚洲成在人线免费| 欧美日韩美女一区二区| 天天操天天色综合| 日韩三级免费观看| 日本欧美大码aⅴ在线播放| 欧美电影一区二区三区| 秋霞成人午夜伦在线观看| 日韩欧美视频一区| 国产一区视频网站| 国产人成亚洲第一网站在线播放| av在线播放一区二区三区| 亚洲精品久久7777| 欧美日韩中字一区|