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

Handle rfcomm_list failing #2018

Merged
merged 2 commits into from
Jan 27, 2023
Merged

Conversation

infirit
Copy link
Contributor

@infirit infirit commented Jan 26, 2023

Just quick draft so we can discuss if we need to display something to the user or not. And logging the exception may be too much, perhaps just the error message with or without the error number?

@cschramm
Copy link
Member

I would not display anything and not put much thought in the log message either. The more important question to me is if this is enough to actually make things work on RFCOMM-disabled systems.

By the way, I don't think the rfcomm_list call in on_device_disconnect can get reached on an RFCOMM-disabled system anyway, but the error handling does not hurt, of course.

@infirit
Copy link
Contributor Author

infirit commented Jan 26, 2023

It's a kernel module on arch so I should be able to easily test this.

By the way, I don't think the rfcomm_list call in on_device_disconnect can get reached on an RFCOMM-disabled system anyway, but the error handling does not hurt, of course.

Yeah, hadn't put much thought into it and just grepped for the commandfunction :-)

edit: removed the module and I can actually catch it. I'll just log the error message and if at some point we need more we can deal with it then.

from _blueman import rfcomm_list
rfcomm_list()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    rfcomm_list()
  File "_blueman.pyx", line 144, in _blueman.rfcomm_list
Exception: ERR_SOCKET_FAILED
try:rfcomm_list()
except Exception as e:
    print(e)

    
ERR_SOCKET_FAILED

@infirit
Copy link
Contributor Author

infirit commented Jan 26, 2023

Yeah, this is enough to handle rfcomm missing. Pushed update with

blueman-manager 20.28.49 DEBUG    ManagerDeviceMenu:292 generate  : Mi Bluetooth Speaker
blueman-manager 20.28.49 ERROR    SerialService:38 connected_instances: rfcomm_list failed with: ERR_SOCKET_FAILED

@infirit infirit marked this pull request as ready for review January 26, 2023 19:33
@infirit infirit requested a review from cschramm January 26, 2023 19:33
@infirit
Copy link
Contributor Author

infirit commented Jan 26, 2023

eeeuh, this just showed up in the infobar when I tried to connect serial port and made the window 2million pixels wide 🤣 . It's probably a good idea to hide it :-)

Verbinding mislukt: File "/usr/lib/python3.10/site-packages/blueman/services/meta/SerialService.py", line 89, in connect
    port_id = create_rfcomm_device(Adapter(obj_path=self.device["Adapter"])['Address'], self.device["Address"],
  File "_blueman.pyx", line 172, in _blueman.create_rfcomm_device
_blueman.RFCOMMError: ERR_SOCKET_FAILED

To be used when RFCOMM is not available and we need to handle it.
Otherwise blueman-manager crashes as seen in blueman-project#2016
@sonarcloud
Copy link

sonarcloud bot commented Jan 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@infirit infirit merged commit ac6d546 into blueman-project:main Jan 27, 2023
@infirit infirit deleted the rfcommerror branch January 27, 2023 10:24
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