summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.com>2022-04-12 19:56:24 +0200
committerGerd Hoffmann <kraxel@redhat.com>2022-04-22 14:52:30 +0200
commita87910be58c8b9533732bb727321ab4290bb8862 (patch)
tree35dc2b1e24c8e028e20798cb5683a7a80898b472
parent0f1dbb53b693ab9989be7b3cda3e242af1cae07d (diff)
downloadamtterm-a87910be58c8b9533732bb727321ab4290bb8862.tar.gz
ider: implement device select
IDE redirection supports two device, the first being a floppy and the second one a CD-ROM. Signed-off-by: Hannes Reinecke <hare@suse.de>
-rw-r--r--ider.c3
-rw-r--r--redir.c3
-rw-r--r--redir.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/ider.c b/ider.c
index 5b5bddd..2e4429e 100644
--- a/ider.c
+++ b/ider.c
@@ -88,9 +88,8 @@ static int ider_packet_sense(struct redir *r, unsigned int seqno,
}
int ider_handle_command(struct redir *r, unsigned int seqno,
- unsigned char *cdb)
+ unsigned char device, unsigned char *cdb)
{
- unsigned char device = 0xb0;
unsigned char resp[512];
uint32_t lba, sector_size;
diff --git a/redir.c b/redir.c
index 6e1e0f8..3c4ae29 100644
--- a/redir.c
+++ b/redir.c
@@ -447,6 +447,7 @@ static int redir_ider_command(struct redir *r, unsigned int seqno)
{
struct ider_command_written_message *msg =
(struct ider_command_written_message *)r->buf;
+ unsigned char device = msg->drive_select & 0x10 ? 0xb0 : 0xa0;
int i;
if (msg->command != 0xa0) {
@@ -459,7 +460,7 @@ static int redir_ider_command(struct redir *r, unsigned int seqno)
fprintf(stderr, "%02x ", msg->packet_data[i]);
fprintf(stderr, "\n");
- return ider_handle_command(r, seqno, msg->packet_data);
+ return ider_handle_command(r, seqno, device, msg->packet_data);
}
int redir_ider_recv(struct redir *r)
diff --git a/redir.h b/redir.h
index 1974c6d..8c54158 100644
--- a/redir.h
+++ b/redir.h
@@ -140,4 +140,4 @@ int redir_data(struct redir *r);
ssize_t redir_write(struct redir *r, const char *buf, size_t count);
int ider_handle_command(struct redir *r, unsigned int seqno,
- unsigned char *cdb);
+ unsigned char device, unsigned char *cdb);