Skip to content

GSConnect is sending requests the paired device can't handle (ignoring incomingCapabilities) #2106

@ferdnyc

Description

@ferdnyc

Describe the bug

From the logs on the Android side, it appears that several of our plugins send packets (primarily requests) to the paired device without first checking whether the device can accept those packets, despite that information being readily available in the device's incomingCapabilities list (which we receive on initial connection and store in the device's settings).

The battery plugin and the connectivity_report plugin, at least, both have a _requestState() method which will generate a packet (kdeconnect.battery.request or kdeconnect.connectivity_report.request, respectively) and send it to the device. But, recent KDE Connect Android releases do not accept either of these packets, being willing to send updates only at their discretion, not on demand. (kdeconnect.battery and kdeconnect.connectivity_report both still appear in the device's outgoingCapabilities.)

This one-way messaging is correctly reflected in the incomingCapabilities list sent by the device on initial handshake, which GSConnect stores in the list accessible via device.settings.get('incoming-capabilities') , AKA DCONF path /org/gnome/shell/extensions/gsconnect/device/${id}/incoming-capabilities.

For my Android 16 Samsung phone running KDE Connect 1.34.4, that list is:

$ GSETTINGS_SCHEMA_DIR=/home/ferd/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/schemas dconf read /org/gnome/shell/extensions/gsconnect/device/$ID/incoming-capabilities |sed -e 's/, /,\n/g'   
['kdeconnect.battery',
'kdeconnect.clipboard',
'kdeconnect.clipboard.connect',
'kdeconnect.contacts.request_all_uids_timestamps',
'kdeconnect.contacts.request_vcards_by_uid',
'kdeconnect.findmyphone.request',
'kdeconnect.mousepad.keyboardstate',
'kdeconnect.mousepad.request',
'kdeconnect.mpris',
'kdeconnect.mpris.request',
'kdeconnect.notification',
'kdeconnect.notification.action',
'kdeconnect.notification.reply',
'kdeconnect.notification.request',
'kdeconnect.ping',
'kdeconnect.runcommand',
'kdeconnect.sftp.request',
'kdeconnect.share.request',
'kdeconnect.share.request.update',
'kdeconnect.sms.request',
'kdeconnect.sms.request_attachment',
'kdeconnect.sms.request_conversation',
'kdeconnect.sms.request_conversations',
'kdeconnect.systemvolume',
'kdeconnect.telephony.request_mute']

Steps to reproduce

  1. Run GSConnect
  2. Run KDE Connect Android
  3. Pair
  4. Know the code (and read the Android logcat)

Expected behavior

GSConnect is a good citizen, and doesn't generate packets the other end is unwilling to accept.

GSConnect version

v71

Installed from

GNOME Extensions website

GNOME Shell version

49

Linux distribution/release

Fedora 43

Paired device(s)

Samsung Galaxy A53

KDE Connect app version

1.34.4

Plugin(s)

Battery, Connectivity Report, possibly others

Support log


Screenshots

No response

Notes

There isn't, technically, any major problem with sending unsupported packets to a device. It will examine them and reject them as unsupported. But it has to do so each time we generate one, and makes those packets effectively noise on the line. They're useless, and the device TOLD us right up front that they'd be useless. Yet the plugin stats on my device show that it's received 103 battery.request packets and 103 connectivity_report.request packets.

To be good citizens of the KDE Connect ecosystem, we should be checking the capabilities on our end, and suppressing (IOW, not generating) any packets that the device isn't prepared to handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue that is confirmed as a buggood first issueprotocolA problem caused by protocol ambiguity or non-conformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions