question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

win10 local_name is 'Unknown'

See original GitHub issue
  • bleak version: 0.6.1
  • Python version: 3.6
  • Operating System: Win10
  • BlueZ version (bluetoothctl -v) in case of Linux:

Description

I use scanner get_discovered_devices but I see device name’s ‘Unknown’ always

What I Did

I saw scanner.py in the 135. line:
if ( not new_device.name and event_args.BluetoothAddress in self._scan_responses ): new_device.name = self._scan_responses[ event_args.BluetoothAddress ].Advertisement.LocalName found.append(new_device) this new_device.name never nothing because in the 160. line: return BLEDevice( bdaddr, local_name, event_args, uuids=uuids, manufacturer_data=data BLEDevice init local_name = 'Unknown

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dlechcommented, Feb 22, 2021

FYI, I wrote some thoughts about how to make Windows more like other platforms by internally combining the different advertisement types in #394.

1reaction
pjboscocommented, Feb 21, 2021

This requires an update to the constructor of BLEDevice. If the ‘name’ parameter is None, the BLEDevice.name gets set to ‘Unknown’.

So long as BLEDevice never accepts None as a name, the code in the following branch in the dotnet scanner.py will never execute:

            if (
                not new_device.name
                and event_args.BluetoothAddress in self._scan_responses
            ):
                new_device.name = self._scan_responses[
                    event_args.BluetoothAddress
                ].Advertisement.LocalName

Allowing BLEDevice to accept None as a name, and then replacing the code in the dotnet scanner.py with the following fixes the issue for me:

            if not new_device.name:
                if event_args.BluetoothAddress in self._scan_responses:
                    new_device.name = self._scan_responses[
                        event_args.BluetoothAddress
                    ].Advertisement.LocalName or "Unknown"
                else:
                    new_device.name = "Unknown"

@dlech is right… This of course is contingent upon a ScanResponse type advertisement being available for all device addresses that were found since that is what contains the local name. I have situations where sometimes a device will show Unknown and sometimes it will show its actual name. I think this has more to do with the advertising interval and scans not waiting for a corresponding ScanResponse for each address that has been encountered.

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the Unknown Locale(qaa-latn) language
Hi. After I updated the Windows 10 ,there is a keyboard selection on the keyboard list called Unknown Locale (qaa-latn).
Read more >
Unknown username or password when connecting via ...
Press the Windows key and type 'Control" select the Control Panel App from the listing. Unknown username or password when connecting via SMB...
Read more >
Installing or updating the latest version of the AWS CLI
This topic describes how to install or update the latest release of the AWS Command Line Interface (AWS CLI) on supported operating systems....
Read more >
Windows 10 can't resolve hostnames - ping with IP works ...
Open "View network connections" and try disabling each adapter one-by-one. After disabling each one, test the DNS and then re-enable it. Perhaps ...
Read more >
Windows 10 Pro suddenly creates strange - unknown to me
As stated in the title, all of a sudden my SSD-WIN10PRO - booted in VMware - is creating unknown usernames e.g.: Even though...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found