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

Linux: Support Bluetooth without /dev/rfcomm #39

Open
tyalie opened this issue Aug 3, 2022 · 4 comments · May be fixed by #40
Open

Linux: Support Bluetooth without /dev/rfcomm #39

tyalie opened this issue Aug 3, 2022 · 4 comments · May be fixed by #40

Comments

@tyalie
Copy link
Collaborator

tyalie commented Aug 3, 2022

PyBluez of course supports connecting to rfcomm devices without going the long route of using the rfcomm utility. An example can be found here.

The lookup done in BluetoothPrinterDevice.list_devices doesn't seem to be too wrong. What I don't fully understand is, why it was commented out in labelmaker/comms.py:167?

@piksel
Copy link
Owner

piksel commented Aug 3, 2022

Because I couldn't get it to work on windows, but I am currently trying it from Linux. So far it can list devices, but SDP doesn't list any RFCOMM services for the printer (it does for other devices though). But yeah, work in progress.

@piksel
Copy link
Owner

piksel commented Aug 3, 2022

If you explicitly pass the UUID for serial comms it actually does show up and I was successfully able to talk to the printer using a bluetooth socket:

nils@chronos:/src/pytouch-cube$ python3 btsock-test.py 
INFO:root:BTSock Test
INFO:root:Querying for devices...
INFO:root:Found devices: [TV] Samsung Q60 Series (65)
WARNING:root:No device candidate
INFO:root:Querying for devices...
INFO:root:Found devices: PT-P300BT0607, [TV] Samsung Q70 Series (55), FW-65BZ35F
INFO:labelmaker:Opening serial device connection...
[{'description': None,
  'name': 'Serial',
  'port': 1,
  'profiles': [],
  'protocol': 'RFCOMM',
  'provider': None,
  'service-classes': ['1101'],
  'service-id': None}]
INFO:labelmaker:Query status...
INFO:root:Got raw status: 80 20 42 30 72 30 0 0 0 0 c 1 0 0 0 0 0 0 0 0 0 0 0 0 3 8 0 0 0 0 0 0
INFO:labelmaker:Status: Reply to status request
INFO:labelmaker:Battery: 0
INFO:root:Connection successful!

@piksel
Copy link
Owner

piksel commented Aug 3, 2022

Fully working print through bluetooth socket:
image

Now I just need to clean it up...

@tyalie
Copy link
Collaborator Author

tyalie commented Aug 4, 2022

Oh wow. This is great

@piksel piksel linked a pull request Aug 5, 2022 that will close this issue
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 a pull request may close this issue.

2 participants