Android Automotive

That’s a good indication it’s time to start a new thread.
It’s hard for people to find answers to their questions if they’re buried in unrelated topics.

Have you had any luck using the socket to send data to the virtual HAL?

True story ! I’ll start a new thread for that.

It’s on development ! I’ll keep you in touch. :slight_smile:

1 Like

I’d appreciate that.
I’ve not had time to go back and look at creating an emulator that uses those sockets yet.

The HAL will be the client and will connect to my ValueGenerator which is the server.
Then I’ll do as the FakeValueGenerator of Google, I’ll call the HAL interface to notify applications. Will be something like that.

I think it should work.

I understand where you are coming from with the question, and in fact, how it actually does apply to automotive → android automotive has been demonstrated to render separate displays. One display for the main IVI, and a second display for the instrument panel. I believe that this would actually require multi-display hardware, which sadly, the hikey960 does not have.

1 Like

I have a question about Vehicle HAL.

I found someting very mysterious in VehicleHalManager.cpp (hardware/interfaces/automotive/vehicle/2.0/) I have :
#include <android/hardware/automotive/vehicle/2.0/BpHwVehicleCallback.h>
and in the VehicleHalManager.h, I have a #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>

But I don’t find those 2 files IVehicle.h and BpHwVehicleCallback.h and the compilation is passing.

#EDIT
Even on the VehicleService.cpp I don’t find any registerAsService method on the class VehicleHalManager.cpp

Do you have an idea where are they ?

Thanks

It’s not that mysterious.
Those header files are generated by the build system and placed into an intermediates directory of the out folder.
The make system knows where to find them.

This is why <header.h> is used instead of "header.h".
The includes path is set globally.

Just a note on these headers, you shouldn’t directly include anything but IVehicle.h in your code.
The others are for internal purposes.

As for the “missing” registerAsService function.
It’s there. It’s part of a generated base class that all HIDL HALs inherit from.
It takes a bit of digging to find it in the out directory and I can never quite remember which file it is, but if you keep finding and greping for base classes you’ll eventually find it.

1 Like

The Socket communication works like a charm :smiley: :+1:

Hello @rubberduck203

Did you try to add a custom data to the types.hal ?

Hello everyone, Hello back @doitright

I have a question about the build system of AOSP, I added some code on device/linaro/hikey/

I created a folder MyCode and I have an Android.bp to build it.
I added this folder to the hikey960_car.mk like that PRODUCT_PACKAGE += MyCode
But it seems that it’s not built, the build system does not build the new binary.

Do you know what I have to do?

Thanks for help.

The root Android.bp does not do a recursive include as the root Android.mk file does. It only calls the one in the bluetooth subdirectory.

So you will either have to write it as an Android.mk, or add your include to the root.

1 Like

Hello @doitright

Do you know if there is the can driver supported by Hikey.
If not, how to integrate it ?
I would like to read some data from my USB/CAN module.

[ 1372.025150] usb 1-1.2.1: new full-speed USB device number 18 using xhci-hcd
[ 1372.152839] usb 1-1.2.1: New USB device found, idVendor=0c72, idProduct=000c
[ 1372.160150] usb 1-1.2.1: New USB device strings: Mfr=0, Product=3, SerialNumber=0
[ 1372.168214] usb 1-1.2.1: Product: VER1:PEAK
[ 1372.168214] VER2:02.8.01
[ 1372.168214] DAT :06.05.2004
[ 1372.168214] TIME:09:35:37
[ 1372.168214]

Looks like there is kernel support missing. I think the kernel logs
should be a bit noisier than that.

Does you kernel have CONFIG_CAN_PEAK_USB enabled?

Of course, once you have the CAN bus exposed to the kernel you still
have to do a bit of Android hacking to get the rest of the way…

1 Like

Thanks @danielt by adding CONFIG_CAN_PEAK_USB=y & CONFIG_CAN=y to the config the device is now able to be detected properly :slight_smile:

Hello everyone,

I’m trying to start a deamon (which will restart automatically if it’s killed or if it crashs).

@doitright I just followed the way you did “swid”.
My binary is on /system/vendor/hw/bin/

I added these lines on init.common.rc in /device/linaro/hikey/

service mybinary /system/vendor/bin/hw/mybinary
    class main
    user root
    group root
    critical

I added the mybinary.te like following :
https://gist.github.com/AhmedX6/61659b52231a8392d2f0791ec645a969

and in the file_contexts I added this line :
`/(system|system|vendor)/bin/hw/mybinary u:object_r:mybinary_exec:s0

But the service is not starting on boot.

I even tried to force start it after on property:sys.boot_completed=1
by adding this line : start mybinary

Is there any way to log what’s happening on native services ? Or is there anything I’m missing ?

EDIT : I get this log on dmesg :
71.414623] init: Command 'start mybinary' action=sys.boot_completed=1 (/init.hikey960.rc:94) took 0ms and failed: Could not start service: File /system/vendor/bin/hw/mybinary(labeled "u:object_r:vendor_file:s0") has incorrect label or no domain transition from u:r:init:s0 to another SELinux domain defined. Have you configured your service correctly?

Thank you for help.

The kernel log is very comprehensive in this case. It says that your file has the context “vendor_file”, which appears to not be what you intended it to be.

If your addition to file_contexts is copied accurately, then you have an error in specifying the path. The second ‘|’ should be a ‘/’.

Yes that was the problem, now it starts… Lack of attention. Thanks.

I did a repo sync and now I have a duplicate attribute vehicle_hal on sepolicy. Do you know where does that come from ? The path of duplicate is : package/services/Car/car_product/sepolicy/attributes.

I’m aligned with the last commit on https://github.com/HiKey960-Car/android_device_linaro_hikey on branch mar2218.

I have not resynced since March 22, and I have no immediate intention to do so, since my project is at a stage where I’ve moved from the software to hardware (I’m developing a 3x4 inch automotive specific mezzanine board that will replace about a cubic foot of hardware), at least for the moment. Once I have my board assembled (waiting on a box of parts from mouser), I’ll get back to software. First of course, I’m going to get the new hardware working, then I’ll resync.

My suggestion for the time being is either to use one of the pinned manifests from around March 22, or you will probably have to muddle through it on your own mostly.

There is one from March 27 which my code is almost certainly going to work with. You could also try stepping forward and finding out what the newest one is that my code works with unaltered.

Ok then ! I’ll keep you in touch. :slight_smile: thanks

@doitright

During a call I’m not able to hear my correspondant and he’s not able to hear me.
I just disabled the i2S from the kernel because the audio was configured to i2s and I only had an usb audio xhci-hcd.

I got this log from usb_audio HAL :
06-07 12:44:09.282 2335 6207 D modules.usbaudio_hal.hikey: adev_set_parameters: kvpairs: hfp_set_sampling_rate=16000
06-07 12:44:09.284 2335 6207 D modules.usbaudio_hal.hikey: adev_set_parameters: kvpairs: hfp_enable=true
06-07 12:44:09.290 2335 15834 D modules.usbaudio_hal.hikey: runsco: USBCARD: 0, BTCARD: -1
06-07 12:44:09.291 2335 6207 D modules.usbaudio_hal.hikey: adev_set_parameters: kvpairs: hfp_volume=1

This thread was talking about same problem : HFP Client SCO audio routing? - #116 by shanvasu

Did you add some fix on this ?

Thank you