Commit graph

57 commits

Author SHA1 Message Date
Tomasz Wasilczyk
66fc939023 Update libnl++ class naming to match Android code style
nl::nlbuf -> nl::Buffer
nl::nlmsg -> nl::Message
nl::NetlinkRequest -> nl::MessageFactory
nl::NetlinkSocket -> nl::Socket

Bug: 162032964
Test: it builds
Change-Id: Id9858805ff3fce3e48f9a82b7dbaea09269bcb3c
2020-08-03 12:51:17 -07:00
Tomasz Wasilczyk
34eb83aef2 Implement attribute map.
Bug: 162032964
Test: custom code to parse RTM_NEWLINK messages
Change-Id: Ib07b0a4e553307e2ddaf7359e25f332660a29aec
2020-08-03 12:05:44 -07:00
Tomasz Wasilczyk
54fb7027d3 Merge "Implement nlmsg<T>" 2020-07-31 15:00:46 +00:00
Tomasz Wasilczyk
531af086fb Merge "Remove libnl++ dependency on NETLINK_ROUTE." 2020-07-30 22:13:25 +00:00
Tomasz Wasilczyk
6b47b98c40 Implement nlmsg<T>
Bug: 162032964
Test: custom code to parse RTM_NEWLINK messages
Change-Id: I1ee4fb65d5b555c7665b7c42e6810efce7c726b6
2020-07-30 14:13:20 -07:00
Tomasz Wasilczyk
390c711087 Remove libnl++ dependency on NETLINK_ROUTE.
One exception is for RTA_* definitions at NetlinkRequest. This class is
going to be refactored anyway, so let's focus on this later.

While we're here, also replace type assumptions with an actual
decltype lookup.

Bug: 162032964
Test: canhalctrl up test virtual vcan123
Change-Id: I3b509fa7b1870d4de7302fb5221a06613dfbb817
2020-07-30 11:08:29 -07:00
TreeHugger Robot
597e893560 Merge "Suppress gtest error for tests without any instance" 2020-07-29 20:02:18 +00:00
Dan Shi
ff985a85a8 Suppress gtest error for tests without any instance
Bug: 162052785
Test: m -j vts
Change-Id: I58bc808a82b2128bb8774f762f9b9fcecd2614fb
2020-07-29 09:46:36 -07:00
Tomasz Wasilczyk
1d5beb85a3 Change libnl++ namespace to android::nl
Bug: 162032964
Test: it builds
Change-Id: I3790f49c41319794e61ed422705c5e18e55e8bfc
2020-07-29 09:39:33 -07:00
Tomasz Wasilczyk
1695459e63 Split out libnl++ from libnetdevice
Bug: 162032964
Test: it builds
Change-Id: I86b574de458d9ee8204e6a356a80e70c101b443a
2020-07-28 09:42:55 -07:00
Chris Weir
5dcde4589b Merge "Fix netlink message printer byte counts" 2020-07-24 21:15:52 +00:00
chrisweir
afdd8d4a83 Fix netlink message printer byte counts
Don't print extra byte numbering for arrays with a size that is a
multiple of 16.

Bug: 161938586
Test: Manual inspection of printer output
Change-Id: I4a7948439dd18b440a6abfae388306167433ebd6
2020-07-23 10:28:19 -07:00
Tomasz Wasilczyk
8495403000 Implement struct printing
Also:
- fix potential use-after-free in nlbuf iterator
- simplify getFirst usage by migrating from std::optional to std::pair

Bug: 161898189
Test: print all messages from RTMGRP_LINK group

Change-Id: I4aa785ccef60e397ba87088f37e35d9873fc3c82
2020-07-22 15:52:14 -07:00
Tomasz Wasilczyk
2aa1a124fc Replace useCanSockets hack with flexible per-process domain selection
Bug: 158011272
Test: manual
Change-Id: I29d88a42e2309483a740cde9f9a463d83c7a560c
2020-07-20 14:42:45 -07:00
Chris Weir
cef964c1c2 Merge "Extend libnetdevice for Netlink Proxy" 2020-07-17 17:02:13 +00:00
chrisweir
06c2c0dea1 Extend libnetdevice for Netlink Proxy
Add some additional generic send/receive functionality for
NetlinkSocket.

