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

sample code does not run #556

Closed
maccardo opened this issue Jun 6, 2024 · 3 comments
Closed

sample code does not run #556

maccardo opened this issue Jun 6, 2024 · 3 comments
Labels
bug Something isn't working feedback requested Further information is requested Stale

Comments

@maccardo
Copy link

maccardo commented Jun 6, 2024

Help needed to get started
The following code which came from the pypy intro for the open_gopro install des not run with the same
"Could not read Descriptor value for 0032: Protocol Error 0x05: Insufficient Authentication"
what am I missing (using windows 10 and a hero10 black, I can see I am paired with windows.

import asyncio
from open_gopro import WirelessGoPro, Params

async def main():
async with WirelessGoPro() as gopro:
await gopro.ble_setting.resolution.set(Params.Resolution.RES_4K)
await gopro.ble_setting.fps.set(Params.FPS.FPS_30)
await gopro.ble_command.set_shutter(shutter=Params.Toggle.ENABLE)
await asyncio.sleep(2) # Record for 2 seconds
await gopro.ble_command.set_shutter(shutter=Params.Toggle.DISABLE)

    # Download all of the files from the camera
    media_list = (await gopro.http_command.get_media_list()).data.files
    for item in media_list:
        await gopro.http_command.download_file(camera_file=item.filename)

asyncio.run(main())

I enabled debug and got the following:
DEBUG:open_gopro.wifi.adapters.wireless:Wifi setup. Using [WifiCli] driver::[Wi-Fi] interface
INFO:open_gopro.ble.adapters.bleak_wrapper:Scanning for GoPro [A-Z0-9]{4} bluetooth devices...
DEBUG:bleak.backends.winrt.scanner:Received 4A:0A:0A:EC:8B:9F: .
DEBUG:bleak.backends.winrt.scanner:Received 4A:0A:0A:EC:8B:9F: Classroom TV.
DEBUG:bleak.backends.winrt.scanner:Received F4:76:4C:EB:72:D3: .
DEBUG:bleak.backends.winrt.scanner:Received F4:76:4C:EB:72:D3: GoPro 7501.
INFO:open_gopro.ble.adapters.bleak_wrapper: Discovered: F4:76:4C:EB:72:D3: GoPro 7501
DEBUG:bleak.backends.winrt.scanner:Received 1C:98:5A:C8:74:A4: .
DEBUG:bleak.backends.winrt.scanner:3 devices found. Watcher status: <BluetoothLEAdvertisementWatcherStatus.STOPPED: 3>.
INFO:open_gopro.ble.adapters.bleak_wrapper:Found 1 matching devices.
INFO:open_gopro.ble.client:Establishing the BLE connection
INFO:open_gopro.ble.adapters.bleak_wrapper:Establishing BLE connection to F4:76:4C:EB:72:D3: GoPro 7501...
DEBUG:bleak.backends.winrt.client:Connecting to BLE device @ F4:76:4C:EB:72:D3
DEBUG:bleak.backends.winrt.client:getting services (service_cache_mode=None, cache_mode=None)...
DEBUG:bleak.backends.winrt.client:session_status_changed_event_handler: id: BluetoothLE#BluetoothLE38:87:d5:ca:28:66-f4:76:4c:eb:72:d3, error: <BluetoothError.SUCCESS: 0>, status: <GattSessionStatus.ACTIVE: 1>
DEBUG:bleak.backends.winrt.client:max_pdu_size_changed_handler: 517
DEBUG:open_gopro.ble.adapters.bleak_wrapper:Attempting to pair...
DEBUG:open_gopro.ble.adapters.bleak_wrapper:Pairing complete!
INFO:open_gopro.ble.adapters.bleak_wrapper:Discovering characteristics...
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Generic Attribute Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Generic Access Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Device Name @ handle 3: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Appearance @ handle 5: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Preferred Connection Parameters @ handle 7: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Tx Power Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Tx Power Level @ handle 10: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Battery Service
DEBUG:bleak.backends.winrt.client:Read Descriptor 000F : bytearray(b'\x00\x00')
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Battery Level @ handle 13: READ|NOTIFY
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Device Information Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Manufacturer Name @ handle 17: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Model Number @ handle 19: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Serial Number @ handle 21: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Hardware Revision @ handle 23: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Firmware Revision @ handle 25: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Software Revision @ handle 27: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] System ID @ handle 29: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] PNP ID @ handle 31: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Wifi Access Point Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Wifi AP SSID @ handle 34: READ|WRITE_YES_RSP
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Wifi AP Password @ handle 36: READ|WRITE_YES_RSP
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Wifi Power @ handle 38: WRITE_YES_RSP
DEBUG:bleak.backends.winrt.client:Read Descriptor 002A : bytearray(b'\x00\x00')
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Wifi State @ handle 40: READ|INDICATE
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] CSI Password @ handle 43: READ
DEBUG:open_gopro.ble.adapters.bleak_wrapper:[Service] Control and Query Service
DEBUG:open_gopro.ble.adapters.bleak_wrapper: [Characteristic] Command @ handle 46: WRITE_YES_RSP
ERROR:open_gopro.gopro_wireless:Error while opening: Could not read Descriptor value for 0032: Protocol Error 0x05: Insufficient Authentication
INFO:open_gopro.wifi.client:Terminating the Wifi connection
DEBUG:open_gopro.util:Send cmd --> netsh wlan disconnect interface="Wi-Fi"
DEBUG:open_gopro.util:Receive response -->

INFO:open_gopro.ble.client:Terminating the BLE connection
INFO:open_gopro.ble.adapters.bleak_wrapper:Disconnecting...
DEBUG:bleak.backends.winrt.client:Disconnecting from BLE device...
DEBUG:bleak.backends.winrt.client:max_pdu_size_changed_handler: 23
DEBUG:bleak.backends.winrt.client:session_status_changed_event_handler: id: BluetoothLE#BluetoothLE38:87:d5:ca:28:66-f4:76:4c:eb:72:d3, error: <BluetoothError.SUCCESS: 0>, status: <GattSessionStatus.CLOSED: 0>
DEBUG:bleak.backends.winrt.client:closing requester
DEBUG:bleak.backends.winrt.client:closing session
INFO:open_gopro.ble.adapters.bleak_wrapper:Device disconnected!

@maccardo maccardo added the bug Something isn't working label Jun 6, 2024
@github-actions github-actions bot added the triage Needs to be reviewed and assigned label Jun 6, 2024
@tcamise-gpsw
Copy link
Collaborator

The Bleak Windows Python interface is not very robust so depending on when / if you reset either device you can run into these types of issues. If you start with a fresh connection state as described below, everything should work:

  1. Reset the camera by choosing Connections –> Reset Connections
  2. Use your OS’s bluetooth settings GUI to remove / unpair the GoPro

@tcamise-gpsw tcamise-gpsw added feedback requested Further information is requested and removed triage Needs to be reviewed and assigned labels Jul 1, 2024
Copy link
Contributor

github-actions bot commented Aug 1, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Aug 1, 2024
Copy link
Contributor

This issue was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback requested Further information is requested Stale
Projects
Status: Done
Development

No branches or pull requests

2 participants