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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? irdaspray.c

?? linux操作系統(tǒng)下的紅外驅(qū)動(dòng)的測(cè)試程序
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/********************************************************************* *                 * Filename:      irdaspray.c * Version:        * Description:    * Status:        Experimental. * Author:        Dag Brattli <dagb@cs.uit.no> *		  Jean Tourrilhes <jt@hpl.hp.com> * Created at:    10/12/99 * Modified at:   Mon May 10 18:31:35 1999 * Modified by:   Dag Brattli <dagb@cs.uit.no> *  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved. *     Copyright (c) 2001 Jean Tourrilhes, All Rights Reserved. *      *     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., 59 Temple Place, Suite 330, Boston,  *     MA 02111-1307 USA *      ********************************************************************//*gcc -O2 -Wall -o irdaspray irdaspray.c*//* * This program demonstrate the use of auto-connect (connect to a service * without having to discover/specify an address) and how a program * can report discovery results to the user in case the service is not * unique on the network. * Of course, you need both auto-connect and query-ias in the kernel, and * a few bugs sorted out... * * Then, we show a cleaner way to perform discovery, by having better * memory allocation strategy, better handling of errors and setting the * hint mask in the kernel... * * Also, we include a nice feature which is a blocking discovery. Basically, * we ask the kernel to wake us up when it discover a device. This reduces * CPU usage (to zero) and decrease latency (to almost zero). This is * geared toward mobile devices (or to serve those mobile devices), but * also to implement "irmanager/irmonitor" kind of functionality... * * Also, everything about manipulating the IAS database and making query * is explained. That allow you to play with non-standard fields. * * Note that each feature require specific kernel support in the IrDA stack * so please check if your IrDA stack support that... In fact, this was * mostly written to test those kernel features. * * Jean Tourrilhes *//* CONFIGURATION */#define WAITFORDEVICE	1#define CHECKBEFOREWAIT	1#define SETHINTMASK	1#define AUTOCONNECT	1#define GETSOCKNAME	1#define SETIAS		0#define DELIAS		0#include <sys/socket.h>#include <sys/types.h>#include <sys/time.h>#include <sys/ioctl.h>#include <sys/stat.h>#include <sys/wait.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <signal.h>#include <string.h>#include <fcntl.h>#include <errno.h>#include <linux/types.h>#include <linux/irda.h>#ifndef AF_IRDA#define AF_IRDA 23#endif /* AF_IRDA *//* Memory allocation for discovery */#define DISC_MAX_DEVICES 10#define DISC_BUF_LEN	sizeof(struct irda_device_list) + \			sizeof(struct irda_device_info) * DISC_MAX_DEVICESint frame_size = 1024;int frame_number = 100;unsigned char buf[8200];int echo = 1;		/* Use echo service by default (0 = discard) */int server = 0;		/* Act as a client by default (1 = server) */int two = 0;		/* Open only one client sockets (1 = two) *//* * Function irdaspray_sethintmask (fd) * *    Set the hint mask in the kernel to filter discoveries * * Note : Unless explicitely changed, this setting will remain valid * for any subsequent discoveries on this socket, such as : *	o Waiting for device -> getsockopt(IRLMP_WAITDEVICE) *	o Auto-connect -> connect(daddr = 0x0) *	o Standard discovery -> getsockopt(IRLMP_ENUMDEVICES) */void irdaspray_sethintmask(int fd){	unsigned char	hints[4];	/*	 * The hint mask we use is set to catch any device that potentially	 * support things outside IrComm/IrLAN/IrLPT, so most device	 * worth connecting to via IrTTP.	 * Setting the hint mask with IrComm or IrObex could be usefull	 * for some apps...	 */	hints[0] = HINT_COMPUTER | HINT_PDA;	hints[1] = 0;	/* Set the filter used for performing discovery */	if (setsockopt(fd, SOL_IRLMP, IRLMP_HINT_MASK_SET,		       hints, sizeof(hints))) 	{		perror("setsockopt");		exit(-1);	}}/* * Function irdaspray_check_discovery (fd) * *    Check the state of the discovery log * * See irdaspray_discover_devices() for details */int irdaspray_check_discovery(int fd){	struct irda_device_list *	list;	unsigned char		buf[DISC_BUF_LEN];	int len;	/* Set the list to point to the correct place */	list = (struct irda_device_list *) buf;	len = DISC_BUF_LEN;	/* Perform a discovery and get device list */	if (getsockopt(fd, SOL_IRLMP, IRLMP_ENUMDEVICES, buf, &len)) {		printf("Didn't find any devices!\n");		return -1;	}	/* Did we got any ? (in some rare cases, this test is true) */	if (list->len <= 0) {		printf("Didn't find any devices!\n");		return -1;	}	return 0;}/* * Function irdaspray_waitfor_devices (fd) * *    Wait until some device come into range... * * Note much to say. We set our hint mask, and call the stack with the * maximum amount of time we want to wait. * If a new device come in, we will wake up, otherwise it will timeout... * Note : this function is only triggered by *new* device, devices already * in range won't trigger this function. * The exact rules are : *	If a device has been discovered, or has change its hint bits, *	less than the discovery timeout in the past, then return, *	otherwise block until this happen or timeout. * Therefore, if you poll continuously this function, you'd better sleep * a bit after a positive result before calling it again... */int irdaspray_waitfor_device(int fd){	int timeout = 30000;	/* Block only for 30s */	int len;#if SETHINTMASK	/* Set the filter used for performing discovery */	irdaspray_sethintmask(fd);#endif#if CHECKBEFOREWAIT	/* Note : before waiting for a new device to show up, we first	 * check if a device has not already been discovered */	if(irdaspray_check_discovery(fd) == 0)		return 0;#endif	/* Wait for a device to be in range */	printf("Waiting for a device...\n");	len = sizeof(timeout);	if (getsockopt(fd, SOL_IRLMP, IRLMP_WAITDEVICE, &timeout, &len)) {		if(errno != EAGAIN) {			perror("getsockopt-wait");			exit(-1);		}		printf("Nothing found in the last %d s\n", timeout / 1000); 		return -1;	}	return 0;	/* Found one device */}/* * Function echo_discover_devices (fd) * *    Try to discover some remote device(s) that we can connect to * * Note : in this function, the memory allocation for the discovery log * is done "the right way", so that we don't leak memory... */int irdaspray_discover_devices(int fd, char *service_name){	struct irda_device_list *	list;	unsigned char		buf[DISC_BUF_LEN];	struct irda_ias_set ias_query;	int err;	int len;	int i;	/* We are so proud of this feature that we show it again ! */#if SETHINTMASK	/* Set the filter used for performing discovery */	irdaspray_sethintmask(fd);#endif	/* Set the list to point to the correct place */	list = (struct irda_device_list *) buf;	len = DISC_BUF_LEN;	/* Perform a discovery and get device list */	if (getsockopt(fd, SOL_IRLMP, IRLMP_ENUMDEVICES, buf, &len)) {		printf("Didn't find any devices!\n");		return -1;	}	/* Did we got any ? (in some rare cases, this test is true) */	if (list->len <= 0) {		printf("Didn't find any devices!\n");		return -1;	}	/* List all devices */	printf("Discovered %d devices :\n", list->len);	for (i=0;i<list->len;i++) {		printf("  [%d] name:  %s, daddr: 0x%08x",		       i + 1, list->dev[i].info, list->dev[i].daddr);		fflush(stdout);		/* Ask if the requested service exist on this device */		len = sizeof(ias_query);		ias_query.daddr = list->dev[i].daddr;		strcpy(ias_query.irda_class_name, service_name);		strcpy(ias_query.irda_attrib_name, "IrDA:TinyTP:LsapSel");		err = getsockopt(fd, SOL_IRLMP, IRLMP_IAS_QUERY,				 &ias_query, &len);		if(err == 0) {			printf(", has service %s\n", service_name);		} else {			if(errno != EADDRNOTAVAIL)				printf(" <can't query IAS>\n");			else				printf(", doesn't have %s\n", service_name);		}	}				/* Ask the user */	printf("Enter device number:");	fflush(stdout);	if(scanf("%X", &i) != 1)		return -1;	i--;	if((i < 0) && (i > list->len))		return -1;	return(list->dev[i].daddr);}/* * IRIAS set/get/query tests */void irias_play(int	fd){	struct irda_ias_set ias_query;	int len;	/* Get the name of our own device */	len = sizeof(ias_query);	strcpy(ias_query.irda_class_name, "Device");	strcpy(ias_query.irda_attrib_name, "DeviceName");	if (!getsockopt(fd, SOL_IRLMP, IRLMP_IAS_GET, &ias_query, &len)) {		printf("The name of our device is = ``%s''\n",		       ias_query.attribute.irda_attrib_string.string);	}	/* Get the name of the remote device */	len = sizeof(ias_query);	strcpy(ias_query.irda_class_name, "Device");	strcpy(ias_query.irda_attrib_name, "DeviceName");	if (!getsockopt(fd, SOL_IRLMP, IRLMP_IAS_QUERY, &ias_query, &len)) {		printf("The name of the other device is = ``%s''\n",		       ias_query.attribute.irda_attrib_string.string);	}	/* Set an integer in IAS (new object) */	strcpy(ias_query.irda_class_name, "my:object");	ias_query.irda_attrib_type = IAS_INTEGER;	strcpy(ias_query.irda_attrib_name, "my:int");	ias_query.attribute.irda_attrib_int = 45;	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <my:object><my:int> in IAS\n");	    perror("setsockopt");	  }	/* Set a string in IAS (existing object) */	strcpy(ias_query.irda_class_name, "my:object");	ias_query.irda_attrib_type = IAS_STRING;	strcpy(ias_query.irda_attrib_name, "my:string");	strcpy(ias_query.attribute.irda_attrib_string.string, "The String");	ias_query.attribute.irda_attrib_string.len = strlen("The String");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <my:object><my:string> in IAS\n");	    perror("setsockopt");	  }	/* Set another string in IAS (system object) */	strcpy(ias_query.irda_class_name, "Device");	ias_query.irda_attrib_type = IAS_STRING;	strcpy(ias_query.irda_attrib_name, "Owner");	strcpy(ias_query.attribute.irda_attrib_string.string, "Myself");	ias_query.attribute.irda_attrib_string.len = strlen("Myself");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <Device><Owner> in IAS\n");	    perror("setsockopt");	  }	/* Set yet another string in IAS (same object name as this socket) */	if (echo)		strcpy(ias_query.irda_class_name, "IrECHO");	else		strcpy(ias_query.irda_class_name, "IrDISCARD");	ias_query.irda_attrib_type = IAS_STRING;	strcpy(ias_query.irda_attrib_name, "App-Name");	strcpy(ias_query.attribute.irda_attrib_string.string, "irdaspray.magic");	ias_query.attribute.irda_attrib_string.len = strlen("irdaspray.magic");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <IrECHO><App-Name> in IAS\n");	    perror("setsockopt");	  }	/* Set another integer in IAS (the object attached to this socket) */	strcpy(ias_query.irda_class_name, "");	ias_query.irda_attrib_type = IAS_INTEGER;	strcpy(ias_query.irda_attrib_name, "App-Version");	ias_query.attribute.irda_attrib_int = 3;	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <><App-Version> in IAS\n");	    perror("setsockopt");	  }	/* Try to set a kernel attribute (should fail) */	strcpy(ias_query.irda_class_name, "Device");	strcpy(ias_query.irda_attrib_name, "DeviceName");	strcpy(ias_query.attribute.irda_attrib_string.string, "Linux");	ias_query.attribute.irda_attrib_string.len = strlen("Linux");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't set <Device><DeviceName> in IAS\n");	    perror("setsockopt");	  }	/* Read the integer in IAS */	len = sizeof(ias_query);	strcpy(ias_query.irda_class_name, "my:object");	strcpy(ias_query.irda_attrib_name, "my:int");	if (!getsockopt(fd, SOL_IRLMP, IRLMP_IAS_GET, &ias_query, 		       &len)) 	  {	    printf("Type = %d\n", ias_query.irda_attrib_type);	    printf("Int = %d\n", ias_query.attribute.irda_attrib_int);	  }	/* Read the string in IAS */	len = sizeof(ias_query);	strcpy(ias_query.irda_class_name, "my:object");	strcpy(ias_query.irda_attrib_name, "my:string");	if (!getsockopt(fd, SOL_IRLMP, IRLMP_IAS_GET, &ias_query, 		       &len)) 	  {	    printf("Type = %d\n", ias_query.irda_attrib_type);	    printf("String = ``%s''\n", ias_query.attribute.irda_attrib_string.string);	  }}void irias_remove(int	fd){	struct irda_ias_set ias_query;	/* Delete the integer in IAS */	strcpy(ias_query.irda_class_name, "my:object");	strcpy(ias_query.irda_attrib_name, "my:int");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_DEL, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't remove <my:object><my:int> in IAS\n");	    perror("setsockopt");	  }	/* Delete the string in IAS */	strcpy(ias_query.irda_class_name, "my:object");	strcpy(ias_query.irda_attrib_name, "my:string");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_DEL, &ias_query, 		       sizeof(ias_query))) 	  {	    printf("Can't remove <my:object><my:string> in IAS\n");	    perror("setsockopt");	  }	/* Delete the other string in IAS */	strcpy(ias_query.irda_class_name, "Device");	strcpy(ias_query.irda_attrib_name, "Owner");	if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_DEL, &ias_query, 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲乱码国产乱码精品精小说 | 久久婷婷国产综合精品青草 | 国产99久久久国产精品| 亚洲图片欧美综合| 久久夜色精品国产噜噜av| 欧美三级乱人伦电影| 成人综合在线观看| 久久91精品国产91久久小草| 亚洲一区二区三区免费视频| 久久蜜桃av一区精品变态类天堂| 欧美日本在线看| 日本韩国一区二区三区视频| 成人一区二区三区中文字幕| 免播放器亚洲一区| 亚洲成人一区在线| 亚洲女同ⅹxx女同tv| 欧美国产精品一区| 精品国产一区二区三区不卡| 欧美人与禽zozo性伦| 91麻豆免费视频| 成人三级在线视频| 国产乱码精品1区2区3区| 免费精品99久久国产综合精品| 亚洲国产日韩a在线播放| 亚洲激情男女视频| 中文字幕五月欧美| 欧美国产视频在线| 国产视频视频一区| 久久综合中文字幕| 精品嫩草影院久久| 日韩午夜小视频| 欧美一区二区三区在线看| 欧美日韩夫妻久久| 欧美在线观看一二区| 色一情一乱一乱一91av| 菠萝蜜视频在线观看一区| 成人蜜臀av电影| 成熟亚洲日本毛茸茸凸凹| 成人国产一区二区三区精品| 国产成人午夜视频| 国产91精品免费| 国产成人av电影免费在线观看| 国产成人午夜精品影院观看视频| 国产a区久久久| 成人国产在线观看| 91麻豆精品秘密| 97精品久久久久中文字幕| 色综合天天做天天爱| 色综合久久久久综合体桃花网| 色老头久久综合| 欧美日韩精品一区二区在线播放| 欧美日韩综合在线| 制服视频三区第一页精品| 日韩欧美一区在线观看| 精品少妇一区二区三区在线播放 | 制服丝袜日韩国产| 欧美变态tickling挠脚心| 精品粉嫩aⅴ一区二区三区四区| 精品国产乱码久久久久久牛牛| 久久这里只有精品视频网| 久久久久国产精品麻豆| 国产精品乱码久久久久久| 亚洲人成网站精品片在线观看| 亚洲最色的网站| 日本欧美久久久久免费播放网| 国产剧情av麻豆香蕉精品| 99久久精品国产麻豆演员表| 欧洲精品一区二区三区在线观看| 欧美乱妇一区二区三区不卡视频| 日韩视频在线一区二区| 中文字幕二三区不卡| 亚洲制服丝袜在线| 美女视频免费一区| 丁香另类激情小说| 欧美剧在线免费观看网站 | 精品成人免费观看| 成人免费在线视频| 免费在线观看视频一区| 国产成人超碰人人澡人人澡| 日本久久精品电影| 久久影院午夜片一区| 亚洲乱码精品一二三四区日韩在线| 天天综合天天综合色| 国产一区二区三区日韩| 色婷婷综合久久久久中文| 欧美一区二区三区免费观看视频| 国产日韩一级二级三级| 亚洲成人动漫在线免费观看| 国产一区二区精品久久99| 欧美三级韩国三级日本三斤| 久久久久国产精品厨房| 亚洲18色成人| 成人高清视频在线| 欧美成人激情免费网| 亚洲精品va在线观看| 国产在线播放一区三区四| 欧美亚洲国产一区二区三区va| 久久嫩草精品久久久精品一| 亚洲成人先锋电影| 97精品久久久午夜一区二区三区| 精品国产人成亚洲区| 亚洲成a人在线观看| 不卡高清视频专区| 久久久久久久久久久久久夜| 丝袜诱惑制服诱惑色一区在线观看| 粉嫩一区二区三区性色av| 日韩丝袜美女视频| 亚洲gay无套男同| 91社区在线播放| 欧美激情一区三区| 久久se这里有精品| 制服丝袜中文字幕亚洲| 一区二区三区四区亚洲| 不卡欧美aaaaa| 国产人成亚洲第一网站在线播放| 蓝色福利精品导航| 这里只有精品免费| 亚洲成av人片一区二区三区| 在线免费不卡电影| 亚洲日本电影在线| 北条麻妃国产九九精品视频| 久久九九99视频| 极品少妇xxxx精品少妇偷拍| 91精品国产综合久久香蕉麻豆| 亚洲一区二区综合| 在线观看免费成人| 亚洲美女电影在线| 91在线视频官网| 亚洲视频在线观看一区| 91美女视频网站| 亚洲欧美区自拍先锋| 91日韩精品一区| 亚洲精品乱码久久久久久日本蜜臀| 成年人网站91| 一色屋精品亚洲香蕉网站| 成人黄页在线观看| 一区在线观看视频| 99久久精品99国产精品| 亚洲欧洲日韩综合一区二区| av色综合久久天堂av综合| 中文字幕在线观看不卡视频| 91视频在线观看| 亚洲一区影音先锋| 91精品国产一区二区三区香蕉| 青青青爽久久午夜综合久久午夜| 欧美日韩国产不卡| 蜜桃久久久久久久| 久久久精品日韩欧美| 国产91露脸合集magnet| 18欧美乱大交hd1984| 日本伦理一区二区| 日本成人在线网站| 精品国产麻豆免费人成网站| 国产成人超碰人人澡人人澡| 1区2区3区国产精品| 欧美日韩午夜精品| 男人操女人的视频在线观看欧美| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 久久综合丝袜日本网| 国产成人一区在线| 一区二区视频在线看| 欧美日韩中文另类| 精品亚洲成a人| 欧美国产欧美综合| 欧美自拍偷拍午夜视频| 久久激情综合网| 欧美国产精品一区二区三区| 欧美性感一区二区三区| 蓝色福利精品导航| 亚洲天堂免费在线观看视频| 欧美精品一级二级| 国产麻豆视频一区| 一区二区三区欧美激情| 日韩视频免费观看高清完整版在线观看 | 精品综合免费视频观看| 国产欧美日韩中文久久| 在线观看av不卡| 国产一区二区三区免费看| 亚洲精品视频在线| 日韩精品一区二区三区在线播放| 国产成人免费视| 亚洲不卡一区二区三区| 国产女主播在线一区二区| 欧美少妇xxx| 波波电影院一区二区三区| 日韩国产一二三区| 国产精品视频线看| 日韩欧美高清dvd碟片| 91视频免费播放| 国产精选一区二区三区| 亚洲国产成人av网| 国产日韩欧美综合在线| 欧美日韩日日摸| 99国产欧美另类久久久精品| 麻豆视频观看网址久久| 一区av在线播放| 日本一区二区动态图| 欧美成人a在线| 欧美日韩精品一区视频|