aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BoardConfigCommon.mk3
-rw-r--r--dumpstate/Android.mk32
-rw-r--r--dumpstate/DumpstateDevice.cpp63
-rw-r--r--dumpstate/DumpstateDevice.h50
-rw-r--r--dumpstate/NOTICE2
-rw-r--r--dumpstate/android.hardware.dumpstate@1.0-service.sony.rc4
-rw-r--r--dumpstate/dumpstate.c28
-rw-r--r--dumpstate/service.cpp41
8 files changed, 180 insertions, 43 deletions
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
index 2c96acd..be7c3b4 100644
--- a/BoardConfigCommon.mk
+++ b/BoardConfigCommon.mk
@@ -65,9 +65,6 @@ TARGET_USES_64_BIT_BINDER := true
# Camera
TARGET_USES_MEDIA_EXTENSIONS := true
-# Dumpstate
-BOARD_LIB_DUMPSTATE := libdumpstate.sony
-
# GPS
TARGET_PROVIDES_GPS_LOC_API := true
diff --git a/dumpstate/Android.mk b/dumpstate/Android.mk
index 9c53292..f5fa995 100644
--- a/dumpstate/Android.mk
+++ b/dumpstate/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 The Android Open Source Project
+# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,15 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := frameworks/native/cmds/dumpstate
-
-LOCAL_SRC_FILES := dumpstate.c
-
-LOCAL_MODULE := libdumpstate.sony
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.dumpstate@1.0-service.sony
+LOCAL_INIT_RC := android.hardware.dumpstate@1.0-service.sony.rc
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ DumpstateDevice.cpp \
+ service.cpp
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.dumpstate@1.0 \
+ libbase \
+ libcutils \
+ libdumpstateutil \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ liblog \
+ libutils
LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_LIBRARY)
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_EXECUTABLE)
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
new file mode 100644
index 0000000..6719c75
--- /dev/null
+++ b/dumpstate/DumpstateDevice.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "SonyDumpstate"
+
+#include "DumpstateDevice.h"
+
+#include <log/log.h>
+
+#include "DumpstateUtil.h"
+
+using android::os::dumpstate::CommandOptions;
+using android::os::dumpstate::DumpFileToFd;
+using android::os::dumpstate::RunCommandToFd;
+
+namespace android {
+namespace hardware {
+namespace dumpstate {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
+Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
+ if (handle->numFds < 1) {
+ ALOGE("no FDs\n");
+ return Void();
+ }
+
+ int fd = handle->data[0];
+ if (fd < 0) {
+ ALOGE("invalid FD: %d\n", handle->data[0]);
+ return Void();
+ }
+
+ DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts");
+ DumpFileToFd(fd, "Power Management Stats", "/proc/msm_pm_stats");
+ RunCommandToFd(fd, "SUBSYSTEM TOMBSTONES", {"ls", "-l", "/data/tombstones/ramdump"}, CommandOptions::AS_ROOT);
+ DumpFileToFd(fd, "BAM DMUX Log", "/d/ipc_logging/bam_dmux/log");
+ DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log");
+ DumpFileToFd(fd, "SMD PKT Log", "/d/ipc_logging/smd_pkt/log");
+ DumpFileToFd(fd, "IPC Router Log", "/d/ipc_logging/ipc_router/log");
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace dumpstate
+} // namespace hardware
+} // namespace android
diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h
new file mode 100644
index 0000000..f8585f5
--- /dev/null
+++ b/dumpstate/DumpstateDevice.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
+#define ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
+
+#include <android/hardware/dumpstate/1.0/IDumpstateDevice.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace dumpstate {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct DumpstateDevice : public IDumpstateDevice {
+ // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
+ Return<void> dumpstateBoard(const hidl_handle& h) override;
+
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace dumpstate
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
diff --git a/dumpstate/NOTICE b/dumpstate/NOTICE
index a303bd0..e48dd6b 100644
--- a/dumpstate/NOTICE
+++ b/dumpstate/NOTICE
@@ -1,5 +1,5 @@
- Copyright (C) 2011 The Android Open Source Project
+ Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.sony.rc b/dumpstate/android.hardware.dumpstate@1.0-service.sony.rc
new file mode 100644
index 0000000..85aa8d1
--- /dev/null
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.sony.rc
@@ -0,0 +1,4 @@
+service dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.sony
+ class hal
+ user system
+ group system
diff --git a/dumpstate/dumpstate.c b/dumpstate/dumpstate.c
deleted file mode 100644
index a33cf47..0000000
--- a/dumpstate/dumpstate.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <dumpstate.h>
-
-void dumpstate_board()
-{
- dump_file("INTERRUPTS", "/proc/interrupts");
- dump_file("Power Management Stats", "/proc/msm_pm_stats");
- run_command("SUBSYSTEM TOMBSTONES", 5, SU_PATH, "root", "ls", "-l", "/data/tombstones/ramdump", NULL);
- dump_file("BAM DMUX Log", "/d/ipc_logging/bam_dmux/log");
- dump_file("SMD Log", "/d/ipc_logging/smd/log");
- dump_file("SMD PKT Log", "/d/ipc_logging/smd_pkt/log");
- dump_file("IPC Router Log", "/d/ipc_logging/ipc_router/log");
-};
diff --git a/dumpstate/service.cpp b/dumpstate/service.cpp
new file mode 100644
index 0000000..7885433
--- /dev/null
+++ b/dumpstate/service.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.dumpstate@1.0-service.sony"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "DumpstateDevice.h"
+
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
+using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::OK;
+using ::android::sp;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
+ configureRpcThreadpool(1, true /* will join */);
+ if (dumpstate->registerAsService() != OK) {
+ ALOGE("Could not register service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}