Commit bd0d90b21d84c7ac3eb258fbf93bec1cbf277986
1 parent
1a0636f8
make Knoppix CD-ROM probe happy
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@448 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
26 additions
and
0 deletions
hw/ide.c
| ... | ... | @@ -371,6 +371,17 @@ static void padstr(char *str, const char *src, int len) |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | +static void padstr8(uint8_t *buf, int buf_size, const char *src) | |
| 375 | +{ | |
| 376 | + int i; | |
| 377 | + for(i = 0; i < buf_size; i++) { | |
| 378 | + if (*src) | |
| 379 | + buf[i] = *src++; | |
| 380 | + else | |
| 381 | + buf[i] = ' '; | |
| 382 | + } | |
| 383 | +} | |
| 384 | + | |
| 374 | 385 | static void ide_identify(IDEState *s) |
| 375 | 386 | { |
| 376 | 387 | uint16_t *p; |
| ... | ... | @@ -1013,6 +1024,21 @@ static void ide_atapi_cmd(IDEState *s) |
| 1013 | 1024 | cpu_to_ube32(buf + 4, 2048); |
| 1014 | 1025 | ide_atapi_cmd_reply(s, 8, 8); |
| 1015 | 1026 | break; |
| 1027 | + case GPCMD_INQUIRY: | |
| 1028 | + max_len = packet[4]; | |
| 1029 | + buf[0] = 0x05; /* CD-ROM */ | |
| 1030 | + buf[1] = 0x80; /* removable */ | |
| 1031 | + buf[2] = 0x00; /* ISO */ | |
| 1032 | + buf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */ | |
| 1033 | + buf[4] = 31; /* additionnal length */ | |
| 1034 | + buf[5] = 0; /* reserved */ | |
| 1035 | + buf[6] = 0; /* reserved */ | |
| 1036 | + buf[7] = 0; /* reserved */ | |
| 1037 | + padstr8(buf + 8, 8, "QEMU"); | |
| 1038 | + padstr8(buf + 16, 16, "QEMU CD-ROM"); | |
| 1039 | + padstr8(buf + 32, 4, QEMU_VERSION); | |
| 1040 | + ide_atapi_cmd_reply(s, 36, max_len); | |
| 1041 | + break; | |
| 1016 | 1042 | default: |
| 1017 | 1043 | error_cmd: |
| 1018 | 1044 | ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, | ... | ... |