Skip to content

Commit f073ceb

Browse files
committed
functionfs.tests.device: Make on* call tracing a bit nicer.
Use function names rather than constants (which are internal to functionfs anyway). Also, display setup request arguments.
1 parent 0232897 commit f073ceb

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

functionfs/tests/device.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def __enter__(self):
147147
return result
148148

149149
def onEnable(self):
150-
print('functionfs: ENABLE')
150+
print('functionfs: onEnable')
151151
try:
152152
print('Real interface 0:', self.ep0.getRealInterfaceNumber(0))
153153
except IOError:
@@ -179,21 +179,31 @@ def onEnable(self):
179179
thread.start()
180180

181181
def onDisable(self):
182-
print('functionfs: DISABLE')
182+
print('functionfs: onDisable')
183183

184184
def onBind(self):
185-
print('functionfs: BIND')
185+
print('functionfs: onBind')
186186

187187
def onUnbind(self):
188-
print('functionfs: UNBIND')
188+
print('functionfs: onUnbind')
189189

190190
def onSuspend(self):
191-
print('functionfs: SUSPEND')
191+
print('functionfs: onSuspend')
192192

193193
def onResume(self):
194-
print('functionfs: RESUME')
194+
print('functionfs: onResume')
195195

196196
def onSetup(self, request_type, request, value, index, length):
197+
print(
198+
'functionfs: onSetup(request_type=%#04x, request=%#04x, '
199+
'value=%#06x, index=%#06x, length=%#06x)' % (
200+
request_type,
201+
request,
202+
value,
203+
index,
204+
length,
205+
),
206+
)
197207
request_type_type = request_type & functionfs.ch9.USB_TYPE_MASK
198208
if request_type_type == functionfs.ch9.USB_TYPE_VENDOR:
199209
if request == common.REQUEST_ECHO:

0 commit comments

Comments
 (0)