Skip to content
  • Thomas Haller's avatar
    wwan: mark modems that are taken by a NMDevice as "claimed" · 6d644c66
    Thomas Haller authored
    NMModem-s are either used by NMDeviceModem or by NMDeviceBt.
    The mechanism how that is coordinated it odd:
    
      - the factory emits component-added, and then NMDeviceBt
        might take the device (and claim it). In that case, component-added
        would return TRUE to indicate that the modem should not be also
        used by NMDeviceModem.
    
      - next, if the modem has a driver that looks like bluetooth, NMDeviceModem
        ignores it too.
    
      - finally, NMDeviceModem claims the modem (which is now considered to
        be non-bluetooth).
    
    I think the first problem is that the device factory tries to have this
    generic mechanism of "component-added". It's literally only used to
    cover this special case. Note that NMDeviceBt is aware of modems. So,
    abstracting this just adds lots of code that could be solved better
    by handling the case (of giving the modem to either NMDeviceBt or
    NMDeviceModem) specifically.
    
    NMWWanFactory itself registers to the NM_MODEM_MANAGER_MODEM_ADDED
    signal and emits nm_device_factory_emit_component_added().
    We could just have NMWWanFactory and NMDeviceBt both register to
    that signal. Signals even support priorities, so we could have
    NMDeviceBt be called first to claim the device.
    
    Anyway, as the modem can only have one owner, the modem should have
    a flag that indicates whether it's claimed or not. That will allow
    multiple components all look at the same modem and moderate who is
    going to take ownership.
    6d644c66