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

Windows "No such interface supported" #348

Open
MGlolenstine opened this issue Nov 17, 2023 · 3 comments
Open

Windows "No such interface supported" #348

MGlolenstine opened this issue Nov 17, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@MGlolenstine
Copy link

Describe the bug
After implementing my library (on bluetooth_support branch) and testing it on Linux, where it worked, I decided to work on a Windows application that needs Bluetooth connection as well.

However, while the program connects to the device, gets the characteristic, writes to it, it fails to read from it.

Program log
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] services 4
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] characteristics Ok(3)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(1)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] characteristics Ok(3)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] characteristics Ok(3)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] characteristics Ok(3)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(0)
[2023-11-17T13:09:12Z DEBUG btleplug::winrtble::ble::device] descriptors Ok(1)
[2023-11-17T13:09:12Z DEBUG comm_handler::adapters::bluetooth] Writing [190, 201, 163, 251, 21, 152, 246, 118, 36, 57, 253, 29, 238, 49, 213, 42, 170, 199, 60, 116, 102, 138, 19, 243, 214, 242, 222, 182, 226, 13] to BT.
[2023-11-17T13:09:12Z ERROR comm_handler::framed_handler] An error occured while receiving data: Btleplug Error: Btleplug: Windows UWP threw error due to Protocol Error on read: IReference(IUnknown(0x26bd5b6de60)) Err(Error { code: HRESULT(0x80004002), message: "No such interface supported" }) Err(Error { code: HRESULT(0x80004002), message: "No such interface supported" })

I was able to track the issue to this line, where it returns IReference, which contains Err(Error { code: HRESULT(0x80004002), message: "No such interface supported" }) when opened with IReference::GetString.

Expected behavior
I'd expect Windows to be able to read and write from and to the BLE device.

Actual behavior
Windows seems to be able to scan, connect, get services, characteristics, but fails to read data from a notify characteristic.

Additional context
Add any other context about the problem here.

@MGlolenstine MGlolenstine added the bug Something isn't working label Nov 17, 2023
@MGlolenstine
Copy link
Author

It does seem to work fine on Windows 10.
The issue could be Windows 11 or just broken drivers.
I'll test if the drivers are the cause by reinstalling them on Monday and will report back.

@qdot
Copy link
Contributor

qdot commented Nov 19, 2023

I just released a new version with an updated version of windows-rs. Not sure that'll help, but it's worth a shot.

@MGlolenstine
Copy link
Author

I've updated to the latest version and tested it, but I was still out of luck.

My issue was that I was reading from a characteristic that only implemented NOTIFY.
Now the error msg makes more sense, but it doesn't explain why it worked on some Windows devices and not on others (I tested it on another Windows 10, but it still failed).

Would it be possible to implement better error handling for scenarios like these?
(This time the error was on my side, but the error was confusing.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants