File tree Expand file tree Collapse file tree 7 files changed +33
-15
lines changed Expand file tree Collapse file tree 7 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -650,6 +650,7 @@ elseif(FreeBSD)
650650        src/detection/gpu/gpu_pci.c
651651        src/detection/gtk_qt/gtk.c
652652        src/detection/host/host_bsd.c
653+         src/detection/host/host_mac.c
653654        src/detection/lm/lm_linux.c
654655        src/detection/icons/icons_linux.c
655656        src/detection/initsystem/initsystem_linux.c
@@ -951,6 +952,7 @@ elseif(WIN32)
951952        src/detection/dns/dns_windows.c
952953        src/detection/font/font_windows.c
953954        src/detection/gpu/gpu_windows.c
955+         src/detection/host/host_mac.c
954956        src/detection/host/host_windows.c
955957        src/detection/icons/icons_windows.c
956958        src/detection/initsystem/initsystem_nosupport.c
Original file line number Diff line number Diff line change @@ -13,4 +13,6 @@ typedef struct FFHostResult
1313    FFstrbuf  vendor ;
1414} FFHostResult ;
1515
16+ const  char *  ffHostGetMacProductNameWithHwModel (const  FFstrbuf *  hwModel );
17+ bool  ffHostDetectMac (FFHostResult *  host );
1618const  char *  ffDetectHost (FFHostResult *  host );
Original file line number Diff line number Diff line change @@ -39,8 +39,6 @@ const char* getOthersByIokit(FFHostResult* host)
3939    return  NULL ;
4040}
4141
42- const  char *  ffHostGetMacProductNameWithHwModel (const  FFstrbuf *  hwModel );
43- 
4442const  char *  ffDetectHost (FFHostResult *  host )
4543{
4644    const  char *  error  =  ffSysctlGetString ("hw.model" , & host -> family );
Original file line number Diff line number Diff line change @@ -19,5 +19,9 @@ const char* ffDetectHost(FFHostResult* host)
1919    ffSettingsGetFreeBSDKenv ("smbios.system.maker" , & host -> vendor );
2020    ffCleanUpSmbiosValue (& host -> vendor );
2121
22+     #ifdef  __x86_64__ 
23+     ffHostDetectMac (host );
24+     #endif 
25+ 
2226    return  NULL ;
2327}
Original file line number Diff line number Diff line change 55
66#include  <stdlib.h> 
77
8- const  char *  ffHostGetMacProductNameWithHwModel (const  FFstrbuf *  hwModel );
9- 
108static  void  getHostProductName (FFstrbuf *  name )
119{
1210    if  (ffReadFileBuffer ("/sys/firmware/devicetree/base/model" , name ))
@@ -64,17 +62,9 @@ const char* ffDetectHost(FFHostResult* host)
6462        if  (ffStrbufStartsWithS (& host -> name , "Apple " ))
6563            ffStrbufSetStatic (& host -> vendor , "Apple Inc." );
6664    }
65+ 
6766    #ifdef  __x86_64__ 
68-     else  if  (ffStrbufEqualS (& host -> family , "Mac ") &&  ffStrbufEqualS (& host -> vendor , "Apple  Inc ."))
69-     {
70-         const  char *  productName  =  ffHostGetMacProductNameWithHwModel (& host -> name );
71-         if  (productName )
72-         {
73-             ffStrbufDestroy (& host -> family );
74-             ffStrbufInitMove (& host -> family , & host -> name );
75-             ffStrbufSetStatic (& host -> name , productName );
76-         }
77-     }
67+     ffHostDetectMac (host );
7868    #endif 
7969
8070    //KVM/Qemu virtual machine 
Original file line number Diff line number Diff line change 1- #include  "util/FFstrbuf .h" 
1+ #include  "host .h" 
22#include  "util/stringUtils.h" 
33
44const  char *  ffHostGetMacProductNameWithHwModel (const  FFstrbuf *  hwModel )
@@ -173,3 +173,21 @@ const char* ffHostGetMacProductNameWithHwModel(const FFstrbuf* hwModel)
173173    }
174174    return  NULL ;
175175}
176+ 
177+ bool  ffHostDetectMac (FFHostResult *  host )
178+ {
179+     #ifdef  __x86_64__ 
180+     if  (ffStrbufEqualS (& host -> family , "Mac" ) &&  ffStrbufEqualS (& host -> vendor , "Apple Inc." ))
181+     {
182+         const  char *  productName  =  ffHostGetMacProductNameWithHwModel (& host -> name );
183+         if  (productName )
184+         {
185+             ffStrbufDestroy (& host -> family );
186+             ffStrbufInitMove (& host -> family , & host -> name );
187+             ffStrbufSetStatic (& host -> name , productName );
188+             return  true;
189+         }
190+     }
191+     #endif 
192+     return  false;
193+ }
Original file line number Diff line number Diff line change @@ -72,5 +72,9 @@ const char* ffDetectHost(FFHostResult* host)
7272        ffCleanUpSmbiosValue (& host -> family );
7373    }
7474
75+     #ifdef  __x86_64__ 
76+     ffHostDetectMac (host );
77+     #endif 
78+ 
7579    return  NULL ;
7680}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments