Commit bd491d6a4ecc57144ffa55c0daf97b43bc1648ce

Authored by ths
1 parent 71e3ceb8

Fix CDROM change, by Anthony Liguori.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2262 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 12 additions and 0 deletions
hw/ide.c
... ... @@ -1481,6 +1481,17 @@ static void ide_atapi_cmd(IDEState *s)
1481 1481 }
1482 1482 }
1483 1483  
  1484 +/* called when the inserted state of the media has changed */
  1485 +static void cdrom_change_cb(void *opaque)
  1486 +{
  1487 + IDEState *s = opaque;
  1488 + int64_t nb_sectors;
  1489 +
  1490 + /* XXX: send interrupt too */
  1491 + bdrv_get_geometry(s->bs, &nb_sectors);
  1492 + s->nb_sectors = nb_sectors;
  1493 +}
  1494 +
1484 1495 static void ide_cmd_lba48_transform(IDEState *s, int lba48)
1485 1496 {
1486 1497 s->lba48 = lba48;
... ... @@ -2111,6 +2122,7 @@ static void ide_init2(IDEState *ide_state,
2111 2122 }
2112 2123 if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
2113 2124 s->is_cdrom = 1;
  2125 + bdrv_set_change_cb(s->bs, cdrom_change_cb, s);
2114 2126 }
2115 2127 }
2116 2128 s->drive_serial = drive_serial++;
... ...