Hi Senthil, Chris,

Thank you for your answers,

Senthil, the udev rule is triggered each time my device switch from fastboot to adb mode or from adb to fastboot mode. I tried the process of switching from adb to fastboot mode and vice versa in the container. Before that, I uninstalled fastboot and adb packages from the host so there is no way the adb and fastboot daemons of the host are creating conflicts with the fastboot and adb deamons of the container.

Each time the device enters adb mode, the udev rule is triggered and I can find the device with the command adb devices. But each time the device switchs to fastboot mode, I can 't see it with the command fastboot devices. I can see that the udev rule is triggered in the logs but the device is still not appearing. I even did a "lxc-device -n myLxcName add /dev/bus/usb/001/056" manually to add the device to the container in fastboot mode. The add process was done properly but there was still no fastboot device visible.

Chris, my container is successfully adding the usb device each time it is plugged. In adb mode, I can easily run Android CTS or Android VTS test suites on the device.  So I think the container have access to "/dev/bus/usb" and also to the host's network stack.

Someone told me he had to add an additional mount entry into /usr/share/lxc/config/debian.common.conf otherwise fastboot could not see his device from the container. I will explore that option.

I am still looking for a way to fix my issue anyway.


On 8 April 2018 at 14:47, Senthil Kumaran S <senthil.kumaran@linaro.org> wrote:
Hi Conrad,

On Sunday 08 April 2018 06:39 PM, Conrad Djedjebi wrote:
> I am currently running jobs on a device through adb without issues. LAVA
> is adding udev rules which make it possible for the LXC container to
> successfully attach the target. 
> However, when the device turns into fastboot mode, a "fastboot devices"
> command in the LXC returns nothing. In fastboot mode, the USB link of
> the device is added whereas the device is not listed among the fastboot
> devices.

The udev rules gets applied only when the device gets re-enumerated /
restarted ie., on an udev add event. Otherwise the udev rule will not
get applied to a device. For devices that are attached already when the
job starts or if the device will not get re-enumerated, then use
static_info as seen here -
along with the device_info variable in the device dictionary.

> In the host, a "fastboot devices" command returns the id of the device.

I haven't faced this. But on the other hand when the host runs adb
daemon, then it takes control of all the devices and the devices will
not be visible from within the containers (LXC), even when the udev rule
is applied. So care should be taken that 'adb' daemon is not running on
the host. It is good, not to run any operation with fastboot too on the
host, when the device is accessed via a container within the same host.

Thank You.
Senthil Kumaran S