From 03f8bbc181c08862e93b8a2baa3c2e2f6710d0b1 Mon Sep 17 00:00:00 2001 From: Yadong Qi Date: Thu, 29 Jun 2023 15:20:24 +0800 Subject: [PATCH] Add logcat2hvc service to redirect logcat to hvc Logcat2hvc service redirects logcat message to HVC (Hyperv Console) device, this is a debug purpose service for CrosVM Celadon Windows. Signed-off-by: Yadong Qi Tracked-On: OAM-114661 --- logcat2hvc/Android.bp | 21 +++++++++++++++++++++ logcat2hvc/logcat2hvc | 12 ++++++++++++ logcat2hvc/logcat2hvc.rc | 8 ++++++++ 3 files changed, 41 insertions(+) create mode 100644 logcat2hvc/Android.bp create mode 100755 logcat2hvc/logcat2hvc create mode 100644 logcat2hvc/logcat2hvc.rc diff --git a/logcat2hvc/Android.bp b/logcat2hvc/Android.bp new file mode 100644 index 0000000..491413a --- /dev/null +++ b/logcat2hvc/Android.bp @@ -0,0 +1,21 @@ +// +// Copyright (C) 2023 Intel Corporation +// +// 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. +// + +sh_binary { + name: "logcat2hvc", + src: "logcat2hvc", + init_rc: ["logcat2hvc.rc"], + required: ["logcat2hvc"], +} diff --git a/logcat2hvc/logcat2hvc b/logcat2hvc/logcat2hvc new file mode 100755 index 0000000..fb439fd --- /dev/null +++ b/logcat2hvc/logcat2hvc @@ -0,0 +1,12 @@ +#! /system/bin/sh + +# Start logcat then if logcat exits, restart from the most recently +# logged log, such that duplicates are not sent when restarting. + +[ ! -c /dev/hvc0 ] && exit -1 + +logcat "$@" + +while true; do + logcat -T1 "$@" +done diff --git a/logcat2hvc/logcat2hvc.rc b/logcat2hvc/logcat2hvc.rc new file mode 100644 index 0000000..472fb9e --- /dev/null +++ b/logcat2hvc/logcat2hvc.rc @@ -0,0 +1,8 @@ +service logcat2hvc /system/bin/logcat2hvc -b all -v threadtime -f /dev/hvc0 *:V + group system + oneshot + +#on property:logd.ready=true + +on init + start logcat2hvc