-
Notifications
You must be signed in to change notification settings - Fork 303
Description
c+p from the old ticket created by @iKenndac
Hello,
I'm writing a client against libCEC, and I've noticed that if the device is connected to the computer during boot, it can't be detected by libCEC until it's been unplugged and reconnected. This hasn't always happened, and as such I thought it was a problem with my device. However, a user of my client has the same problem.
If memory services me correctly, I believe this started around the time the composite device firmware arrived.
My device is running firmware v4: libCEC version = 2.1.3, client version = 2.1.3, firmware version = 4, firmware build date: Thu Dec 6 11:15:20 2012 +0000, logical address(es) = Playback 2 (8) , physical address: 1.1.0.0, host: unknown, features: unknown, compiled: Sep 29 2013
I did some digging around in IOJones, and found the following:
- When the device is working correctly, IOKit sees the adapter correctly with three devices: Serial control, serial data and the HID device.
/dev/tty.usbmodemv2 r1exists.
- Just after boot, the three composite devices are listed but only the HID device has any information.
/dev/tty.usbmodemv2 r1(or anything similar) does not exist. No amount of relaunching applications will fix this - only a physical unplug and plug will return the device to the first state.
Unless there's some magic command that I'm missing, it actually looks like this is a problem with the device rather than libCEC itself. If you need any help debugging, I can help out.
I've been tinkering around with this and I've found a horrible workaround!
If you force the USB bus to do a "soft reset" of the device (which seems to just simulate unplugging and reconnecting the device to me, but I'm not an expert), when the device is re-detected by the system, all the services are found correctly and the device can work.
Unfortunately, this is a fair amount of extra code since you have to find the adapter by iterating USB devices rather than serial ports. I've created a sample project over here, with the interesting stuff in DKAppDelegate.m.

