[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] How to recognize a type of drive?



2014-02-08 11:16 GMT+01:00 OL <o.l@lutece.net>:
> Hello,
>
> hello is there any way to recognize the different type of drive like hard
> drive, cd drive, zip drive, usb drive etc..?
>

I don't know any way to do it easily, with information got from XHDI
you can deduce what it could be.
If the device is driven by XHDI you could use the function XHInqDev2()
to get the major XHDI number from the BIOS device number, you'll get
also the partition ID which can tell you if is for example a CD-ROM.
Once you have the major XHDI number you'll know the bus where the
device is attached:
(from TOS.HYP)

major: Major Device Number
0..7: Devices on the ACSI bus with ATARI-compatible command set
8..15: Devices on the SCSI bus
16..17: Devices connected to the primary IDE interface
18..19: Devices connected to a secondary IDE interface
20..23: Additional IDE devices
24..63: Extensions as defined in the pun field in the PUN_INFO structure
64: Devices on the standard floppy controller
65..255: Extensions outside the scope of AHDI.

>From major 32 to 63 is an USB device. (this isn't documented but it's
what is using Didier's TOS and MiNT)

With the major number you can call XHInqTarget2() and you will get this flags:
(from TOS.HYP)

0 Device is stoppable (XH_TARGET_STOPPABLE (0x00000001L))
1 The medium is removable (XH_TARGET_REMOVABLE (0x00000002L))
2 The eject mechanism can be locked (XH_TARGET_LOCKABLE (0x00000004L))
3 The device can physically eject the medium (XH_TARGET_EJECTABLE (0x00000008L))
29 Eject mechanism has been locked by the driver (XH_TARGET_LOCKED
(0x20000000L), from XHDI 1.25 up).
30 Device has been stopped by the driver (XH_TARGET_STOPPED
(0x40000000L), from XHDI 1.25 up ).
31 The device is currently reserved (XH_TARGET_RESERVED (0x80000000L)).

and a string with the product description.

If the device isn't driven by XHDI you could check the PUN_INFO struct
to know the bus where the device is attached.

This is what I can tell, may be others have more ideas.