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

fix: handle devices listed before adapter in dbus managed objects #173

Conversation

JOSEPHGILBY
Copy link
Contributor

Updated the tests to show that this update handles the case when devices are listed before the adapter in the dbus managed_objects output.

tests/test_init.py Outdated Show resolved Hide resolved
adapter = split_path[3]
if adapter not in adapters:
adapters[adapter] = unpacked_data
if not re.match(r"/org/bluez/hci\d+$", path_str):
Copy link
Member

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
@bdraco bdraco changed the title handle devices listed before adapter in dbus managed objects fix: handle devices listed before adapter in dbus managed objects Oct 31, 2024
Comment on lines 77 to 80
try:
int(path_str[15:])
except ValueError:
continue
Copy link
Member

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()

Copy link
Contributor Author

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.

@JOSEPHGILBY
Copy link
Contributor Author

GitHub seems to be stuck with a commit that I pushed. I'll try creating a new PR, sorry about that.

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

Successfully merging this pull request may close these issues.

2 participants