@@ -34,16 +34,31 @@ static int walkDevTree(di_node_t node, di_minor_t minor, struct FFWalkTreeBundle
3434 device -> size = 0 ;
3535
3636 char * buf ;
37+ bool usb = false;
3738 if (di_prop_lookup_strings (DDI_DEV_T_ANY , node , "inquiry-serial-no" , & buf ) > 0 ) {
3839 ffStrbufSetS (& device -> serial , buf );
3940 ffStrbufTrimSpace (& device -> serial );
41+ } else {
42+ di_node_t parent = di_parent_node (node );
43+ if (parent != DI_NODE_NIL && di_prop_lookup_strings (DDI_DEV_T_ANY , parent , "usb-serialno" , & buf ) > 0 ) {
44+ ffStrbufSetS (& device -> serial , buf );
45+ usb = true;
46+ }
4047 }
4148 if (di_prop_lookup_strings (DDI_DEV_T_ANY , node , "inquiry-revision-id" , & buf ) > 0 ) {
4249 ffStrbufSetS (& device -> revision , buf );
4350 ffStrbufTrimRightSpace (& device -> revision );
4451 }
45- if (di_prop_lookup_strings (DDI_DEV_T_ANY , node , "class" , & buf ) > 0 ) {
52+
53+ if (usb ) {
54+ ffStrbufSetStatic (& device -> interconnect , "USB" );
55+ } else if (di_prop_lookup_strings (DDI_DEV_T_ANY , node , "class" , & buf ) > 0 ) {
4656 ffStrbufSetS (& device -> interconnect , buf );
57+ } else {
58+ di_node_t parent = di_parent_node (node );
59+ if (parent != DI_NODE_NIL && di_prop_lookup_strings (DDI_DEV_T_ANY , parent , "model" , & buf ) > 0 ) {
60+ ffStrbufSetS (& device -> interconnect , buf );
61+ }
4762 }
4863
4964 device -> type |= di_prop_find (DDI_DEV_T_ANY , node , "removable-media" ) ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED ;
0 commit comments