Bug: 155190864
Test: Manual
Change-Id: I7a882fa642553c61e0b2b3a32638a309089c6d22
2020-07-16 15:29:25 -07:00
Jooyung Han
218396c1db Merge "update hidl .bp" 2020-07-02 02:47:24 +00:00
Jooyung Han
b0907a6bb8 update hidl .bp
HIDL libs are not necessarily part of VNDK now. Because some are
used by VNDK libs, they are still VNDK. But rest are now just
vendor-available.

.hidl_for_test files are also removed because they are used to exclude
test-purpose hidl libs from VNDK libs.

Instead, .hidl_for_system_ext files are added to tests/lazy to
distinguish them from others which are installed /system.

Bug: 143933769
Test: update-makefiles.sh && m com.android.vndk.current
Change-Id: Ia81312dda340b6b5cbdd7a3c21e1d323bda39a4a
2020-07-02 09:18:17 +09:00
TreeHugger Robot
7063932fe9 Merge "Use PLOG instead of printing errno" 2020-07-01 17:29:09 +00:00
Tomasz Wasilczyk
1accab9681 Use PLOG instead of printing errno
Also, print error message where the error code is available through
other means than errno.

Test: it builds
Change-Id: I0276c4bcd50debc0003aab4e3229ea33ac79f3ac
2020-07-01 08:43:55 -07:00
chrisweir
e56f9e18a6 Export libnetdevice headers
The previous change to do this missed a couple includes. Simply
compiling doesn't catch header problems unless the headers are actually
used.

Bug: 160171644
Test: Manual
Change-Id: I9edc76b47e934b60a143ebfacdeaeeddc0768fc5
2020-06-30 16:20:30 -07:00
Chris Weir
d61d00ff17 Merge "Make NetlinkSocket and nlbuf exported" 2020-06-29 21:37:10 +00:00
chrisweir
3fb244a56f Make NetlinkSocket and nlbuf exported
Move NetlinkSocket.h and nlbuf.h to include/libnetdevice as to make them
available for include.

Bug: 160171644
Test: Manual
Change-Id: If54852398cfbcc53eb830a66685c6b44e36ced87
2020-06-29 13:27:04 -07:00
Tomasz Wasilczyk
caeae195a7 Implement setting hardware address
Bug: 156784343
Test: manual
Change-Id: I6a533ab15bb93db26261f826bb8e7d8f12824d62
2020-06-25 13:36:48 -07:00
Tomasz Wasilczyk
91c3a04792 Implement fetching hardware address
Bug: 159327274
Test: manual
Change-Id: Ic3c7d757141da498f7d86ffabadac21a2372f443
2020-06-24 15:50:49 -07:00
Tomasz Wasilczyk
a5c83a5623 Implement ethtool get/set value operations
Bug: 156784343
Test: manual
Change-Id: I33b23bf9c6639cab6006c756d4ddbe561b9441ba
2020-06-17 13:15:41 -07:00
Tomasz Wasilczyk
a987273530 Implement Netlink message printer
Bug: 158756457
Test: manual
Change-Id: I93e40bbf1eff1c4c0e502ca38e07865909ba04f3
2020-06-17 13:15:35 -07:00
Tomasz Wasilczyk
ad10741a3a Implement creating VLAN interfaces
Also, minor improvements for TCU:
- added existsAndIsUp convenience function
- added useCanSockets configuration flag

Bug: 156783614
Test: manual
Change-Id: Ia3d48655067792b712519e25ed48ae0cb657347b
2020-06-04 15:01:59 -07:00
chrisweir
0d69b72097 Undo symlinked libc++fs
Several features for auto need libc++fs, but the previous solution of
symlinking to external/libcxx would cause problems later down the
line. Instead, we will compile a separate version of libc++fs with a
different namespace, as to not interfere with the canonical
std::filesystem.

Change summary
===============================================================
directory_iterator.cpp:
-----------------------
* _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM --> namespace android::hardware::automotive::filesystem {
* _LIBCPP_END_NAMESPACE_FILESYSTEM --> }  // namespace android::hardware::automotive::filesystem
* disable clang-format (to reduce diff size)
* "" --> <> for non-local includes

filesystem_common.h:
--------------------
* FILESYSTEM_COMMON_H --> AUTO_FILESYSTEM_COMMON_H
* "" --> <> for non-local includes
* filesystem --> automotive/filesystem
* don't include apple_availability.h
* add using std::error_code
* _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM --> namespace android::hardware::automotive::filesystem {
* use namespace std::chrono
* use std::error_code, std::is_floating_point, std::micro, std::nano, std::ratio
* LIBCPP_END_NAMESPACE_FILESYSTEM --> }  // namespace android::hardware::automotive::filesystem
* disable clang format (to reduce diff size)

