dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
85 stars 12 forks source link

since fixing #48, optical device shows up as ferromag #49

Closed dankamongmen closed 4 years ago

dankamongmen commented 4 years ago

│ sr0┌─────────────────────────────────────────────────────────────────┐│ │ ferromag│No media detected in drive ││ │ no i/o└┤iHBS112 2 CL0F 1.07G 512B none n/a PATA├┘

bah. this is since fixing #48 . this is better, since those other ones certainly were not optical and there are a lot fewer optical devices than hotswappable hard drives, but still, get this fixed up.

also need to check growlight-readline about this.

dankamongmen commented 4 years ago
[growlight](0)> blockdev
Device     Model             Rev   Bytes PSect Flags Table WWN              PHY 
sdh        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b1c2c393 SAT3
sdg        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b56a29d4 SAT3
sdi        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b56936d2 SAT3
sdf        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b5685ea4 SAT3
sdb        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b3f4afb4 SAT3
sdd        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b49867e5 SAT3
sde        ST12000NM0007-2A SN03  12.00T 4096B ✔OW⚠. gpt   5000c500a5c0e61d SAT3
sda        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b4104bf5 SAT3
sdc        ST12000NM0007-2A SN02  12.00T 4096B ✔OW⚠. gpt   5000c500b4984eca SAT3
sr0        iHBS112   2      CL0F   1.07G  512B UO... none  n/a              PATA
nvme0n1    WDS100T3X0C-00SJ  n/a   1.00T  512B ✔.... gpt   1908E1805012     NVMe
nvme1n1    WDS100T3X0C-00SJ  n/a   1.00T  512B ✔.... gpt   1908E1801188     NVMe
md127      Linux mdadm       1.2 106.23G  512B VM... none  root             NVMe
loop5      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop3      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop0      n/a               n/a    0.00  512B VO... none  n/a              n/a 
pktcdvd0   n/a               n/a    0.00 2048B RO... none  n/a              n/a 
loop2      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop7      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop4      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop6      n/a               n/a    0.00  512B VO... none  n/a              n/a 
loop1      n/a               n/a    0.00  512B VO... none  n/a              n/a 
sdl        MS/MS-PRO        1.03    0.00  512B UO... none  n/a              PATA
sdj        Compact Flash    1.01    0.00  512B UO... none  n/a              PATA
sdk        SD/MMC           1.00    0.00  512B UO... none  n/a              PATA
sdm        xD-Picture       1.02    0.00  512B UO... none  n/a              PATA

    Flags:  (R)emovable, (U)nloaded, (V)irtual, (M)dadm, (Z)pool,
        (D)M, r(O)tational, (r)ead-only, (W)ritecache enabled,
        (B)IOS bootable, v/⚠: Read-Write-Verify, ✓/✗/☠: SMART status
[growlight](0)> 

sr0 doesn't show up as removable, but pktcdvd0 helpfully does...

dankamongmen commented 4 years ago

I think the way to do this is check /sys/block/DEV/device/type:

#define TYPE_DISK 0x00
#define TYPE_TAPE 0x01
#define TYPE_PRINTER 0x02
#define TYPE_PROCESSOR 0x03 /* HP scanners use this */
#define TYPE_WORM 0x04 /* Treated as ROM by our system */
#define TYPE_ROM 0x05
#define TYPE_SCANNER 0x06
#define TYPE_MOD 0x07 /* Magneto-optical disk -
* - treated as TYPE_DISK */
#define TYPE_MEDIUM_CHANGER 0x08
#define TYPE_COMM 0x09 /* Communications device */
#define TYPE_RAID 0x0c
#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
#define TYPE_RBC 0x0e
#define TYPE_NO_LUN 0x7f

This is 0 for every device I have save my cdrom, which is 0x05.

dankamongmen commented 4 years ago

We now properly show "optical" for my BD-RW.