Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USBMassStorageInterface / USBEndpoint object has no attribute device_class #33

Open
Tracked by #97
bhass1 opened this issue Feb 14, 2020 · 3 comments
Open
Tracked by #97
Labels

Comments

@bhass1
Copy link

bhass1 commented Feb 14, 2020

While testing numap-scan from nu-map's (https://github.com/sprout42/nu-map/tree/umap2_python3_updates) against facedancer's current master branch (2281b57), I encounter the following error:

[ERROR ] Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/numap-2.0.2-py3.6.egg/numap/apps/scan.py", line 50, in run
device.run()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 166, in run
self.scheduler.run()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/core.py", line 506, in run
task()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 84, in
self.scheduler.add_task(lambda : self.maxusb_app.service_irqs())
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 756, in service_irqs
self._handle_transfer_events()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 470, in _handle_transfer_events
self._handle_transfer_complete_on_endpoint(i, self.HOST_TO_DEVICE)
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 556, in _handle_transfer_complete_on_endpoint
self.connected_device.handle_request(self.pending_control_request)
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 236, in handle_request
handler_entity = recipient.device_class
AttributeError: 'USBEndpoint' object has no attribute 'device_class'

I still need to investigate a bit further to see why USBEndpoint causes this.

@bhass1
Copy link
Author

bhass1 commented Feb 14, 2020

I get a similar issue when trying to use numap-emulate -C mass_storage :

[ERROR ] Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/numap-2.0.2-py3.6.egg/numap/apps/emulate.py", line 42, in run
self.dev.run()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 166, in run
self.scheduler.run()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/core.py", line 506, in run
task()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 84, in
self.scheduler.add_task(lambda : self.maxusb_app.service_irqs())
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 755, in service_irqs
self._handle_setup_events()
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 362, in _handle_setup_events
self._handle_setup_event_on_endpoint(i)
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/backends/GreatDancerApp.py", line 396, in _handle_setup_event_on_endpoint
self.connected_device.handle_request(request)
File "/usr/local/lib/python3.6/dist-packages/Facedancer-2019.3.2-py3.6.egg/facedancer/USBDevice.py", line 236, in handle_request
handler_entity = recipient.device_class
AttributeError: 'USBMassStorageInterface' object has no attribute 'device_class'

@bhass1 bhass1 changed the title USBEndpoint object has no attribute device_class USBMassStorageInterface / USBEndpoint object has no attribute device_class Feb 14, 2020
@ktemkin ktemkin added the bug label Feb 20, 2020
@bhass1
Copy link
Author

bhass1 commented Feb 20, 2020

By the way, this appears to be DUT (device-under-test) behavior related. Mass-storage emulator worked when the DUT was my Ubuntu 18.04 laptop, but not the other DUT I am focused on. I will try to post more logs tonight.

And I am using GreatFET One with the latest firmware and host-tools.

@bhass1
Copy link
Author

bhass1 commented Feb 21, 2020

numap-scan log (not DUT dependent, both choke on the same packet from host):
image
After decoding and looking back at the error, things are starting to make sense. The host is sending a SETUP packet with a "class" type with the "endpoint" as the recipient. Then I guess a bRequest = 1 isn't being handled by the endpoint. In this case, the first class of devices being scanned for is Audio. Below is the emulated Audio configuration.
emulated_audio

The question I have is whether this issue belongs in Facedancer or Numap. At a minimum I think Facedancer should handle all request types more gracefully... Maybe catch the exception, print a statement about unhandled request, and continue to raise the exception?

On the other hand, if the host is asking us to do something with the Audio class' endpoint, the numap-scan can probably assume the host supports audio peripherals and move on, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants