-
Notifications
You must be signed in to change notification settings - Fork 9
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
Error "Tunnel failed, Err #2: Device isn't connected" when multiple device added #4
Comments
Here's how I would listen to / create tunnels for devices: var listener = usbmux.createListener()
.on('attached', function(udid) {
console.log('Device attached: %s', udid);
createSocket(udid);
})
.on('detached', function(udid) {
console.log('Device detached: %s', udid);
})
.on('error', function(err) {
console.log(err);
});
function createSocket(udid) {
usbmux.getTunnel(10022, {udid: udid}) // <-- with udid
.then(function(tunnel) {
console.log('Tunnel created on %s', udid);
tunnel.write('hello');
})
.catch(function(err) {
console.log(err);
});
} Are you doing something similar? You can enable debugging and see if something is going obviously wrong with the usbmuxd handshake. Set an environment variable There was also problem with the library and linux/libimobiledevice which could be it. The usbmuxd that comes with libimobiledevice only gets started when a device is attached and stops as soon as the last device is removed. It's a different behavior that osx/windows where it always runs in the background. I added in a filesystem watcher to check for the You can install the github branch with npm with |
I'm doing quite similar like that one you wrote. After then I'm creating the tunnel as you said earlier using What I'm doing is that, function createSocket(device) {
usbmux.getTunnel(10022, {udid: device.udid}).then(function(tunnel) {
device.tunnel = tunnel;
})
.catch(function(err) {
console.log(err);
});
} In other function I'm using Is the socket is not closing when detaching the device? I'm gonna try with the specific branch, I'll let you know any progress. But please tell me if this approach is ok or I need to change something. |
I'm using latest node-usbmux,
Ubuntu: 16.04
libimobiledevice usbmuxd installed.
When I add multiple device and create tunnel for them it's works perfectly. The issue occurs when I remove a device and reconnect again.
In the app code I'm creating tunnel for each device when the device is connected. The issue only occurs when reconnecting the phone.
Is this an issue with the library or in the way I'm creating tunnel?
Help will be appreciated. Thanks
The text was updated successfully, but these errors were encountered: