Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
vibrator.c
Package: fmradio.zip [view]
Upload User: ledjyj
Upload Date: 2014-08-27
Package Size: 2639k
Code Size: 1k
Category:
Driver develop
Development Platform:
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;
- }*/