On 12 January 2016 at 15:47, Max Reitz <[email protected]> wrote: > The series "BlockBackend and media" intended all block devices with > removable media to implement a tray model; if the devices does not have > a tray, it should emulate one.
I tried this for the zaurus (spitz) board, and although "change sd0 file" now doesn't give an error, it doesn't cause the guest to notice that an SD card has been inserted either. I start the guest with no SD card plugged in, and then from the monitor issue "change sd0 file.img". The sd_cardchange callback is called (from blk_dev_change_media_cb, with load==true), but when it sd_cardchange() calls blk_is_inserted(sd->blk) this returns false and so the SD card model reports to the controller that no card is present. If I issue the command again, the callback is called twice, firstly with load=false -- this time blk_is_inserted() returns true and so the sd card says "card has been inserted" (and the guest notices this and prints its usual found-mmc-card logging). Then on the second callback with load==true blk_is_inserted() returns false again and so the card says "card not inserted". So it looks like the sense of blk_is_inserted() when the loading/unloading callbacks are made is the opposite of what the sd.c code is expecting. (You can see this behaviour with just the first 2 cc-stable patches.) thanks -- PMM