filesystem:
-----------
* _LIBCPP_FILESYSTEM --> _LIBAUTO_FILESYSTEM
* std::filesystem --> android::hardware:automotive::filesystem
* _VSTD_FS --> android::hardware::automotive::filesystem
* _LIBCPP_END_NAMESPACE_FILESYSTEM --> }  // namespace android::hardware::automotive::filesystem
* Copied _FilesystemClock from chrono
* use namespace std and std::chrono
* use std::basic_string, std::enable_if, std::error_code, and std::false_type

operations.cpp:
---------------
* filesystem --> automotive/filesystem
* "" --> <> for non-local includes
* _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM --> namespace android::hardware::automotive::filesystem {
* _VSTD_FS --> android::hardware::automotive::filesystem
* _LIBCPP_END_NAMESPACE_FILESYSTEM --> }  // namespace android::hardware::automotive::filesystem
* disable clang-format (to reduce diff size)
* fix "the the" typo (to pass lint)

Bug: 152067309
Test: Manual
Change-Id: I5551b3e634b85b4d7236e888de68740bfda6aad1
2020-04-21 11:19:28 -07:00
Steven Moreland
852fc3ba4e Add VtsCan* to vts.
Bug: 139438327
Test: N/A
Change-Id: I73447a6a0b891adc9fbb0d931ae517e99f141c64
2020-04-02 14:38:19 -07:00
chrisweir
c8716aebfc Remove completed TODO
TODO for serial number support should be removed now that the feature is
implemented and merged.

Bug: 142654031
Test: Manual - comment only change
Change-Id: Ib733e71840e82e5cd9c47825a53f804f9c296a3d
2020-03-30 13:12:30 -07:00
Chris Weir
ee08459e45 Merge "Clean up errno logs and sto* conversions" into rvc-dev 2020-03-30 20:00:09 +00:00
chrisweir
a9d0e90f14 Add Support for Configuring CAN HAL by Serialno
Configuration files may now specify a list of serial numbers, or serial
number suffixes. These can be used to identify a USB peripheral,
regardless of what order the interface names are configured by the OS.

Bug: 142654031
Test: Manual
Change-Id: Idcdad1159b216119eb063df8bb229172a383b9ed
Merged-In: Idcdad1159b216119eb063df8bb229172a383b9ed
(cherry picked from commit 442b3badc8)
2020-03-30 17:22:55 +00:00
chrisweir
62bbf3dca9 DO NOT MERGE Add support for EFF/RTR to canhalsend
Adding support for extended format frames and remote transmission
request frames to canhalsend.

Bug: 149404884
Test: Manual
Merged-In: I330b9d24c34918b38612ddc1745f019e11bfd474
Change-Id: I330b9d24c34918b38612ddc1745f019e11bfd474
(cherry picked from commit 30bd3dce06)
2020-03-27 23:50:49 +00:00
chrisweir
75a80f6b60 Clean up errno logs and sto* conversions
I learned that we should be using PLOG to log errno strings, and we
should be avoiding stoi, stol, etc... conversions and instead use the
built in Android ParseInt/ParseUint functions.

Bug: 150250606
Bug: 150245058
Test: Manual for CLI tools, VTS for everything else
Merged-In: Icdd8a6af8564d5de3bedd1bc934f7928eb5e66e9
Change-Id: Icdd8a6af8564d5de3bedd1bc934f7928eb5e66e9
(cherry picked from commit 1173a7253b)
2020-03-27 18:04:48 +00:00
Chris Weir
33277cdc2b Merge "CAN Configurator Service" into rvc-dev 2020-03-26 22:28:11 +00:00
chrisweir
8fd2a85b6d Clean up TODOs
Squeegee supports Android now, so I'm cleaning up my TODOs.

Bug: 144458917
Bug: 144775286
Test: Only changes to comments

Change-Id: Ifd9907ba944759d4d5b36bce92f6bd11b5bb74e7
(cherry picked from commit 1ab3554868)
2020-03-26 18:34:17 +00:00
chrisweir
01247f9508 CAN Configurator Service
Configurator service for the CAN HAL and extracting some of the CAN HAL
configuration logic into a library for the various tools to share.

