def activate(self, mac):
        assert type(mac) in (nfc.dep.Initiator, nfc.dep.Target)
        self.mac = None
        
        miu = self.cfg['recv-miu']
        lto = self.cfg['send-lto']
        wks = 1+sum(sorted([1<<sap for sap in self.snl.values() if sap < 15]))
        pax = ParameterExchange(version=(1,1), miu=miu, lto=lto, wks=wks)
        
        if type(mac) == nfc.dep.Initiator:
            gb = mac.activate(gbi='Ffm'+pax.to_string()[2:])
            self.run = self.run_as_initiator
            role = "Initiator"
        if type(mac) == nfc.dep.Target:
            gb = mac.activate(gbt='Ffm'+pax.to_string()[2:], wt=9)
            self.run = self.run_as_target
            role = "Target"

        if gb is not None and gb.startswith('Ffm') and len(gb) >= 6:
            info = ["LLCP Link established as NFC-DEP {0}".format(role)]

            info.append("Local LLCP Settings")
            info.append("  LLCP Version: {0[0]}.{0[1]}".format(pax.version))
            info.append("  Link Timeout: {0} ms".format(pax.lto))
            info.append("  Max Inf Unit: {0} octet".format(pax.miu))
            info.append("  Service List: {0:016b}".format(pax.wks))

            pax = ProtocolDataUnit.from_string("\x00\x40" + str(gb[3:]))
            info.append("Remote LLCP Settings")
            info.append("  LLCP Version: {0[0]}.{0[1]}".format(pax.version))
            info.append("  Link Timeout: {0} ms".format(pax.lto))
            info.append("  Max Inf Unit: {0} octet".format(pax.miu))
            info.append("  Service List: {0:016b}".format(pax.wks))
            log.info('\n'.join(info))

            self.cfg['rcvd-ver'] = pax.version
            self.cfg['send-miu'] = pax.miu
            self.cfg['recv-lto'] = pax.lto
            self.cfg['send-wks'] = pax.wks
            self.cfg['send-lsc'] = pax.lsc
            log.debug("llc cfg {0}".format(self.cfg))
            
            if type(mac) == nfc.dep.Initiator and mac.rwt is not None:
                max_rwt = 13.56E6 * 2**10/4096
                if mac.rwt > max_rwt:
                    log.warning("NFC-DEP RWT {0:.3f} exceeds max {1:.3f} sec"
                                .format(mac.rwt, max_rwt))

            self.mac = mac

        return bool(self.mac)
dataset/ETHPy150Open javgh/greenaddress-pos-tools/nfc/llcp/llc.py/LogicalLinkController.activate/swapped operands of `/`