- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
vibrator.c
资源名称:fmradio.zip [点击查看]
上传用户:ledjyj
上传日期:2014-08-27
资源大小:2639k
文件大小:1k
源码类别:
驱动编程
开发平台:
Unix_Linux
- /* *****************************************************************************
- * Vibrator interface for application
- * Scource code: vibrator.c
- * Author: Rick Li
- * Data: May 17, 2007
- * Copyright: Tech-Yeh Computer Co.,Ltd
- ********************************************************************************/
- #include <stdio.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <errno.h>
- #include "vibrator.h"
- int fd=0;
- char *vib_dev_name="/dev/vibrator";
- int vibrator_on(void)
- {
- fd= open(vib_dev_name,O_RDWR);
- if(fd<0)
- {
- printf("device %s open failedn",vib_dev_name);
- return -1;
- }
- if(ioctl(fd,1,NULL))
- {
- printf("device %s can't workn",vib_dev_name);
- return -1;
- }
- return 0;
- }
- int vibrator_off(void)
- {
- if(fd==0)
- {
- printf("device %s not workn",vib_dev_name);
- return -1;
- }
- if(ioctl(fd,2,NULL))
- {
- printf("device %s can't stopn",vib_dev_name);
- return -1;
- }
- else
- {
- close(fd);
- }
- return 0;
- }
- /*int main(void)
- {
- vibrator_on();
- getchar ();
- vibrator_off();
- getchar ();
- vibrator_on();
- getchar ();
- vibrator_off();
- return 0;
- }*/