summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorjp abgrall <jpa@google.com>2012-09-17 11:01:37 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-17 11:01:37 -0700
commit86ca50d860fa256f5553ac7b313ba5ff0f120ef0 (patch)
tree80ebbc8a9d54c1af5fa455fffd7f676d636f1ccd /cmds
parent07e8134e24e9ef7a3b2ade361ead5ce1b514c72f (diff)
parente917bfbd19c265ef09c90f93f5dc175fc62259f5 (diff)
downloadframeworks_native-86ca50d860fa256f5553ac7b313ba5ff0f120ef0.zip
frameworks_native-86ca50d860fa256f5553ac7b313ba5ff0f120ef0.tar.gz
frameworks_native-86ca50d860fa256f5553ac7b313ba5ff0f120ef0.tar.bz2
am e917bfbd: am 09a22fc2: Merge "Allow disable of dumpstate vibrate"
* commit 'e917bfbd19c265ef09c90f93f5dc175fc62259f5': Allow disable of dumpstate vibrate
Diffstat (limited to 'cmds')
-rw-r--r--cmds/dumpstate/dumpstate.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 4bb05c4..56ba3c8 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -294,7 +294,7 @@ static void dumpstate() {
}
static void usage() {
- fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s]\n"
+ fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s] [-q]\n"
" -o: write to file (instead of stdout)\n"
" -d: append date to filename (requires -o)\n"
" -z: gzip output (requires -o)\n"
@@ -302,12 +302,14 @@ static void usage() {
" -s: write output to control socket (for init)\n"
" -b: play sound file instead of vibrate, at beginning of job\n"
" -e: play sound file instead of vibrate, at end of job\n"
+ " -q: disable vibrate\n"
);
}
int main(int argc, char *argv[]) {
int do_add_date = 0;
int do_compress = 0;
+ int do_vibrate = 1;
char* use_outfile = 0;
char* begin_sound = 0;
char* end_sound = 0;
@@ -338,7 +340,7 @@ int main(int argc, char *argv[]) {
dump_traces_path = dump_traces();
int c;
- while ((c = getopt(argc, argv, "b:de:ho:svzp")) != -1) {
+ while ((c = getopt(argc, argv, "b:de:ho:svqzp")) != -1) {
switch (c) {
case 'b': begin_sound = optarg; break;
case 'd': do_add_date = 1; break;
@@ -346,6 +348,7 @@ int main(int argc, char *argv[]) {
case 'o': use_outfile = optarg; break;
case 's': use_socket = 1; break;
case 'v': break; // compatibility no-op
+ case 'q': do_vibrate = 0; break;
case 'z': do_compress = 6; break;
case 'p': do_fb = 1; break;
case '?': printf("\n");
@@ -355,9 +358,12 @@ int main(int argc, char *argv[]) {
}
}
- /* open the vibrator before dropping root */
- FILE *vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w");
- if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC);
+ FILE *vibrator = 0;
+ if (do_vibrate) {
+ /* open the vibrator before dropping root */
+ vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w");
+ if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC);
+ }
/* read /proc/cmdline before dropping root */
FILE *cmdline = fopen("/proc/cmdline", "r");