harbour-sailfishconnect icon indicating copy to clipboard operation
harbour-sailfishconnect copied to clipboard

No connection when connecting through USB developer mode

Open R1tschY opened this issue 7 years ago • 5 comments

When phone is connected by USB to computer through developer mode then no connection is possible.

See https://openrepos.net/comment/26268#comment-26268

R1tschY avatar Oct 24 '18 18:10 R1tschY

Just messed around with kdeconnect / sailfishconnect over usb and got a bit further:
<edit>I think it's not a firewall issue, so please ignore that firewall stuff </edit> ~~First of all I realised that the Sailfish firewall blocks all incumming connections but ssh on the usb interface. I modified a line in /etc/connman/firewall.conf from:~~

IPv4.INPUT.RULES = -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT;  -i lo -j ACCEPT

~~to:~~

IPv4.INPUT.RULES = -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT; -i rndis0 -j ACCEPT; -i lo -j ACCEPT

~~This allows all incoming IPv4 traffic via USB interface. I don't think it's too much of a risk.~~ The connection still didn't work. I stopped sailfish connect and setup netcat / nc to listen to the kdeconnect ports (tcp and udp) and connected the phone via wifi.

Now I got a udp message such as:

{"body":{"deviceId":"_????????_?????_????_????_????????????_","deviceName":"???????","deviceType":"desktop","incomingCapabilities":["kdeconnect.notification.request","kdeconnect.sftp","kdeconnect.runcommand.request","kdeconnect.mpris.request","kdeconnect.telephony","kdeconnect.mousepad.keyboardstate","kdeconnect.mousepad.echo","kdeconnect.clipboard","kdeconnect.battery","kdeconnect.ping","kdeconnect.share.request","kdeconnect.mousepad.request","kdeconnect.notification"],"outgoingCapabilities":["kdeconnect.notification.reply","kdeconnect.notification.request","kdeconnect.sms.request","kdeconnect.telephony.request","kdeconnect.mpris","kdeconnect.battery.request","kdeconnect.clipboard","kdeconnect.sftp.request","kdeconnect.ping","kdeconnect.share.request","kdeconnect.runcommand","kdeconnect.notification","kdeconnect.mousepad.request","kdeconnect.findmyphone.request"],"protocolVersion":7,"tcpPort":1716},"id":"????????","payloadSize":0,"payloadTransferInfo":{},"type":"kdeconnect.identity"}

I copied that message, turned off wifi, connected the phone via USB and started sailfish connect.
Still no success.
Then I set up a UDP connection with netcat from the PC to the phone (with IP 192.168.21.15):

nc -uv 192.168.21.15 1716

After I got the connection I copied the message into that netcat session and the phone and PC tell me that they're connected.

So my Impression is that PC and phone send UDP broadcasts (this is stated in the kdeconnect manual) and those broadcasts don't get forwarded from the phone to the pc or vice versa.

Do you have an idea on how to allow broadcast messages on USB?

dimpflmoser avatar Dec 04 '19 21:12 dimpflmoser

Sorry, I'm not familiar with Ethernet USB. The KDE Connect Project is working on using Multicast DNS (MDNS) instead of UDP Broadcasts. Maybe is would help. However, there exists currently only a non-functioning prototype.

Also SailfishConnect is missing a option to manually select IPs to connect to. I think that would also solve your problem. Because a TCP connection is possible, right?

Currently I'm working on integrating SailfishConnect into the KDE Connect project. So there is less time for new features.

R1tschY avatar Dec 27 '19 18:12 R1tschY

Haven't checked whether UDP Broadcasts or MDNS packets are forwarded. Will check that next time. Thanks!

dimpflmoser avatar Jan 04 '20 12:01 dimpflmoser

I tested it and it connects at least for me. As a workaround in version 0.6 the IP of the computer can be added in the settings. When searching for devices a UDP packet is send to this IP address.

R1tschY avatar Feb 07 '21 11:02 R1tschY

It is not fixed. To get this to work one has to directly connect via TCP like GSConnect does.

R1tschY avatar Feb 09 '21 19:02 R1tschY