I can open input and output channels and they fire attach and detach events. I can see the hardware in the phidget control panel.
If I open a manager channel it does not fire attach or detach events. When logging it shows that the driver realizes the attachment, but it does not fire the event.
I am using a slightly modified version of the manager sample code. I have added the logger and some sysout's.
I am using Mac OS Sierra 10.12.6.; JDK 1.8.0_45.
Question: can anybody replicate the issue?
Output is:
code is as follows:Opening...
DEBUG [phidget22][2017-09-27T21:07:07 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:07 dispatch.c+163 entryDispatched()]: created dispatcher
Phidget simple playground (plug and unplug devices)
Press enter to end anytime
INFO [phidget22][2017-09-27T21:07:12 macusb.c+416 RawDeviceAdded()]: Attach: 0x0000c903
DEBUG [phidget22][2017-09-27T21:07:12 phidget.c+1463 _addDevice()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+163 entryDispatched()]: created dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+163 entryDispatched()]: created dispatcher
INFO [phidget22][2017-09-27T21:07:16 macusb.c+580 RawDeviceRemoved()]: Detach: 0x0000c903
DEBUG [phidget22][2017-09-27T21:07:16 manager.c+268 deviceDetach()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)
DEBUG [phidget22net][2017-09-27T21:07:16 server.c+346 sendNetDeviceDetached()]: 0x7f85bb865600 PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)
Code: Select all
import com.phidget22.*;
public class HelloWorldExample {
public static void main(String[] args) throws Exception {
Manager phidman = new Manager();
com.phidget22.Log.enable(LogLevel.DEBUG, null);
phidman.addAttachListener((ManagerAttachEvent ev)->{
System.out.println("AttachEvent fired");
Phidget phid = ev.getChannel();
try{
System.out.println("Hello device: " + phid.getDeviceName() + ", Serial Number: " + phid.getDeviceSerialNumber());
}catch(PhidgetException ex){
System.out.println(ex.getDescription());
}
});
phidman.addDetachListener((ManagerDetachEvent ev) -> {
Phidget phid = ev.getChannel();
try{
System.out.println("Goodbye device: " + phid.getDeviceName() + ", Serial Number: " + phid.getDeviceSerialNumber());
}catch(PhidgetException ex){
System.out.println(ex.getDescription());
}
});
try {
System.out.println("Opening...");
phidman.open();
System.out.println("Phidget simple playground (plug and unplug devices)");
System.out.println("Press enter to end anytime");
System.in.read();
System.out.println("Closing...");
phidman.close();
} catch (PhidgetException ex) {
System.out.println(ex.getDescription());
}
}
}