22
33use crate :: { bios, println, Ctx , API } ;
44
5- /// Called when the "lshw" command is executed.
6- pub fn lshw ( _menu : & menu:: Menu < Ctx > , _item : & menu:: Item < Ctx > , _args : & [ & str ] , _ctx : & mut Ctx ) {
5+ pub static LSHW_ITEM : menu:: Item < Ctx > = menu:: Item {
6+ item_type : menu:: ItemType :: Callback {
7+ function : bioshw,
8+ parameters : & [ ] ,
9+ } ,
10+ command : "bioshw" ,
11+ help : Some ( "List all the BIOS hardware" ) ,
12+ } ;
13+
14+ /// Called when the "bioshw" command is executed.
15+ fn bioshw ( _menu : & menu:: Menu < Ctx > , _item : & menu:: Item < Ctx > , _args : & [ & str ] , _ctx : & mut Ctx ) {
716 let api = API . get ( ) ;
817 let mut found = false ;
918
@@ -18,35 +27,42 @@ pub fn lshw(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _c
1827 println ! ( " None" ) ;
1928 }
2029
21- println ! ( ) ;
2230 found = false ;
2331
2432 println ! ( "Serial Devices:" ) ;
2533 for dev_idx in 0 ..=255u8 {
2634 if let bios:: Option :: Some ( device_info) = ( api. serial_get_info ) ( dev_idx) {
27- println ! ( " {}: {:?}" , dev_idx, device_info) ;
35+ println ! (
36+ " {}: {} {:?}" ,
37+ dev_idx, device_info. name, device_info. device_type
38+ ) ;
2839 found = true ;
2940 }
3041 }
3142 if !found {
3243 println ! ( " None" ) ;
3344 }
3445
35- println ! ( ) ;
3646 found = false ;
3747
3848 println ! ( "Block Devices:" ) ;
3949 for dev_idx in 0 ..=255u8 {
4050 if let bios:: Option :: Some ( device_info) = ( api. block_dev_get_info ) ( dev_idx) {
41- println ! ( " {}: {:?}" , dev_idx, device_info) ;
51+ println ! (
52+ " {}: {} {:?} bs={} size={} MiB" ,
53+ dev_idx,
54+ device_info. name,
55+ device_info. device_type,
56+ device_info. block_size,
57+ ( device_info. num_blocks * u64 :: from( device_info. block_size) ) / ( 1024 * 1024 )
58+ ) ;
4259 found = true ;
4360 }
4461 }
4562 if !found {
4663 println ! ( " None" ) ;
4764 }
4865
49- println ! ( ) ;
5066 found = false ;
5167
5268 println ! ( "I2C Buses:" ) ;
@@ -60,7 +76,6 @@ pub fn lshw(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _c
6076 println ! ( " None" ) ;
6177 }
6278
63- println ! ( ) ;
6479 found = false ;
6580
6681 println ! ( "Neotron Bus Devices:" ) ;
@@ -74,7 +89,6 @@ pub fn lshw(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _c
7489 println ! ( " None" ) ;
7590 }
7691
77- println ! ( ) ;
7892 found = false ;
7993
8094 println ! ( "Audio Mixers:" ) ;
0 commit comments