-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: handle devices listed before adapter in dbus managed objects #173
fix: handle devices listed before adapter in dbus managed objects #173
Conversation
src/bluetooth_adapters/dbus.py
Outdated
adapter = split_path[3] | ||
if adapter not in adapters: | ||
adapters[adapter] = unpacked_data | ||
if not re.match(r"/org/bluez/hci\d+$", path_str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you avoid using a regex here?
remove print
src/bluetooth_adapters/dbus.py
Outdated
try: | ||
int(path_str[15:]) | ||
except ValueError: | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably cleaner to path_str[15:].isdigit()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isdigit() will accept leading zeros. Although this will accept a leading '-' character.
GitHub seems to be stuck with a commit that I pushed. I'll try creating a new PR, sorry about that. |
Updated the tests to show that this update handles the case when devices are listed before the adapter in the dbus managed_objects output.