artehe / Netimobiledevice

A C#/dotnet implementation for working with iOS devices (iPhone, iPad, iPod).
https://github.com/artehe/Netimobiledevice
MIT License
14 stars 7 forks source link

Invalid message sent to usbmuxd when creating a new connection #46

Closed dmdmdm-nz closed 1 week ago

dmdmdm-nz commented 1 week ago

Describe the bug When trying to enumerate devices on Linux Netimobiledevice reports that it's unable to connect to usbmuxd.

I've tried the same code on Windows and macOS and it works. We're running a recent version libimobiledevice/usbmuxd so potentially it's more strict than usbmuxd is on Windows/macOS.

After doing a bit of digging it appears that the UsbmuxConnection::Create method sends an invalid ReadBUID message to usbmuxd and so it terminates the connection.

Additional context

The UsbmuxConnection::Create method sends the ReadBUID message to usbmuxd:

PropertyNode plistMessage = new StringNode("ReadBUID");
conn.Send(plistMessage);
PlistResponse response = conn.ReceivePlist(tag);

Instead, this code should be:

DictionaryNode msg = new DictionaryNode() {
    { "MessageType", new StringNode("ReadBUID") }
};
conn.Send(plistMessage);
PlistResponse response = conn.ReceivePlist(tag);
artehe commented 1 week ago

That's a good spot thank you. I must admit I haven't done any testing on Linux.

Will make the change on Monday and test it out. However if you don't want to wait till then feel free to make a pr with this 😁

dmdmdm-nz commented 1 week ago

Thanks @artehe ... I've added a PR with the change.