[PATCH] [neard][RFC] test: Convert Python2 scripts to Python3
by Mark Greer
Python2 is deprecated so convert the neard test scripts, which are
Python2, to Python3.
Signed-off-by: Mark Greer <mgreer(a)animalcreek.com>
---
This is a first pass at converting the python scripts to Python3.
Not a lot of testing yet. It appears that the 'gobject' is not
available anymore so I have to look into how to rework the code that
uses it.
I would appreciate any testing that you are willing to provide.
Also available at:
https://github.com/linux-nfc/neard/tree/mag/python3-ize
se/test/test-channel | 18 +++++------
se/test/test-seel | 38 +++++++++++-----------
test/bt-handover | 8 ++---
test/handover-agent | 34 +++++++++----------
test/monitor-near | 8 ++---
test/ndef-agent | 20 ++++++------
test/neard-ui.py | 70 ++++++++++++++++++++--------------------
test/neardutils.py | 14 ++++----
test/phdc-simple-manager | 50 ++++++++++++++--------------
test/test-adapter | 16 ++++-----
test/test-device | 34 +++++++++----------
test/test-tag | 10 +++---
12 files changed, 160 insertions(+), 160 deletions(-)
diff --git a/se/test/test-channel b/se/test/test-channel
index e6ed0114c8c8..600ab8647e08 100755
--- a/se/test/test-channel
+++ b/se/test/test-channel
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
@@ -9,10 +9,10 @@ def extract_byte_array(byte_array):
return ' '.join("{:02x}".format(byte) for byte in byte_array)
def usage():
- print "Usage: %s <command>" % (sys.argv[0])
- print ""
- print " list"
- print " send_apdu se/nfcX_<se_type>_seX channelX <apdu>"
+ print("Usage: %s <command>" % (sys.argv[0]))
+ print("")
+ print(" list")
+ print(" send_apdu se/nfcX_<se_type>_seX channelX <apdu>")
sys.exit(1)
if (len(sys.argv) < 2):
@@ -29,7 +29,7 @@ if (sys.argv[1] == "list"):
properties = seel.GetProperties()
for path in properties["Channels"]:
- print "[ %s ]" % (path)
+ print("[ %s ]" % (path))
channel = dbus.Interface(bus.get_object("org.neard.se", path),
"org.neard.se.Channel")
@@ -41,10 +41,10 @@ if (sys.argv[1] == "list"):
val = "true"
else:
val = "false"
- print " %s = %s" % (key, val)
+ print(" %s = %s" % (key, val))
if key in ["AID"]:
- print " %s = %s" % (key, extract_byte_array(properties[key]))
+ print(" %s = %s" % (key, extract_byte_array(properties[key])))
sys.exit(0)
if (sys.argv[1] == "send_apdu"):
@@ -58,7 +58,7 @@ if (sys.argv[1] == "send_apdu"):
response = channel.SendAPDU(sys.argv[4].decode("hex"))
- print "--> %s" % extract_byte_array(response)
+ print("--> %s" % extract_byte_array(response))
sys.exit(0)
usage()
diff --git a/se/test/test-seel b/se/test/test-seel
index e238a38851a9..2b877daf5bd1 100755
--- a/se/test/test-seel
+++ b/se/test/test-seel
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
@@ -13,12 +13,12 @@ def extract_list(list):
return val
def usage():
- print "Usage: %s <command>" % (sys.argv[0])
- print ""
- print " list"
- print " enabled se/nfcX_<se_type>_seX [on/off]"
- print " open_channel se/nfcX_<se_type>_seX <AID>"
- print " close_channel se/nfcX_<se_type>_seX channelX"
+ print("Usage: %s <command>" % (sys.argv[0]))
+ print("")
+ print(" list")
+ print(" enabled se/nfcX_<se_type>_seX [on/off]")
+ print(" open_channel se/nfcX_<se_type>_seX <AID>")
+ print(" close_channel se/nfcX_<se_type>_seX channelX")
sys.exit(1)
if (len(sys.argv) < 2):
@@ -33,7 +33,7 @@ if (sys.argv[1] == "list"):
properties = manager.GetProperties()
for path in properties["SecureElements"]:
- print "[ %s ]" % (path)
+ print("[ %s ]" % (path))
seel = dbus.Interface(bus.get_object("org.neard.se", path),
"org.neard.se.SecureElement")
@@ -45,13 +45,13 @@ if (sys.argv[1] == "list"):
val = "true"
else:
val = "false"
- print " %s = %s" % (key, val)
+ print(" %s = %s" % (key, val))
if key in ["Type"]:
- print " %s = %s" % (key, str(properties[key]))
+ print(" %s = %s" % (key, str(properties[key])))
if key in ["Channels"]:
- print " %s = %s" % (key, extract_list(properties[key]))
+ print(" %s = %s" % (key, extract_list(properties[key])))
sys.exit(0)
if (sys.argv[1] == "enabled"):
@@ -69,10 +69,10 @@ if (sys.argv[1] == "enabled"):
elif (sys.argv[3] == "off"):
val = seel.SetProperty("Enabled", dbus.Boolean(0), timeout = 10)
else:
- print "Invalid option %s" % sys.argv[3]
+ print("Invalid option %s" % sys.argv[3])
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
sys.exit(0)
if (sys.argv[1] == "open_channel"):
@@ -87,9 +87,9 @@ if (sys.argv[1] == "open_channel"):
try:
channel = seel.OpenChannel(sys.argv[3].decode("hex"))
- print "Opened channel: %s" % str(channel)
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ print("Opened channel: %s" % str(channel))
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
sys.exit(0)
if (sys.argv[1] == "close_channel"):
@@ -107,8 +107,8 @@ if (sys.argv[1] == "close_channel"):
try:
seel.CloseChannel(channel)
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
sys.exit(0)
usage()
diff --git a/test/bt-handover b/test/bt-handover
index 42d66bff8d66..f6921d2b4534 100755
--- a/test/bt-handover
+++ b/test/bt-handover
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import os
import sys
@@ -14,7 +14,7 @@ from dbus.lowlevel import MethodCallMessage, HANDLER_RESULT_NOT_YET_HANDLED
mainloop = gobject.MainLoop()
def device_added(path, interfaces):
- for iface, props in interfaces.iteritems():
+ for iface, props in interfaces.items():
if "org.neard.Device" in interfaces:
print("Pairing with %s" % (path))
device = dbus.Interface(bus.get_object("org.neard", path),
@@ -34,7 +34,7 @@ def remove_paired_devices(bt_adapter):
"org.freedesktop.DBus.ObjectManager")
objects = manager.GetManagedObjects()
- all_adapters = (path for path, interfaces in objects.iteritems() if
+ all_adapters = (path for path, interfaces in objects.items() if
"org.bluez.Adapter1" in interfaces.keys()
and path.endswith(bt_adapter))
@@ -60,7 +60,7 @@ def remove_paired_devices(bt_adapter):
print("Bluetooth adapter %s is not powered" % adapter_path )
exit()
- all_devices = (path for path, interfaces in objects.iteritems() if
+ all_devices = (path for path, interfaces in objects.items() if
("org.bluez.Device1" in interfaces.keys()
and path.startswith(bluez_adapter.object_path)))
diff --git a/test/handover-agent b/test/handover-agent
index 7f2ac23246b0..a1b42d9f890e 100755
--- a/test/handover-agent
+++ b/test/handover-agent
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import gobject
@@ -23,18 +23,18 @@ power_state = None
def print_fields(fields):
if 'EIR' in fields:
s = ' '.join('{:#02x}'.format(i) for i in fields['EIR'])
- print ' EIR: %s' % s
+ print(' EIR: %s' % s)
if 'nokia.com:bt' in fields:
s = ' '.join('{:#02x}'.format(i) for i in fields['nokia.com:bt'])
- print ' nokia.com:bt: %s' % s
+ print(' nokia.com:bt: %s' % s)
if 'State' in fields:
- print ' State: %s' % fields['State']
+ print(' State: %s' % fields['State'])
if 'WSC' in fields:
s = ' '.join('{:#02x}'.format(i) for i in fields['WSC'])
- print ' WSC: %s' % s
+ print(' WSC: %s' % s)
class BTHOAgent(dbus.service.Object):
@@ -42,14 +42,14 @@ class BTHOAgent(dbus.service.Object):
in_signature='',
out_signature='')
def Release(self):
- print 'Release'
+ print('Release')
mainloop.quit()
@dbus.service.method('org.neard.HandoverAgent',
in_signature='a{sv}',
out_signature='')
def PushOOB(self, fields):
- print 'PushOOB'
+ print('PushOOB')
print_fields(fields)
@dbus.service.method('org.neard.HandoverAgent',
@@ -57,15 +57,15 @@ class BTHOAgent(dbus.service.Object):
out_signature='a{sv}')
def RequestOOB(self, fields):
- print 'RequestOOB'
+ print('RequestOOB')
print_fields(fields)
- print ' Replying with'
+ print(' Replying with')
s = ' '.join('{:#02x}'.format(i) for i in eir_test_data)
- print ' EIR: %s' % s
+ print(' EIR: %s' % s)
if power_state != 'unknown':
- print ' State: %s' % power_state
+ print(' State: %s' % power_state)
return {'EIR' : eir_test_data, 'State' : power_state}
else:
return {'EIR' : eir_test_data}
@@ -76,14 +76,14 @@ class WiFiHOAgent(dbus.service.Object):
in_signature='',
out_signature='')
def Release(self):
- print 'Release'
+ print('Release')
mainloop.quit()
@dbus.service.method('org.neard.HandoverAgent',
in_signature='a{sv}',
out_signature='')
def PushOOB(self, fields):
- print 'PushOOB'
+ print('PushOOB')
print_fields(fields)
@dbus.service.method('org.neard.HandoverAgent',
@@ -91,15 +91,15 @@ class WiFiHOAgent(dbus.service.Object):
out_signature='a{sv}')
def RequestOOB(self, fields):
- print 'RequestOOB'
+ print('RequestOOB')
print_fields(fields)
- print ' Replying with'
+ print(' Replying with')
s = ' '.join('{:#02x}'.format(i) for i in wsc_test_data)
- print ' WSC: %s' % s
+ print(' WSC: %s' % s)
if power_state != 'unknown':
- print ' State: %s' % power_state
+ print(' State: %s' % power_state)
return {'WSC' : wsc_test_data, 'State' : power_state}
else:
return {'WSC' : wsc_test_data}
diff --git a/test/monitor-near b/test/monitor-near
index f3ad021d60a3..ee0cb4177ae3 100755
--- a/test/monitor-near
+++ b/test/monitor-near
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
from __future__ import absolute_import, print_function, unicode_literals
@@ -9,15 +9,15 @@ import dbus.mainloop.glib
def property_changed(interface, changed, invalidated, path):
iface = interface[interface.rfind(".") + 1:]
- for name, value in changed.iteritems():
+ for name, value in changed.items():
val = str(value)
print("{%s.PropertyChanged} [%s] %s = %s" % (iface, path, name,
val))
def interfaces_added(path, interfaces):
- for iface, props in interfaces.iteritems():
+ for iface, props in interfaces.items():
print("{Added %s} [%s]" % (iface, path))
- for name, value in props.iteritems():
+ for name, value in props.items():
print(" %s = %s" % (name, value))
def interfaces_removed(path, interfaces):
diff --git a/test/ndef-agent b/test/ndef-agent
index 1cfeb03e2330..084768bf0e5c 100755
--- a/test/ndef-agent
+++ b/test/ndef-agent
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import gobject
@@ -12,43 +12,43 @@ class NDEFAgent(dbus.service.Object):
@dbus.service.method("org.neard.NDEFAgent",
in_signature='', out_signature='')
def Release(self):
- print "Release"
+ print("Release")
mainloop.quit()
@dbus.service.method("org.neard.NDEFAgent",
in_signature='a{sv}',
out_signature='')
def GetNDEF(self, fields):
- print "GetNDEF"
+ print("GetNDEF")
if fields.has_key("Record"):
- print "Record path %s" % (fields["Record"])
+ print("Record path %s" % (fields["Record"]))
if fields.has_key("Payload"):
val = "["
for i in fields["Payload"]:
val += " 0x%x" % i
val += " ]"
- print "Record payload %s" % val
+ print("Record payload %s" % val)
if fields.has_key("NDEF"):
val = "["
for i in fields["NDEF"]:
val += " 0x%x" % i
val += " ]"
- print "Complete NDEF %s" % val
+ print("Complete NDEF %s" % val)
return
@dbus.service.method("org.neard.NDEFAgent",
in_signature='', out_signature='')
def Cancel(self):
- print "Cancel"
+ print("Cancel")
def print_usage():
- print "Usage:"
- print "%s Type=<record type>" % (sys.argv[0])
- print "Help: %s help" % (sys.argv[0])
+ print("Usage:")
+ print("%s Type=<record type>" % (sys.argv[0]))
+ print("Help: %s help" % (sys.argv[0]))
sys.exit(1)
if __name__ == '__main__':
diff --git a/test/neard-ui.py b/test/neard-ui.py
index cf4bb13c5155..91f8e6bbaa6a 100755
--- a/test/neard-ui.py
+++ b/test/neard-ui.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import pdb
import sys
@@ -18,12 +18,12 @@ import neardutils
class Neard:
def interface_Added(self, path, interface):
- print (" New interface added: %s") % path
+ print((" New interface added: %s") % path)
self.objects = neardutils.get_managed_objects()
self.interface_updateDetails(interface, path)
def interface_Removed(self, path, interface):
- print (" Remove interface: %s") % path
+ print((" Remove interface: %s") % path)
self.objects = neardutils.get_managed_objects()
self.interface_updateDetails(interface)
@@ -32,7 +32,7 @@ class Neard:
#add/remove interface
def interfaces_Connect(self):
try:
- print 'interfaces_Connect'
+ print('interfaces_Connect')
bus = dbus.SystemBus()
self.objects = neardutils.get_managed_objects()
bus.add_signal_receiver(self.interface_Added, bus_name=neardutils.SERVICE_NAME,
@@ -42,7 +42,7 @@ class Neard:
dbus_interface="org.freedesktop.DBus.ObjectManager",
signal_name="InterfacesRemoved")
except:
- print ("Can't connect to org.freedesktop.DBus.ObjectManager");
+ print(("Can't connect to org.freedesktop.DBus.ObjectManager"));
self.objects = None
#Retrieve the manager informations
@@ -60,7 +60,7 @@ class Neard:
self.record_updateDetails(path)
def adapter_PropertyChanged(self, prop, value, adapt_path = None):
- print("Prop changed: %s") % prop
+ print(("Prop changed: %s") % prop)
adapt_properties = {}
adapt_properties[prop] = value
if prop == "Tags":
@@ -71,7 +71,7 @@ class Neard:
#Update the records UI
def record_updateDetails(self, tag_path=None):
if tag_path is not None:
- for record_path, record_iface in self.objects.iteritems():
+ for record_path, record_iface in self.objects.items():
if neardutils.RECORD_INTERFACE not in record_iface:
continue
@@ -88,11 +88,11 @@ class Neard:
#Update the tags UI
def tag_updateDetails(self, adapter_path=None):
if adapter_path is not None:
- for tag_path, interfaces in self.objects.iteritems():
+ for tag_path, interfaces in self.objects.items():
if neardutils.TAG_INTERFACE not in interfaces:
continue
- print ("TAG %s ") % tag_path
+ print(("TAG %s ") % tag_path)
tag_properties = interfaces[neardutils.TAG_INTERFACE]
@@ -102,19 +102,19 @@ class Neard:
#Process the records
self.record_updateDetails(tag_properties)
else:
- print ("remove tags and records")
+ print("remove tags and records")
self.tags_update()
self.records_update()
#Something changed, must update the UI
def adapter_updateDetails(self):
- for adapt_path, interfaces in self.objects.iteritems():
+ for adapt_path, interfaces in self.objects.items():
if neardutils.ADAPTER_INTERFACE not in interfaces:
continue
if adapt_path in self.adaptregistered:
- print (" already registered %s") % adapt_path
+ print((" already registered %s") % adapt_path)
else:
adapt_properties = interfaces[neardutils.ADAPTER_INTERFACE]
@@ -179,16 +179,16 @@ class NeardUI(Neard):
try:
if self.adapters_actionToggle(i, 2):
- print ("Disable Adapter %s") % objpath
+ print(("Disable Adapter %s") % objpath)
adapter.Set(neardutils.ADAPTER_INTERFACE, "Powered", False)
self.adapters_list.set_value(i, 2, 0)
else:
- print ("Enable Adapter %s") % objpath
+ print(("Enable Adapter %s") % objpath)
adapter.Set(neardutils.ADAPTER_INTERFACE, "Powered", True)
self.adapters_list.set_value(i, 2, 1)
except:
- print ("Can't toggle adapter %s") % objpath
+ print(("Can't toggle adapter %s") % objpath)
# Action: activate or not the polling mode
def adapter_pollingToggled(self, poolingRendererToggle, path, user):
@@ -199,15 +199,15 @@ class NeardUI(Neard):
try:
if self.adapters_actionToggle(i, 3):
- print ("Stop Polling %s") % objpath
+ print(("Stop Polling %s") % objpath)
adapt_iface.StopPollLoop()
self.adapters_list.set_value(i, 3, 0)
else:
- print ("Start Polling %s") % objpath
+ print(("Start Polling %s") % objpath)
adapt_iface.StartPollLoop("Initiator")
self.adapters_list.set_value(i, 3, 1)
except:
- print ("Can't toggle polling on adapter %s") % objpath
+ print(("Can't toggle polling on adapter %s") % objpath)
#------------------------------
#Set the field values
@@ -238,7 +238,7 @@ class NeardUI(Neard):
if value is not None:
self.adapters_list.set_value(i, col, value)
- print (" property %s, value %s") % (name, value)
+ print((" property %s, value %s") % (name, value))
# Clear one or all the adapters present in list
def adapter_RemoveUI(self):
@@ -254,18 +254,18 @@ class NeardUI(Neard):
if adapt_properties is None:
if i:
- print ("Delete adapter %s") % path
+ print(("Delete adapter %s") % path)
self.adapters_list.remove(i)
else:
- print ("Already deleted adapter %s") % path
+ print(("Already deleted adapter %s") % path)
return
if i is None:
i = self.adapters_list.append()
self.adapters_list.set_value(i, 0, path)
- print ("Add adapter %s") % (path)
+ print(("Add adapter %s") % (path))
else:
- print ("Update adapter %s") % (path)
+ print(("Update adapter %s") % (path))
self.adapters_setUIList(adapt_properties, i, 2, "Powered")
@@ -289,11 +289,11 @@ class NeardUI(Neard):
if value is not None:
self.tags_list.set_value(i, col, value)
- print (" property %s, value %s") % (name, value)
+ print((" property %s, value %s") % (name, value))
#Add, Update or delete a list entry
def tag_UpdateUI(self, path = None, tag_properties = None):
- print("Tag Update %s") % path
+ print(("Tag Update %s") % path)
i = self.tags_list.get_iter_first()
while i is not None:
if self.tags_list.get_value(i, 0) == path:
@@ -305,7 +305,7 @@ class NeardUI(Neard):
i = self.tags_list.get_iter_first()
while i is not None:
path_name = self.tags_list.get_value(i, 0)
- print ("Deleted tag %s") % path_name
+ print(("Deleted tag %s") % path_name)
self.tags_list.remove(i)
if self.tags_list.iter_is_valid(i):
i = self.tags_list.iter_next(i)
@@ -316,9 +316,9 @@ class NeardUI(Neard):
if i is None:
i = self.tags_list.append()
self.tags_list.set_value(i, 0, path)
- print ("Add tag %s") % (path)
+ print(("Add tag %s") % (path))
else:
- print ("Update tag %s") % (path)
+ print(("Update tag %s") % (path))
self.tags_setUIList(tag_properties, i, 2, "ReadOnly")
self.tags_setUIList(tag_properties, i, 3, "Type")
@@ -336,11 +336,11 @@ class NeardUI(Neard):
if value is not None:
self.records_list.set_value(i, col, value)
- print (" property %s, value %s") % (name, value)
+ print((" property %s, value %s") % (name, value))
#Add, Update or delete a list entry
def record_UpdateUI(self, path = None, record_properties = None):
- print("Record Update %s") % path
+ print(("Record Update %s") % path)
i = self.records_list.get_iter_first()
while i is not None:
if self.records_list.get_value(i, 0) == path:
@@ -352,7 +352,7 @@ class NeardUI(Neard):
i = self.records_list.get_iter_first()
while i is not None:
path_name = self.records_list.get_value(i, 0)
- print ("Delete record %s") % path_name
+ print(("Delete record %s") % path_name)
self.records_list.remove(i)
if self.records_list.iter_is_valid(i):
i = self.records_list.iter_next(i)
@@ -363,9 +363,9 @@ class NeardUI(Neard):
if i is None:
i = self.records_list.append()
self.records_list.set_value(i, 0, path)
- print ("Add record %s") % (path)
+ print(("Add record %s") % (path))
else:
- print ("Update record %s") % (path)
+ print(("Update record %s") % (path))
self.records_setUIList(record_properties, i, 2, "Type")
self.records_setUIList(record_properties, i, 3, "Data")
@@ -379,9 +379,9 @@ class NeardUI(Neard):
model, iter = selection.get_selected()
if iter:
value = self.adapters_list.get_value(iter, 0)
- print ("value %s") % value
+ print(("value %s") % value)
value = self.adapters_list.get_value(iter, 5)
- print ("tag: %s") % value
+ print(("tag: %s") % value)
#-----------------------------------------------------
diff --git a/test/neardutils.py b/test/neardutils.py
index d93ae637bb27..047678b3f8e5 100644
--- a/test/neardutils.py
+++ b/test/neardutils.py
@@ -17,7 +17,7 @@ def find_adapter(pattern=None):
def find_adapter_in_objects(objects, pattern=None):
bus = dbus.SystemBus()
- for path, ifaces in objects.iteritems():
+ for path, ifaces in objects.items():
adapter = ifaces.get(ADAPTER_INTERFACE)
if adapter is None:
continue
@@ -31,7 +31,7 @@ def find_device(pattern=None):
def find_device_in_objects(objects, pattern=None):
bus = dbus.SystemBus()
- for path, ifaces in objects.iteritems():
+ for path, ifaces in objects.items():
device = ifaces.get(DEVICE_INTERFACE)
if device is None:
continue
@@ -45,7 +45,7 @@ def find_tag(pattern=None):
def find_tag_in_objects(objects, pattern=None):
bus = dbus.SystemBus()
- for path, ifaces in objects.iteritems():
+ for path, ifaces in objects.items():
tag = ifaces.get(TAG_INTERFACE)
if tag is None:
continue
@@ -59,7 +59,7 @@ def find_record(pattern=None):
def find_record_in_objects(objects, pattern=None):
bus = dbus.SystemBus()
- for path, ifaces in objects.iteritems():
+ for path, ifaces in objects.items():
record = ifaces.get(RECORD_INTERFACE)
if record is None:
continue
@@ -77,17 +77,17 @@ def dump_record(record_path):
for key in properties.keys():
if key in ["Representation"]:
- val = unicode(properties[key])
+ val = str(properties[key])
else:
val = str(properties[key])
- print " %s = %s" % (key, val)
+ print(" %s = %s" % (key, val))
def dump_all_records(path):
bus = dbus.SystemBus()
om = dbus.Interface(bus.get_object(SERVICE_NAME, "/"),
"org.freedesktop.DBus.ObjectManager")
objects = om.GetManagedObjects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if RECORD_INTERFACE not in interfaces:
continue
diff --git a/test/phdc-simple-manager b/test/phdc-simple-manager
index 4fd25df541d8..2536d4b0c5b7 100755
--- a/test/phdc-simple-manager
+++ b/test/phdc-simple-manager
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
import sys
import dbus
@@ -46,8 +46,8 @@ def hexdump( chars, sep, width ):
line = chars[:width]
chars = chars[width:]
line = line.ljust( width, '\000' )
- print "%s%s%s" % ( sep.join( "%02x" % ord(c) for c in line ),
- sep, quotechars( line ))
+ print("%s%s%s" % ( sep.join( "%02x" % ord(c) for c in line ),
+ sep, quotechars( line )))
def quotechars( chars ):
@@ -57,26 +57,26 @@ def quotechars( chars ):
class PhdcPeerManager:
def __init__(self, agent_fd):
#Grab the agent ....
- print 'Init PhdcPeerManager thread'
+ print('Init PhdcPeerManager thread')
self.r_fd = agent_fd.take()
- print 'Agent fd:', str(self.r_fd)
+ print('Agent fd:', str(self.r_fd))
def run( self):
- print 'Run PhdcPeerManager thread: ', str(self.r_fd)
+ print('Run PhdcPeerManager thread: ', str(self.r_fd))
self.sock = socket.fromfd(self.r_fd, AF_NFC, socket.SOCK_STREAM)
try:
while True:
miu = self.sock.getsockopt(SOL_NFC, NFC_LLCP_MIUX)
- print 'MIU=', miu
+ print('MIU=', miu)
while True:
data = self.sock.recv(16)
if data == None:
- print 'no data'
+ print('no data')
break
#analyze frame
- print 'analyze'
+ print('analyze')
size = struct.unpack(">H", data[0:2])[0]
apdu = data[2:]
@@ -86,7 +86,7 @@ class PhdcPeerManager:
if data == None: break
hexdump(data, ':', 16)
apdu += data
- print "[ieee] <<< {0}".format(str(apdu).encode("hex"))
+ print("[ieee] <<< {0}".format(str(apdu).encode("hex")))
if apdu.startswith("\xE2\x00"):
apdu = bytearray.fromhex(thermometer_assoc_res)
elif apdu.startswith("\xE4\x00"):
@@ -94,26 +94,26 @@ class PhdcPeerManager:
else:
apdu = apdu[::-1]
time.sleep(0.2)
- print "[ieee] >>> {0}".format(str(apdu).encode("hex"))
+ print("[ieee] >>> {0}".format(str(apdu).encode("hex")))
data = struct.pack(">H", len(apdu)) + apdu
for i in range(0, len(data), miu):
self.sock.send(str(data[i:i+miu]))
- print "remote peer {0} closed connection".format(agent_fd)
- print "leaving ieee manager"
+ print("remote peer {0} closed connection".format(agent_fd))
+ print("leaving ieee manager")
self.sock.close()
except IOError as e:
if e.errno == errno.EPIPE:
- print 'Remote disconnect'
+ print('Remote disconnect')
else:
- print "I/O error({0}): {1}".format(e.errno, e.strerror)
+ print("I/O error({0}): {1}".format(e.errno, e.strerror))
finally:
- print 'Finally exit'
+ print('Finally exit')
stop()
def stop(self):
- print 'Stop PhdcPeerManager:', str(self.r_fd)
+ print('Stop PhdcPeerManager:', str(self.r_fd))
self._Thread__stop()
#===================================================
@@ -125,7 +125,7 @@ class SimplePhdcManager(dbus.service.Object):
in_signature='',
out_signature='')
def Release(self):
- print 'Release'
+ print('Release')
mainloop.quit()
@@ -135,11 +135,11 @@ class SimplePhdcManager(dbus.service.Object):
in_signature='h',
out_signature='')
def NewConnection(self, agent_fd):
- print'Launch Phdc Manager thread for fd:', str(agent_fd)
+ print('Launch Phdc Manager thread for fd:', str(agent_fd))
self.server = PhdcPeerManager(agent_fd)
- print'Run Server'
+ print('Run Server')
self.server.run()
- print'Leave Server'
+ print('Leave Server')
return
''' Called when the agent ends (from phdc_close)
@@ -147,7 +147,7 @@ class SimplePhdcManager(dbus.service.Object):
@dbus.service.method('org.neard.PHDC.Manager',
in_signature='hi', out_signature='')
def Disconnection(self,agent_fd, i_err):
- print'Stop Phdc Manager thread'
+ print('Stop Phdc Manager thread')
self.server.stop()
return
@@ -159,7 +159,7 @@ This sample installs two PHDC Managers:
if "__main__" == __name__:
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- print 'PHDC Simple Manager Test'
+ print('PHDC Simple Manager Test')
bus = dbus.SystemBus()
obj = bus.get_object("org.neard", "/org/neard");
neard_manager = dbus.Interface(obj, "org.neard.PHDC")
@@ -167,14 +167,14 @@ if "__main__" == __name__:
simple_path = '/Simple'
valid_path = '/Validation'
- print 'Creating & registering PHDC Simple Manager'
+ print('Creating & registering PHDC Simple Manager')
simpleobject = SimplePhdcManager(bus, simple_path)
d = dbus.Dictionary({'Role': 'Manager', 'Path': simple_path,
'ServiceName': 'urn:nfc:sn:phdc' }, signature='sv')
neard_manager.RegisterAgent(d)
- print 'Creating & Registering Validation Manager'
+ print('Creating & Registering Validation Manager')
validationobj= SimplePhdcManager(bus, valid_path)
d = dbus.Dictionary({'Role': 'Manager', 'Path': valid_path,
diff --git a/test/test-adapter b/test/test-adapter
index 173519e46d99..2b70f11c9bdf 100755
--- a/test/test-adapter
+++ b/test/test-adapter
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
@@ -27,7 +27,7 @@ if (len(sys.argv) < 2):
if (sys.argv[1] == "list"):
if (len(sys.argv) < 3):
objects = neardutils.get_managed_objects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.neard.Adapter" not in interfaces:
continue
@@ -70,8 +70,8 @@ if (sys.argv[1] == "powered"):
value = dbus.Boolean(sys.argv[3])
try:
adapter.Set("org.neard.Adapter", "Powered", value)
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
sys.exit(0)
if (sys.argv[1] == "poll"):
@@ -90,14 +90,14 @@ if (sys.argv[1] == "poll"):
try:
adapter.StartPollLoop(mode)
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
elif (sys.argv[3] == "off"):
try:
adapter.StopPollLoop()
- except dbus.DBusException, error:
- print "%s: %s" % (error._dbus_error_name, error.message)
+ except dbus.DBusException as error:
+ print("%s: %s" % (error._dbus_error_name, error.message))
else:
usage()
diff --git a/test/test-device b/test/test-device
index 1c90ef1e5d32..508bcf1ce575 100755
--- a/test/test-device
+++ b/test/test-device
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
@@ -19,20 +19,20 @@ def usage():
print(" list")
print(" dump <device>")
print(" push <device> <type> <...>")
- print " If type is Text, parameters are <encoding> <language> <representation>"
- print " If type is URI, parameters are <uri>"
- print " If type is SmartPoster, parameters are <uri>"
- print " If type is Handover, parameters are <carrier>"
- print " If type is StaticHandover, parameters are <carrier>"
- print " If type is MIME, parameters are <mime_type> (only wifi_wsc and raw)"
- print " raw is for sending raw payload, parameters are <mime_type> <payload>"
- print "e.g. < %s push /org/neard/nfc0/device0 Text UTF-8 en-US hello,Type2! >" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 URI http://www.nfc-forum.com >" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 SmartPoster http://www.nfc-forum.com >" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 Handover bluetooth,wifi >" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 StaticHandover bluetooth,wifi >" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 MIME wifi_wsc>" % (sys.argv[0])
- print "e.g. < %s push /org/neard/nfc0/device0 MIME raw application/xml '<your><xml tags></your>' >" % (sys.argv[0])
+ print(" If type is Text, parameters are <encoding> <language> <representation>")
+ print(" If type is URI, parameters are <uri>")
+ print(" If type is SmartPoster, parameters are <uri>")
+ print(" If type is Handover, parameters are <carrier>")
+ print(" If type is StaticHandover, parameters are <carrier>")
+ print(" If type is MIME, parameters are <mime_type> (only wifi_wsc and raw)")
+ print(" raw is for sending raw payload, parameters are <mime_type> <payload>")
+ print("e.g. < %s push /org/neard/nfc0/device0 Text UTF-8 en-US hello,Type2! >" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 URI http://www.nfc-forum.com >" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 SmartPoster http://www.nfc-forum.com >" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 Handover bluetooth,wifi >" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 StaticHandover bluetooth,wifi >" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 MIME wifi_wsc>" % (sys.argv[0]))
+ print("e.g. < %s push /org/neard/nfc0/device0 MIME raw application/xml '<your><xml tags></your>' >" % (sys.argv[0]))
sys.exit(1)
@@ -42,7 +42,7 @@ if (len(sys.argv) < 2):
if (sys.argv[1] == "list"):
if (len(sys.argv) < 3):
objects = neardutils.get_managed_objects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.neard.Device" not in interfaces:
continue
@@ -58,7 +58,7 @@ if (sys.argv[1] == "list"):
if (sys.argv[1] == "dump"):
if (len(sys.argv) < 3):
objects = neardutils.get_managed_objects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.neard.Device" not in interfaces:
continue
diff --git a/test/test-tag b/test/test-tag
index cb2c9e84d7fa..3227b3263191 100755
--- a/test/test-tag
+++ b/test/test-tag
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
import dbus
@@ -46,7 +46,7 @@ if (len(sys.argv) < 2):
if (sys.argv[1] == "list"):
if (len(sys.argv) < 3):
objects = neardutils.get_managed_objects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.neard.Tag" not in interfaces:
continue
@@ -70,7 +70,7 @@ if (sys.argv[1] == "list"):
if (sys.argv[1] == "dump"):
if (len(sys.argv) < 3):
objects = neardutils.get_managed_objects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.neard.Tag" not in interfaces:
continue
@@ -127,7 +127,7 @@ def write_uri(args):
data["Type"] = "URI"
data["URI"] = args[0]
- print data
+ print(data)
tag.Write(data)
@@ -169,7 +169,7 @@ if (sys.argv[1] == "write"):
sys.exit(0)
if (sys.argv[1] == "deactivate"):
- print sys.argv[2]
+ print(sys.argv[2])
if (len(sys.argv) != 2):
tag = neardutils.find_tag(sys.argv[2])
tag.Deactivate()
--
2.31.1
6 months, 3 weeks
[PATCH v2] nfc: port100: fix using -ERRNO as command type mask
by Krzysztof Kozlowski
During probing, the driver tries to get a list (mask) of supported
command types in port100_get_command_type_mask() function. The value
is u64 and 0 is treated as invalid mask (no commands supported). The
function however returns also -ERRNO as u64 which will be interpret as
valid command mask.
Return 0 on every error case of port100_get_command_type_mask(), so the
probing will stop.
Cc: <stable(a)vger.kernel.org>
Fixes: 0347a6ab300a ("NFC: port100: Commands mechanism implementation")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
Changes since v1:
1. Drop debug code.
---
drivers/nfc/port100.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
index 517376c43b86..16ceb763594f 100644
--- a/drivers/nfc/port100.c
+++ b/drivers/nfc/port100.c
@@ -1006,11 +1006,11 @@ static u64 port100_get_command_type_mask(struct port100 *dev)
skb = port100_alloc_skb(dev, 0);
if (!skb)
- return -ENOMEM;
+ return 0;
resp = port100_send_cmd_sync(dev, PORT100_CMD_GET_COMMAND_TYPE, skb);
if (IS_ERR(resp))
- return PTR_ERR(resp);
+ return 0;
if (resp->len < 8)
mask = 0;
--
2.30.2
8 months
[PATCH] nfc: port100: fix using -ERRNO as command type mask
by Krzysztof Kozlowski
During probing, the driver tries to get a list (mask) of supported
command types in port100_get_command_type_mask() function. The value
is u64 and 0 is treated as invalid mask (no commands supported). The
function however returns also -ERRNO as u64 which will be interpret as
valid command mask.
Return 0 on every error case of port100_get_command_type_mask(), so the
probing will stop.
Cc: <stable(a)vger.kernel.org>
Fixes: 0347a6ab300a ("NFC: port100: Commands mechanism implementation")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
drivers/nfc/port100.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
index 1296148b4566..ec1630bfedf4 100644
--- a/drivers/nfc/port100.c
+++ b/drivers/nfc/port100.c
@@ -1109,15 +1109,11 @@ static u64 port100_get_command_type_mask(struct port100 *dev)
skb = port100_alloc_skb(dev, 0);
if (!skb)
- return -ENOMEM;
+ return 0;
- nfc_err(&dev->interface->dev, "%s:%d\n", __func__, __LINE__);
resp = port100_send_cmd_sync(dev, PORT100_CMD_GET_COMMAND_TYPE, skb);
- if (IS_ERR(resp)) {
- nfc_err(&dev->interface->dev, "%s:%d\n", __func__, __LINE__);
- return PTR_ERR(resp);
- }
- nfc_err(&dev->interface->dev, "%s:%d\n", __func__, __LINE__);
+ if (IS_ERR(resp))
+ return 0;
if (resp->len < 8)
mask = 0;
--
2.30.2
8 months
[PATCH] NFC: NULL out conn_info reference when conn is closed
by Lin Ma
The nci_core_conn_close_rsp_packet() function will release the conn_info
with given conn_id. However, this reference of this object may still held
by other places like ndev->rf_conn_info in routine:
.. -> nci_recv_frame()
-> nci_rx_work()
-> nci_rsp_packet()
-> nci_rf_disc_rsp_packet()
-> devm_kzalloc()
ndev->rf_conn_info = conn_info;
or ndev->hci_dev->conn_info in routine:
.. -> nci_recv_frame()
-> nci_rx_work()
-> nci_rsp_packet()
-> nci_core_conn_create_rsp_packet()
-> devm_kzalloc()
ndev->hci_dev->conn_info = conn_info;
If these two places are not NULL out, potential UAF can be exploited by
the attacker when emulating an UART NFC device. This patch compares the
deallocating object with the two places and writes NULL to prevent that.
Signed-off-by: Lin Ma <linma(a)zju.edu.cn>
---
net/nfc/nci/rsp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index a2e72c003805..99de76e5e855 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -334,6 +334,14 @@ static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev,
ndev->cur_conn_id);
if (conn_info) {
list_del(&conn_info->list);
+ /* Other places held conn_info like
+ * ndev->hci_dev->conn_info, ndev->rf_conn_info
+ * need to be NULL out.
+ */
+ if (ndev->hci_dev->conn_info == conn_info)
+ ndev->hci_dev->conn_info = NULL;
+ if (ndev->rf_conn_info == conn_info)
+ ndev->rf_conn_info = NULL;
devm_kfree(&ndev->nfc_dev->dev, conn_info);
}
}
--
2.33.0
8 months, 2 weeks
[PATCH v3 0/7] nfc: minor printk cleanup
by Krzysztof Kozlowski
Hi,
Changes since v2:
1. Correct SPDX license in patch 2/7 (as Joe pointed out).
Changes since v1:
1. Remove unused variable in pn533 (reported by kbuild).
Best regards,
Krzysztof
Krzysztof Kozlowski (7):
nfc: drop unneeded debug prints
nfc: nci: replace GPLv2 boilerplate with SPDX
nfc: s3fwrn5: simplify dereferencing pointer to struct device
nfc: st-nci: drop unneeded debug prints
nfc: st21nfca: drop unneeded debug prints
nfc: trf7970a: drop unneeded debug prints
nfc: microread: drop unneeded debug prints
drivers/nfc/microread/i2c.c | 4 ----
drivers/nfc/microread/mei.c | 2 --
drivers/nfc/s3fwrn5/firmware.c | 29 +++++++++++------------------
drivers/nfc/s3fwrn5/nci.c | 18 +++++++-----------
drivers/nfc/st-nci/i2c.c | 4 ----
drivers/nfc/st-nci/ndlc.c | 4 ----
drivers/nfc/st-nci/se.c | 6 ------
drivers/nfc/st-nci/spi.c | 4 ----
drivers/nfc/st21nfca/i2c.c | 4 ----
drivers/nfc/st21nfca/se.c | 4 ----
drivers/nfc/trf7970a.c | 8 --------
net/nfc/hci/command.c | 16 ----------------
net/nfc/hci/llc_shdlc.c | 12 ------------
net/nfc/llcp_commands.c | 8 --------
net/nfc/llcp_core.c | 5 +----
net/nfc/nci/core.c | 4 ----
net/nfc/nci/hci.c | 4 ----
net/nfc/nci/ntf.c | 9 ---------
net/nfc/nci/uart.c | 16 ++--------------
19 files changed, 21 insertions(+), 140 deletions(-)
--
2.30.2
8 months, 2 weeks
Re: [RESEND PATCH v2 0/7] nfc: minor printk cleanup
by Krzysztof Kozlowski
On 11/10/2021 15:03, Jakub Kicinski wrote:
> On Sun, 10 Oct 2021 13:36:59 +0200 Krzysztof Kozlowski wrote:
>> On Fri, 8 Oct 2021 at 12:18, Krzysztof Kozlowski wrote:
>>> On Fri, 8 Oct 2021 at 12:17, David Miller <davem(a)davemloft.net> wrote:
>>>> Please CC: netdev for nfc patches otherwise they will not get tracked
>>>> and applied.
>>>
>>> netdev(a)vger.kernel.org is here. Which address I missed?
>>
>> The patchset reached patchwork:
>> https://patchwork.kernel.org/project/netdevbpf/list/?series=559153&state=*
>> although for some reason it is marked as "changes requested". Are
>> there any other changes needed except Joe's comment for one patch?
>
> I think it was just Joe's comment, nothing else here looks
> objectionable.
>
OK, I'll send a v3 with fixed SPDX.
Best regards,
Krzysztof
8 months, 2 weeks
[PATCH v2 0/8] nfc: dt-bindings: convert to dt-schema
by Krzysztof Kozlowski
Hi,
Changes since v1:
1. Drop clock-frequency from I2C devices.
2. Update commit msg.
3. Add patch 2/8: NXP PN547 binding.
Best regards,
Krzysztof
Krzysztof Kozlowski (8):
dt-bindings: nfc: nxp,nci: convert to dtschema
dt-bindings: nfc: nxp,nci: document NXP PN547 binding
dt-bindings: nfc: nxp,pn532: convert to dtschema
dt-bindings: nfc: st,st21nfca: convert to dtschema
dt-bindings: nfc: st,st95hf: convert to dtschema
dt-bindings: nfc: st,nci: convert to dtschema
dt-bindings: nfc: ti,trf7970a: convert to dtschema
dt-bindings: nfc: marvell,nci: convert to dtschema
.../bindings/net/nfc/marvell,nci.yaml | 170 ++++++++++++++++++
.../devicetree/bindings/net/nfc/nfcmrvl.txt | 84 ---------
.../devicetree/bindings/net/nfc/nxp,nci.yaml | 61 +++++++
.../bindings/net/nfc/nxp,pn532.yaml | 65 +++++++
.../devicetree/bindings/net/nfc/nxp-nci.txt | 33 ----
.../devicetree/bindings/net/nfc/pn532.txt | 46 -----
.../bindings/net/nfc/st,st-nci.yaml | 106 +++++++++++
.../bindings/net/nfc/st,st21nfca.yaml | 64 +++++++
.../bindings/net/nfc/st,st95hf.yaml | 57 ++++++
.../bindings/net/nfc/st-nci-i2c.txt | 38 ----
.../bindings/net/nfc/st-nci-spi.txt | 36 ----
.../devicetree/bindings/net/nfc/st21nfca.txt | 37 ----
.../devicetree/bindings/net/nfc/st95hf.txt | 45 -----
.../bindings/net/nfc/ti,trf7970a.yaml | 98 ++++++++++
.../devicetree/bindings/net/nfc/trf7970a.txt | 43 -----
MAINTAINERS | 3 +-
16 files changed, 623 insertions(+), 363 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/nfc/marvell,nci.yaml
delete mode 100644 Documentation/devicetree/bindings/net/nfc/nfcmrvl.txt
create mode 100644 Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml
create mode 100644 Documentation/devicetree/bindings/net/nfc/nxp,pn532.yaml
delete mode 100644 Documentation/devicetree/bindings/net/nfc/nxp-nci.txt
delete mode 100644 Documentation/devicetree/bindings/net/nfc/pn532.txt
create mode 100644 Documentation/devicetree/bindings/net/nfc/st,st-nci.yaml
create mode 100644 Documentation/devicetree/bindings/net/nfc/st,st21nfca.yaml
create mode 100644 Documentation/devicetree/bindings/net/nfc/st,st95hf.yaml
delete mode 100644 Documentation/devicetree/bindings/net/nfc/st-nci-i2c.txt
delete mode 100644 Documentation/devicetree/bindings/net/nfc/st-nci-spi.txt
delete mode 100644 Documentation/devicetree/bindings/net/nfc/st21nfca.txt
delete mode 100644 Documentation/devicetree/bindings/net/nfc/st95hf.txt
create mode 100644 Documentation/devicetree/bindings/net/nfc/ti,trf7970a.yaml
delete mode 100644 Documentation/devicetree/bindings/net/nfc/trf7970a.txt
--
2.30.2
8 months, 2 weeks
Re: [PATCH 1/7] dt-bindings: nfc: nxp,nci: convert to dtschema
by Krzysztof Kozlowski
On 10/10/2021 21:31, Rob Herring wrote:
> On Sun, 10 Oct 2021 16:23:11 +0200, Krzysztof Kozlowski wrote:
>> Convert the NXP NCI NFC controller to DT schema format.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
>> ---
>> .../devicetree/bindings/net/nfc/nxp,nci.yaml | 61 +++++++++++++++++++
>> .../devicetree/bindings/net/nfc/nxp-nci.txt | 33 ----------
>> MAINTAINERS | 1 +
>> 3 files changed, 62 insertions(+), 33 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml
>> delete mode 100644 Documentation/devicetree/bindings/net/nfc/nxp-nci.txt
>>
>
> Running 'make dtbs_check' with the schema in this patch gives the
> following warnings. Consider if they are expected or the schema is
> incorrect. These may not be new warnings.
>
> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> This will change in the future.
>
> Full log is available here: https://patchwork.ozlabs.org/patch/1539010
>
>
> nfc@28: 'clock-frequency' is a required property
> arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dt.yaml
>
Hmm, this actually looks as mistake in bindings. First, clock-frequency
is a property of a I2C bus, not I2C child device. Second, it should not
be a required property anyway, as I2C will choose a default one matching
driver (e.g. standard speed of 100 kHz).
Except the trf7970a NFC driver, none of other NFC drivers parse the
clock-frequency.
Best regards,
Krzysztof
8 months, 2 weeks
Re: [PATCH 1/7] dt-bindings: nfc: nxp,nci: convert to dtschema
by Krzysztof Kozlowski
On 10/10/2021 21:31, Rob Herring wrote:
> On Sun, 10 Oct 2021 16:23:11 +0200, Krzysztof Kozlowski wrote:
>> Convert the NXP NCI NFC controller to DT schema format.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
>> ---
>> .../devicetree/bindings/net/nfc/nxp,nci.yaml | 61 +++++++++++++++++++
>> .../devicetree/bindings/net/nfc/nxp-nci.txt | 33 ----------
>> MAINTAINERS | 1 +
>> 3 files changed, 62 insertions(+), 33 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml
>> delete mode 100644 Documentation/devicetree/bindings/net/nfc/nxp-nci.txt
>>
>
> Running 'make dtbs_check' with the schema in this patch gives the
> following warnings. Consider if they are expected or the schema is
> incorrect. These may not be new warnings.
>
> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> This will change in the future.
>
> Full log is available here: https://patchwork.ozlabs.org/patch/1539010
>
>
> nfc@28: 'clock-frequency' is a required property
> arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dt.yaml
>
> nfc@28: compatible:0: 'nxp,nxp-nci-i2c' was expected
> arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dt.yaml
>
> nfc@28: compatible: Additional items are not allowed ('nxp,nxp-nci-i2c' was unexpected)
> arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dt.yaml
>
> nfc@28: compatible: ['nxp,pn547', 'nxp,nxp-nci-i2c'] is too long
> arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dt.yaml
>
> nfc@30: 'clock-frequency' is a required property
> arch/arm/boot/dts/ste-ux500-samsung-janice.dt.yaml
>
> nfc@30: compatible:0: 'nxp,nxp-nci-i2c' was expected
> arch/arm/boot/dts/ste-ux500-samsung-janice.dt.yaml
>
> nfc@30: compatible: Additional items are not allowed ('nxp,nxp-nci-i2c' was unexpected)
> arch/arm/boot/dts/ste-ux500-samsung-janice.dt.yaml
>
> nfc@30: compatible: ['nxp,pn547', 'nxp,nxp-nci-i2c'] is too long
> arch/arm/boot/dts/ste-ux500-samsung-janice.dt.yaml
>
I missed that new compatible. I'll send a patch adding nxp,nxp-nci-i2c
and try to fix the DTS (missing clock-frequency).
Best regards,
Krzysztof
8 months, 2 weeks
Re: [PATCH 6/7] dt-bindings: nfc: ti,trf7970a: convert to dtschema
by Krzysztof Kozlowski
On 10/10/2021 21:31, Rob Herring wrote:
> On Sun, 10 Oct 2021 16:23:16 +0200, Krzysztof Kozlowski wrote:
>> Convert the TI TRF7970A NFC to DT schema format.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
>> ---
>> .../bindings/net/nfc/ti,trf7970a.yaml | 98 +++++++++++++++++++
>> .../devicetree/bindings/net/nfc/trf7970a.txt | 43 --------
>> MAINTAINERS | 2 +-
>> 3 files changed, 99 insertions(+), 44 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/net/nfc/ti,trf7970a.yaml
>> delete mode 100644 Documentation/devicetree/bindings/net/nfc/trf7970a.txt
>>
>
> Running 'make dtbs_check' with the schema in this patch gives the
> following warnings. Consider if they are expected or the schema is
> incorrect. These may not be new warnings.
>
> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> This will change in the future.
>
> Full log is available here: https://patchwork.ozlabs.org/patch/1539014
>
>
> nfc@0: 't5t-rmb-extra-byte-quirk', 'vin-voltage-override' do not match any of the regexes: 'pinctrl-[0-9]+'
> arch/arm/boot/dts/imx6dl-prtrvt.dt.yaml
I already sent a patch for this one.
Best regards,
Krzysztof
8 months, 2 weeks