[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 1/6] nfc: microread: remove unused header includes
by Krzysztof Kozlowski
Do not include unnecessary headers.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
drivers/nfc/microread/mei.c | 1 -
drivers/nfc/microread/microread.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index 8fa7771085eb..8edf761a6b2a 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -10,7 +10,6 @@
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/nfc.h>
-#include <net/nfc/hci.h>
#include <net/nfc/llc.h>
#include "../mei_phy.h"
diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
index 9d83ccebd434..bb4d029bb888 100644
--- a/drivers/nfc/microread/microread.c
+++ b/drivers/nfc/microread/microread.c
@@ -15,7 +15,6 @@
#include <linux/nfc.h>
#include <net/nfc/nfc.h>
#include <net/nfc/hci.h>
-#include <net/nfc/llc.h>
#include "microread.h"
--
2.30.2
10 months
[PATCH] NFC: NCI: make parent aware in PM terms
by Oliver Neukum
The NCI device is a child of an i2c device.
If the i2c layer uses runtime PM the power to
the NFC device can be cut whenever the i2c
layer is done transmitting data to the NFC
device.
Under these conditions NFC can not work, as
it needs power to wait for reception of packets.
The necessary extension of runtime PM
to the NFC device requires that it
be activated as a child of the i2c device.
It is not necessary to do any runtime PM
operations. This will disable runtime PM
for this branch of the tree, but otherwise
the NFC device is inoperable.
Signed-off-by: Oliver Neukum <oneukum(a)suse.com>
---
drivers/nfc/nxp-nci/i2c.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 94f7f6d9cbad..dba78a5d217a 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -18,6 +18,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/nfc.h>
+#include <linux/pm_runtime.h>
#include <linux/gpio/consumer.h>
#include <asm/unaligned.h>
@@ -261,6 +262,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
{
struct device *dev = &client->dev;
struct nxp_nci_i2c_phy *phy;
+ struct nfc_dev *ndev;
int r;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -297,6 +299,11 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
if (r < 0)
return r;
+ ndev = phy->ndev->nfc_dev;
+ pm_runtime_set_active(&ndev->dev);
+ pm_runtime_enable(&ndev->dev);
+ pm_runtime_mark_last_busy(&ndev->dev);
+
r = request_threaded_irq(client->irq, NULL,
nxp_nci_i2c_irq_thread_fn,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
@@ -310,9 +317,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
static int nxp_nci_i2c_remove(struct i2c_client *client)
{
struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
+ struct nfc_dev *ndev = phy->ndev->nfc_dev;
nxp_nci_remove(phy->ndev);
free_irq(client->irq, phy);
+ pm_runtime_disable(&ndev->dev);
+ pm_runtime_set_suspended(&ndev->dev);
return 0;
}
--
2.26.2
10 months
Re: [PATCH v2] tag: Implement readout of tag UID via DBus interface
by Frieder Schrempf
Hi Fabian,
On 16.03.21 19:49, Gottstein, Fabian wrote:
> Hi Frieder,
>
> thanks for the patch.
thanks for your feedback.
>
> Could you please also consider the following situation:
> In the case of a NFC Tag Type 1, the identifier is delivered via the RID command (see NFC Digital Protocol). Thus, the Tag's nfcid property is updated in a later step.
> To inform the neard users, a property changed signal has to be emitted when nfcid has changed (in near_tag_set_nfcid). Also, a exists() handler for the new DBus property should be implemented.
I'm new to NFC and D-Bus, so I don't know much about what use-cases and
requirements there are.
Your request sounds reasonable and I think I have a rough understanding
of what is probably needed to implement this. Still to actually do this
I need to look at the specifications and the code more closely and I
don't know if/when I will find time to do this.
Also I don't have any hardware to test this with NFC type 1 tags.
>
> Another thing regarding building the response message:
> The following code snippet could simplify and improve the readability of the usage of the dbus message builder:
>
> dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &entry);
> dbus_message_iter_append_fixed_array(&entry, DBUS_TYPE_BYTE, &uid, len);
> dbus_message_iter_close_container(iter, &entry);
>
Thanks for the improved code, I will use this instead.
Frieder
>
>
> -----Original Message-----
> From: Schrempf Frieder <frieder.schrempf(a)kontron.de>
> Sent: Dienstag, 16. März 2021 12:22
> To: Samuel Ortiz <sameo(a)linux.intel.com>; linux-nfc(a)lists.01.org
> Cc: Frieder Schrempf <frieder.schrempf(a)kontron.de>
> Subject: [linux-nfc] [PATCH v2] tag: Implement readout of tag UID via DBus interface
>
> Caution: This e-mail originated from outside of Philips, be careful for phishing.
>
>
> From: Frieder Schrempf <frieder.schrempf(a)kontron.de>
>
> NFC tags usually provide an unique identifier. Neard already checks if one of the two types of identifiers is available, reads them from tags and stores them in near_tag.nfcid or near_tag.iso15693_uid respectively.
>
> Though currently it is not possible for any client application to get this information via the D-Bus interface as no property for the UID is implemented.
>
> This adds a 'Uid' property to the D-Bus interface for tags, which exposes the UID of the tag as byte array. If nfcid is available this is returned as UID, otherwise if iso15693_uid is available this is returned. If no UID is available, no 'Uid' property is exposed.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf(a)kontron.de>
> ---
> Changes in v2:
> * Add whitespaces after 'for' statements
> * Add more details to the commit message
> ---
> src/tag.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 54 insertions(+), 3 deletions(-)
>
> diff --git a/src/tag.c b/src/tag.c
> index 9eba4ee..d530893 100644
> --- a/src/tag.c
> +++ b/src/tag.c
> @@ -53,6 +53,7 @@ struct near_tag {
> uint8_t nfcid_len;
>
> uint8_t iso15693_dsfid;
> + uint8_t iso15693_uid_len;
> uint8_t iso15693_uid[NFC_MAX_ISO15693_UID_LEN];
>
> size_t data_length;
> @@ -168,6 +169,29 @@ static const char *type_string(struct near_tag *tag)
> return type;
> }
>
> +static const uint8_t uid_array(struct near_tag *tag, uint8_t **uid) {
> + if (tag->nfcid_len) {
> + DBG("NFCID: ");
> + for (int i = 0; i < tag->nfcid_len; i++)
> + DBG("%x", tag->nfcid[i]);
> +
> + *uid = tag->nfcid;
> +
> + return tag->nfcid_len;
> + } else if (tag->iso15693_uid_len) {
> + DBG("ISO-UID: ");
> + for (int i = 0; i < tag->iso15693_uid_len; i++)
> + DBG("%x", tag->iso15693_uid[i]);
> +
> + *uid = tag->iso15693_uid;
> +
> + return tag->iso15693_uid_len;
> + }
> +
> + return 0;
> +}
> +
> static const char *protocol_string(struct near_tag *tag) {
> const char *protocol;
> @@ -219,6 +243,30 @@ static gboolean property_get_type(const GDBusPropertyTable *property,
> return TRUE;
> }
>
> +static gboolean property_get_uid(const GDBusPropertyTable *property,
> + DBusMessageIter *iter, void
> +*user_data) {
> + struct near_tag *tag = user_data;
> + DBusMessageIter entry;
> + uint8_t *uid;
> + uint8_t len;
> +
> + len = uid_array(tag, &uid);
> + if (!uid || !len)
> + return FALSE;
> +
> + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
> + "{y}", &entry);
> +
> + for (int i = 0; i < len; i++)
> + dbus_message_iter_append_basic(&entry, DBUS_TYPE_BYTE,
> + (void *)&uid[i]);
> +
> + dbus_message_iter_close_container(iter, &entry);
> +
> + return TRUE;
> +}
> +
> static gboolean property_get_protocol(const GDBusPropertyTable *property,
> DBusMessageIter *iter, void *user_data) { @@ -526,6 +574,7 @@ static const GDBusPropertyTable tag_properties[] = {
> { "Protocol", "s", property_get_protocol },
> { "ReadOnly", "b", property_get_readonly },
> { "Adapter", "o", property_get_adapter },
> + { "Uid", "ay", property_get_uid },
>
> { }
> };
> @@ -671,8 +720,10 @@ static int tag_initialize(struct near_tag *tag,
> if (nfcid_len && nfcid_len <= NFC_MAX_NFCID1_LEN) {
> tag->nfcid_len = nfcid_len;
> memcpy(tag->nfcid, nfcid, nfcid_len);
> - } else if (iso15693_uid_len) {
> + } else if (iso15693_uid_len &&
> + iso15693_uid_len <= NFC_MAX_ISO15693_UID_LEN) {
> tag->iso15693_dsfid = iso15693_dsfid;
> + tag->iso15693_uid_len = iso15693_uid_len;
> memcpy(tag->iso15693_uid, iso15693_uid, iso15693_uid_len);
> }
>
> @@ -837,11 +888,11 @@ uint8_t *near_tag_get_iso15693_uid(uint32_t adapter_idx, uint32_t target_idx)
> if (!tag)
> goto fail;
>
> - iso15693_uid = g_try_malloc0(NFC_MAX_ISO15693_UID_LEN);
> + iso15693_uid = g_try_malloc0(tag->iso15693_uid_len);
> if (!iso15693_uid)
> goto fail;
>
> - memcpy(iso15693_uid, tag->iso15693_uid, NFC_MAX_ISO15693_UID_LEN);
> + memcpy(iso15693_uid, tag->iso15693_uid, tag->iso15693_uid_len);
>
> return iso15693_uid;
>
> --
> 2.25.1
> _______________________________________________
> Linux-nfc mailing list -- linux-nfc(a)lists.01.org To unsubscribe send an email to linux-nfc-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
> ________________________________
> The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
>
10 months, 1 week
[PATCH v2 net-next 0/8] Update the virtual NCI device driver and add the NCI testcase
by bongsu.jeon2@gmail.com
From: Bongsu Jeon <bongsu.jeon(a)samsung.com>
This series updates the virtual NCI device driver and NCI selftest code
and add the NCI test case in selftests.
1/8 to use wait queue in virtual device driver.
2/8 to remove the polling code in selftests.
3/8 to fix a typo.
4/8 to fix the next nlattr offset calculation.
5/8 to fix the wrong condition in if statement.
6/8 to add a flag parameter to the Netlink send function.
7/8 to extract the start/stop discovery function.
8/8 to add the NCI testcase in selftests.
v2:
1/8
- change the commit message.
- add the dfense code while reading a frame.
3/8
- change the commit message.
- separate the commit into 3/8~8/8.
Bongsu Jeon (8):
nfc: virtual_ncidev: Use wait queue instead of polling
selftests: nci: Remove the polling code to read a NCI frame
selftests: nci: Fix the typo
selftests: nci: Fix the code for next nlattr offset
selftests: nci: Fix the wrong condition
selftests: nci: Add the flags parameter for the send_cmd_mt_nla
selftests: nci: Extract the start/stop discovery function
selftests: nci: Add the NCI testcase reading T4T Tag
drivers/nfc/virtual_ncidev.c | 9 +-
tools/testing/selftests/nci/nci_dev.c | 416 ++++++++++++++++++++++----
2 files changed, 362 insertions(+), 63 deletions(-)
--
2.32.0
10 months, 1 week
[PATCH net-next 0/3] Update the virtual NCI driver and the NCI selftests
by bongsu.jeon2@gmail.com
From: Bongsu Jeon <bongsu.jeon(a)samsung.com>
This series updates the virtual NCI device driver and NCI selftest code
and add the NCI test case in selftests.
1/3 is the patch to use wait queue in virtual device driver.
2/3 is the patch to remove the polling code in selftests.
3/3 is the patch to add the NCI testcase in selftests.
Bongsu Jeon (3):
nfc: Change the virtual NCI device driver to use Wait Queue
selftests: Remove the polling code to read a NCI frame
selftests: Add the NCI testcase reading T4T Tag
drivers/nfc/virtual_ncidev.c | 10 +-
tools/testing/selftests/nci/nci_dev.c | 417 ++++++++++++++++++++++----
2 files changed, 362 insertions(+), 65 deletions(-)
--
2.32.0
10 months, 2 weeks
Re: [PATCH] ndef: Only register interface for known records
by Mark Greer
On Thu, Sep 20, 2018 at 08:29:04PM -0700, Mark Greer wrote:
> On Wed, Sep 19, 2018 at 10:03:59AM -0700, Mark Greer wrote:
>
> > Thanks for the data. I'll decipher it later today.
>
> Hi Ricardo. I sort of got hit with some stuff so it may be a few days.
>
> Sorry for the delay.
Well, a few days turned into a few years but it is in there now.
Thanks for your patience Ricardo.
Applied.
Mark
--
10 months, 2 weeks
[neard][PATCH] README: describe contributions
by Krzysztof Kozlowski
Mention the linux-nfc mailing list for contributions and current
repositories - GitHub and kernel.org. Document explicitly that
contributions can come also via GitHub pull request. For many
developers without experience in development of Linux kernel, the GitHub
PRs are easier than the patch-email workflow.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
README | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/README b/README
index 8204b690eda0..509363bccac3 100644
--- a/README
+++ b/README
@@ -54,3 +54,21 @@ disabled with the following configuration options:
Running ./bootstrap-configure will build the configure script and then
run it, with maintainer mode enabled. bootstrap-configure will configure
neard with all features enabled.
+
+Bugs and contributing
+=====================
+
+Please send bug reports to mailing list:
+ linux-nfc(a)lists.01.org
+
+The project development happens on GitHub:
+ https://github.com/linux-nfc/neard
+
+However for historical reasons the releases are also mirrored on kernel.org
+repository:
+ https://git.kernel.org/pub/scm/network/nfc/neard.git/
+
+Contributions can come in a form of patches sent to linux-nfc(a)lists.01.org or
+GitHub pull requests on mentioned GitHub repository.
+
+See also HACKING and doc/coding-style.txt files.
--
2.30.2
10 months, 3 weeks
[neard][PATCH] build: fix missing pkglibdir substitute in neard.pc
by Krzysztof Kozlowski
The pkglibdir is used by neard.pc.in (so by autoconf) however the
automake defines it, not autoconf. Add early definition of pkglibdir so
substitute in neard.pc.in will work correctly.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
configure.ac | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/configure.ac b/configure.ac
index c1fdc44ae02d..ffe453049939 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,10 @@ if (test "${libdir}" = '${exec_prefix}/lib'); then
libdir='${prefix}/lib'
fi
+# pkglibdir is defined by automake but autoconf parses the neard.pc.in
+# which uses pkglibdir, therefore define it manually in autoconf.
+AC_SUBST([pkglibdir], ["\${libdir}/${PACKAGE_NAME}"])
+
plugindir='${pkglibdir}/plugins'
se_plugindir='${pkglibdir}/plugins-se'
AC_SUBST(plugindir)
--
2.30.2
10 months, 3 weeks
[neard][PATCH v2 00/11] CI under Github
by Krzysztof Kozlowski
Hi,
Add a Continuous Integration builds under Github (with its Actions) to
build and unit test on several configurations.
Changes since v1 [1]:
1. Rebase on latest master.
2. Remove CI-unrelated patches from this set.
3. Add CodeQL analysis.
4. Add builds and tests with GCC sanitizers.
5. Use matrix to extend the build configuration.
[1] https://lore.kernel.org/linux-nfc/20210710033859.3989-1-krzysztof.kozlows...
Best regards,
Krzysztof
Krzysztof Kozlowski (11):
ci: add GitHub actions for building
bootstrap: parse CROSS_COMPILE and set proper configure option
ci: add clang builds
ci: add building without maintainer options
ci: be verbose when building
ci: add more build configurations (Fedora, Alpine, Debian,
cross-compile, i386)
ci: run unit tests
ci: add build with sanitizers (asan, lsan and ubsan)
ci: add CodeQL static analysis
ci: print configure logs on failures
ci: use matrix instead of duplicating each build configuration
.github/workflows/ci.yml | 255 ++++++++++++++++++++++++++
.github/workflows/codeql-analysis.yml | 45 +++++
bootstrap-configure | 6 +
ci/alpine.sh | 42 +++++
ci/debian.cross-compile.sh | 41 +++++
ci/debian.i386.sh | 32 ++++
ci/debian.sanitizers.sh | 18 ++
ci/debian.sh | 41 +++++
ci/fedora.sh | 33 ++++
ci/ubuntu.cross-compile.sh | 1 +
ci/ubuntu.i386.sh | 1 +
ci/ubuntu.sanitizers.sh | 1 +
ci/ubuntu.sh | 1 +
13 files changed, 517 insertions(+)
create mode 100644 .github/workflows/ci.yml
create mode 100644 .github/workflows/codeql-analysis.yml
create mode 100755 ci/alpine.sh
create mode 100755 ci/debian.cross-compile.sh
create mode 100755 ci/debian.i386.sh
create mode 100755 ci/debian.sanitizers.sh
create mode 100755 ci/debian.sh
create mode 100755 ci/fedora.sh
create mode 120000 ci/ubuntu.cross-compile.sh
create mode 120000 ci/ubuntu.i386.sh
create mode 120000 ci/ubuntu.sanitizers.sh
create mode 120000 ci/ubuntu.sh
--
2.30.2
10 months, 3 weeks