• spiiroin's avatar
    [usb_moded] Explicitly start/stop mtp daemon. Fixes JB#41748 · 041d46de
    spiiroin authored
    The mtp functionality is started roughly as follows:
    1. usb-moded completes whole gadget configuration, and then
    2. signals mtp mode activation on D-Bus
    3. msyncd sees the mode change and loads mtp plugin
    4. mtp plugin writes endpoint configuration, and then
    5. scans storage ares to enumerate files exposed via mtp, but
    6. does not really respond to ptp/mtp requests until storages are ready
    The problems are:
    While the above sequence has worked with with android usb, it does cause
    timing issues for usb enumeration and longer than expected response times
    from pc side mtp initiator point of view.
    Additionally when configfs is used, the gadget configuration can't even
    be completed before mtp daemon gets a chance to write configuration data
    to the control endpoint.
    To remedy the situation the following changes are made:
    1. buteo-mtp-qt5-sync-plugin package is removed from the system -> mtp
       functionality is no longer handled by msyncd process
    2. mtp daemon is made to enumerate storage content before writing config
       data to control endpoint -> when usb enumeration is possible, mtp
       daemon is already ready to handle commands from initiator
    3. usb-moded explicitly starts/stops mtp daemon when it is about to
       activate/deactivate mtp_mode -> usb stays configured in charging
       mode until it is ready to handle mtp
    This patch handles step (3). Step (2) is in buteo-mtp-qt5 >= 0.5.0,
    and (1) needs to be fixed in device specific package configuration.
    Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
usb-moded.spec 17 KB