Bug: 142653776
Test: Manual
Change-Id: Id33871da851bcb442a7f851919f713ec913830ff
(cherry picked from commit 33ce7505d1)
2020-03-26 18:30:31 +00:00
chrisweir
740c3d53c0 Add libc++fs for auto
Add a temporary version of libc++fs for a couple of auto features. This
will need to be switched out when libc++fs merges, possibly in S.

Bug: 152067309
Bug: 142654031
Test: Manual
Change-Id: Ibb495af8140470b79e73fd104fd5061f7e3ad8a9
2020-03-24 20:00:11 +00:00
Tomasz Wasilczyk
f154585376 Convert CAN bus HAL VTS to parametrized gtest
Test: VTS
Bug: 150312861
Change-Id: Ib106a5d075d3189a57306f2b7283293e448a147d
2020-02-26 15:32:04 -08:00
Tomasz Wasilczyk
793fab0b07 Add ICanController BAD_SERVICE_NAME error
Bug: 137798319
Test: VTS
Change-Id: I4722346239728f3ab359688658c23441e83671a8
2020-02-20 17:10:23 +00:00
Tomasz Wasilczyk
f3da9b6c1b Simplify bus configuration.
Previous bus configuration struct was meant for flexibility, but it
turned out that the only dimension that flexibility would go was a
serial number parameter. Let's rotate that configuration matrix by 90
degrees and just go a straightforward route of discriminating against
interface type.

Test: VTS
Bug: 135918744
Change-Id: I08967d0f78c998b0582958eb51bd387f9dbe15fe
2020-02-19 16:29:25 -08:00
chrisweir
204b8f9206 Refactor baudrate to bitrate
Refactoring baudrate to bitrate to be consistent with terminology in
the broader literature.

Bug: 147448388
Test: Manual + VTS
Change-Id: I161b39727a3fd50ea5eddafed6fbd4924ccd149f
2020-01-11 01:05:59 +00:00
chrisweir
39187dbbff Add support for registering existing interfaces
This adds support for native and slcan interfaces which are already
configured up to be registered in the CAN bus HAL.

Bug: 142655647
Test: manual
Change-Id: Ifd129db14dbf473bb627ebc9b9d13f5cb945b611
2020-01-07 15:49:15 -08:00
chrisweir
f53a4e2ff3 Add VTS tests for EFF/RTR
Remote transmission request, and extended format id's require testing to
verify that the feature works correctly.

Also included is a fix which correctly sets the EFF and RTR flags of the
canfd_frame object based on the state of the CanMessage object.

A readability change is made to the types.hal which improves clarity of
the way filters are defined.

Bug: 146173498
Test: run the VTS tests in vts/functional - verify that they pass
Change-Id: I9892a2e2465b8c381774e7ee277bfa8660f25028
2020-01-06 10:05:25 -08:00
Tomasz Wasilczyk
f9e869e277 CAN bus HAL VTS: read interface names from device manifest
Bug: 143635976
Test: VTS
Change-Id: I99dc0de992dff8ffef03572fd38f57f38b7975ab
2020-01-02 14:31:29 -08:00
Tomasz Wasilczyk
55f21936e9 Migrate CAN bus HAL to nested namespaces
Test: it builds
Change-Id: I83d9ef4f1fff1585e6487c95f09b55b1aa5b3e63
2019-12-20 09:20:24 -08:00
chrisweir
bee3d2c3c9 Add support for error, RTR, and EFF frames
Error frames, remote transmission request, and extended format frames
require some changes to the way that we set up our sockets.

Bug: 142655821
Bug: 144774939
Test: manual
Change-Id: I06212cb852d480c1c7093e8c509ca8aa9f85f81f
2019-12-12 14:21:38 -08:00
Tomasz Wasilczyk
201734e551 Fix sp<> crash on stack-allocated service object.
Bug: 145609858
Test: build, boot
Change-Id: Ia705750c77ee8ba950d19eae9bbd208b0dac2310
2019-12-05 13:54:50 -08:00
chrisweir
cf36cea092 Add support for SLCAN
* Adding support for SLCAN type interfaces
* Made some of the formatting more consistent

Bug: 142656299
Test: Manually with canhalctrl, canhaldump, and canhalsend
Change-Id: Ifa4c234beb75f8a0ea93bfd75555c5ed8d68dca4
2019-11-13 09:42:27 -08:00