diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-11-04 11:40:08 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-11-04 12:05:45 -0700 |
commit | 7314fe03b6cc7c16d49aacbe59840d8724f6852e (patch) | |
tree | 48fc9aebef6bc1d304cd584050a24e336ca05676 /vibrator | |
parent | 1cb1728b1870a5e37360f65864a3642d5a37b21c (diff) | |
download | hardware_libhardware_legacy-7314fe03b6cc7c16d49aacbe59840d8724f6852e.zip hardware_libhardware_legacy-7314fe03b6cc7c16d49aacbe59840d8724f6852e.tar.gz hardware_libhardware_legacy-7314fe03b6cc7c16d49aacbe59840d8724f6852e.tar.bz2 |
Add an API to find out whether there is a vibrator.
Change-Id: Ic0d967bc72c542fc6a97331c9197114f3f571c08
Diffstat (limited to 'vibrator')
-rw-r--r-- | vibrator/vibrator.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vibrator/vibrator.c b/vibrator/vibrator.c index 22cc506..f946ce1 100644 --- a/vibrator/vibrator.c +++ b/vibrator/vibrator.c @@ -23,6 +23,23 @@ #define THE_DEVICE "/sys/class/timed_output/vibrator/enable" +int vibrator_exists() +{ + int fd; + +#ifdef QEMU_HARDWARE + if (qemu_check()) { + return 1; + } +#endif + + fd = open(THE_DEVICE, O_RDWR); + if(fd < 0) + return 0; + close(fd); + return 1; +} + static int sendit(int timeout_ms) { int nwr, ret, fd; |