| |

VerySource

 Forgot password?
 Register
Search
View: 915|Reply: 2

How to determine whether a device is an optical drive or a hard disk

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-5 19:50:01
| Show all posts |Read mode
In the Linux system, the device symbol of the optical drive can also be hda, hdb, etc. How can I tell in the code whether the hda is an optical drive or a hard disk? Thank you.

In addition, if the scsi device judges the devicetype field in the INQUIRYDATA data structure, if the value is 0, it is the hard disk?
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-6 15:33:01
| Show all posts
you can use it
dmesg | grep CD
Can be found in the displayed line
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-7 02:27:02
| Show all posts
You should find the information in the proc file.
/ proc / SCSI
/ proc / IDE
You can poll the files in these directories, there may be other related files, and now there is no system that can't help you to see them, you can research it yourself
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list