virtualabs / btlejack

Bluetooth Low Energy Swiss-army knife
MIT License
1.88k stars 195 forks source link

AttributeError: 'ListPortInfo' object has no attribute 'subsystem' #8

Closed wwj718 closed 6 years ago

wwj718 commented 6 years ago
> btlejack -s
BtleJack version 1.1

Traceback (most recent call last):
  File "/usr/local/bin/btlejack", line 11, in <module>
    load_entry_point('btlejack==1.1.1', 'console_scripts', 'btlejack')()
  File "/usr/local/lib/python3.6/site-packages/btlejack/__init__.py", line 228, in main
    supervisor = CLIAccessAddressSniffer(verbose=args.verbose)
  File "/usr/local/lib/python3.6/site-packages/btlejack/ui.py", line 326, in __init__
    super().__init__()
  File "/usr/local/lib/python3.6/site-packages/btlejack/supervisors.py", line 86, in __init__
    self.interface = SingleSnifferInterface()
  File "/usr/local/lib/python3.6/site-packages/btlejack/jobs.py", line 24, in __init__
    self.link = Link(interface=device, baudrate=115200)
  File "/usr/local/lib/python3.6/site-packages/btlejack/link.py", line 42, in __init__
    if port.subsystem == 'usb':
AttributeError: 'ListPortInfo' object has no attribute 'subsystem'

macOS 10.13.5

binloan commented 6 years ago

Having the same issue. ListPortInfo seems to not work for MacOS.

virtualabs commented 6 years ago

I don't have a Mac so it would be difficult for me to test this one. It seems that 'subsystem' is filled only in Linux and does not exist when running on MacOS. Can someone try to comment line 42 and see if it solves the problem ?

wwj718 commented 6 years ago

@virtualabs šŸ‘ I try to comment line 42 it is ok

āžœ  scratch_adapter git:(master) āœ— btlejack -s
BtleJack version 1.1

[i] Enumerating existing connections ...
[ - 91 dBm] 0xaf9a9c23 |Ā pkts: 1
[ - 92 dBm] 0xaf9a9c23 |Ā pkts: 2
[ - 79 dBm] 0xa07d2394 |Ā pkts: 1
virtualabs commented 6 years ago

No other modification required ? Your previous post stated it was not ok.

wwj718 commented 6 years ago

it is my mistake. it works well

virtualabs commented 6 years ago

Allright then, I will merge this fix :)

binloan commented 6 years ago

this issue is not closed. You have more locations where you use if port.subsystem == 'usb'. I see this is also used in jobs.py in line 132.

virtualabs commented 6 years ago

You're right. I fixed this one too. I'm tired at the moment, so I'll wait a few days before pushing a new release on both github and Pypi. Expect version 1.1.3 in a few days, or use master branch if you cannot wait.

virtualabs commented 6 years ago

I'm reopening this issue as it is still officially not fixed.

virtualabs commented 6 years ago

Fixed (well, normally) in v1.2.0.