Commit graph

19 commits

Author SHA1 Message Date
Yifan Hong
6884b87a37 lshal: --debug omits info on parent objects.
Instead, print a short message that contains the information
on the row that it should look up.

Test: lshal --debug
Test: lshal debug -E android.hardware.health@2.0::IHealth/default
Test: lshal_test
Fixes: 160745145
Change-Id: I7d5ab9fba097c0fb0b080ec52682084c65ba9f50
2020-07-10 11:36:16 -07:00
Steven Moreland
552e407f8e lshal: add wait command
Waits for an interface to start (e.g. for scripting certain tests).

Fixes: 135956088
Test: the following
$ adb shell lshal wait android.hardware.nfc@1.0::INfc/foo
Service not found (missing permissions or not in VINTF manifest?).
$ echo $?
128
$ adb shell lshal wait android.hardware.nfc@1.0::INfc/default
$ echo $?
0
Test: lshal_test

Change-Id: I355fc33f9e46bac573a38425205e8db81f19a36e
2019-07-12 00:44:27 +00:00
Steven Moreland
0b8e38764c lshal: use pragma once
For simplicity when adding new files.

Bug: N/A
Test: N/A
Change-Id: Ia66e5da5ff680b9287c4431799a935b58de02307
2019-06-25 08:54:34 -07:00
Steven Moreland
5f328892a8 Add 'exclude parent' option to debug.
We could add this to list in the future if it seems useful.

This allows someone to call debug on all registered hal instances
without dumping subclasses multiple times.

Bug: 72123369
Test: w/ bugreport using this and manual
Change-Id: Ib201194a9f81ae1aded7105d123ac6399c847494
2018-01-18 14:39:33 -08:00
Chih-Hung Hsieh
734e378a73 Use -Werror in frameworks/native/cmds
* Remove or comment out unused variables/functions.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I15a463eb9a20bc12787c104f671063ceeafaa1cc
2017-10-09 15:16:59 -07:00
Yifan Hong
795b6ec895 lshal: Lshal register commands
Register commands to the controller class Lshal to autogenerate
help messages and select the correct Command.

Test: lshal_test
Change-Id: I846aef13d77bcee328c8410dc61f2e8b4c0e0d69
2017-09-14 13:40:27 -07:00
Yifan Hong
a8bedc6ae3 lshal: add HelpCommand
Add *Command::usage() function for each Command and let
Lshal class to call them.

Suppress output from getopt_long and write our own
error message to customized error stream (for testing).

Test: lshal_test
Test: lshal --help

Change-Id: I8f5847c84a3e01af29fa85871479cab3baeb5312
2017-09-14 13:40:27 -07:00
Yifan Hong
ded398e5b6 lshal: Add class Command.
Command is the base class for all *Command classes.

Test: lshal_test

Bug: 35389839
Change-Id: I9aca19e66824536d13e618ffd0f012ac3da9880d
2017-09-14 13:40:27 -07:00
Yifan Hong
b2a2ecb642 lshal: Add tests for ListCommand::parseArgs
Test: lshal_test
Bug: 35389839
Change-Id: Iaef39b048b0e7c06e70e21c96448c2f2e24d3128
2017-09-11 13:44:32 -07:00
Yifan Hong
9881df9717 Add tests to lshal.
Test: lshal_test
Bug: 37954458
Change-Id: I1914e6274974ed5eb0ce2d655f1333d2344b49f5
2017-05-12 12:47:43 -07:00
Yifan Hong
48dc9f8586 Add lshal debug command.
Supported command:
    lshal debug android.hardware.foo@1.0::IFoo option option

Test: adb unroot && lshal --debug ; echo $?
Test: adb unroot && lshal debug android.hardware.nfc@1.0::INfc ; echo $?
Test: adb root && lshal --debug ; echo $?
Test: adb root && lshal debug android.hardware.nfc@1.0::INfc ; echo $?

Bug: 37954458
Change-Id: Ia2f4c9c0d3fb0a7bb26e76f01d02f49dc426e7f8
2017-05-12 12:47:43 -07:00
Yifan Hong
443df7932c Lshal: support commands.
Support the following commands:
  lshal list
  lshal list -itrpc
  lshal help
  lshal help list
  lshal list -h
  lshal list --help

Test: run these commands
Bug: 37725279
Change-Id: I970fbc8d250d43f57e92f783229e0645d7e8df4e
2017-05-12 12:47:43 -07:00
Andreas Huber
28d35913d5 Enable --debug option for "lshal" command.
This calls into live binderized services and logs their "IBase::debug(...)"
output.

Bug: 36520620
Test: make, adb shell lshal, adb shell bugreport
Change-Id: Ida3b0c61eafd9f3de562a5df3af24bbaf383de22
2017-03-24 13:15:05 -07:00
Yifan Hong
a3b8709a5d lshal: Put more description to output
Split the output by three parts according to the source of information.
Describe each part before the table.

--sort will be applied to each table individually.

Bug: 35803917
Test: lshal
Change-Id: Ief0dae21fdeb58ebaed46d2aa68f298b8b75218d
2017-03-02 19:21:15 -08:00
Yifan Hong
b44790219f lshal: also list libraries in 32-bit.
Add an "Arch" column (selected by -r) to lshal
to show whether the HAL runs in 32 bit or 64 bit.

* For binderized services, whether the process
  runs in 32bit or 64bit (__LP64__)
* For passthrough libraries (-impl.so), whether
  the library is in /{system,vendor,odm}/lib/hw
  or /{system,vendor,odm}lib64/hw

Bug: 35803184
Test: lshal -itrpc
Change-Id: I328da4ad9eacbf2959be4ac2e478c16535a89068
2017-03-02 19:21:15 -08:00
Yifan Hong
4b86549b14 lshal --vintf to create a skeleton hal manifest.
Run it as follows:
lshal --init-vintf=/data/a.xml
lshal --init-vintf > /data/a.xml

Test: lshal --init-vintf with and without path argument
Bug: 35852743
Change-Id: Ief9385fc2764a487d1a70644699e01133bdc8a8e
2017-02-28 20:30:30 -08:00
Yifan Hong
ae09a3ddfe lshal: Add option to print cmd lines instead of pids.
Add -m to arguments of lshal. When this flag is set,
/proc/{pid}/cmdline is printed instead of a plain PID.
If the file doesn't exist, it will be striped out from
the PID column as well (the process is considered died
and won't hold a reference to the binder object.)

Test: lshal -icm

Bug: 35160832

Change-Id: I4345bf06112a1f87ce91bec6f6f787703e46cd17
2017-02-15 16:30:35 -08:00
Yifan Hong
38d53e0327 lshal: Allow selecting columns and sorting by column.
Examples: see tests below.

Test: lshal
Test: lshal -intpac
Test: lshal --sort=i
Test: lshal --sort=p

Bug: 34984175

Change-Id: Ia09823776a206868a5d58a2ede153a4538147756
2017-02-14 19:25:27 -08:00
Yifan Hong
b0dde932ad lshal: Refactor lshal to use an Lshal class; combined instance column with interface column
We need to be able to select columns, sort columns,
and do IPC calls fault-tolerently.
Refactoring lshal.cpp into an Lshal class for more
objective-oriented programming, so that global variables
can be avoided and less parameters will need
to be passed around.

Test: lshal outputs identical output as without this CL, except
with the column merged.

Change-Id: I9668c998da692222aef96ae67bbab8066172543d
2017-02-14 19:25:27 -08:00