Am 10.02.2012 18:04, schrieb Luiz Capitulino: > This reminds me about an earlier try where I did the following, iirc: > > 1. added commands blockdev-tray-open, blockdev-tray-close, > blockdev-medium-insert, > blockdev-medium-remove > 2. added the events: BLOCK_TRAY_OPEN, BLOCK_TRAY_CLOSE, BLOCK_MEDIUM_INSERTED > BLOCK_MEDIUM_REMOVED, which would be emitted when the relating command is > issued > (maybe the events could just be BLOCK_TRAY_CHANGED & BLOCK_MEDIUM_CHANGED) > 3. re-wrote eject and change in terms of the new commands, note that you get > the > events for free > > Now, maybe the guest eject could also emit BLOCK_TRAY_OPEN & > BLOCK_TRAY_CLOSE. Then > I think this is a complete solution. > > Do you guys agree?
Looks good to me in general. I'm not sure how you're imagining to implement this, I would prefer not to emit events from the device code, but only from block.c. Another interesting point is what to do with host CD-ROM passthrough. I think the TRAY_OPEN/CLOSE part is doable (do Paolo's patches actually do that, so that we just need to add an event?). We would have to fake MEDIUM_REMOVED/INSERTED immediately before a TRAY_CLOSE if the medium has changed. LOCK/UNLOCK (which you forgot in your list) is only initiated by the guest or monitor (eject -f), so there's nothing special with passthrough. Kevin