Fixed to stop services of functionfs when gadget is disabled 64/227364/1
authorINSUN PYO <insun.pyo@samsung.com>
Wed, 11 Mar 2020 08:46:35 +0000 (17:46 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 11 Mar 2020 11:09:37 +0000 (11:09 +0000)
commitbadcd3d173b941092a574c1ac9ae569a54561e06
tree842e87fba52323d032e064b9036f8f5b9b5672d1
parent1597945b5d5ba24dc166ec26be3a21727d3f40ca
Fixed to stop services of functionfs when gadget is disabled

sdb.service and mtp-responder.service are alive when the usb cable is unplugged in the configfs environment.

If the usb cable is disconnected, gadget disable is called.
These services are stopped when the gadget is disabled.

Caution 1
Note that the socket units for these services should remain.
The scoket unit has ep0 in the functionfs environment.
If ep0 disappears because the socket unit is stopped, the functionfs can never be enabled.

Caution 2
Since ffs_service works by socket activation, it will be started automatically when data is enqueued to the usb socket.
So when enabling configfs gadget, it doesn't start ffs_service.

Change-Id: I660e0cf157320f6a4e8f152a028772547dd701f6
(cherry picked from commit 5e9327a2d5b5215b4371b406339dc83a89891074)
hw/usb_cfs_client_common.c
hw/usb_gadget.h