Lib/Support/Platform.cpp
/**
 * Return short string with main version of the current pi
 */
Return short string with main version of the current pi
Return short string with main version of the current pi
std::string Platform::pi_version() {
  std::string ret = "Not Pi";
  std::string val;
  if (!get_platform_string(val)) {
    return ret;
  }
  std::string const prefix = "Raspberry Pi ";
  if (val.find(prefix) != 0) {
    ret = "Not RPi";
    return ret;
  }
  char version = val[prefix.length()];
  if (version == 'M') {  
    version = '1';
  }
  ret = "pi";
  ret += version;
  assertq('1' <= version && version <= '4', "Unknown pi version number");
#ifdef ARM64
  ret += "-64";
#endif
  return ret;
}
std :: string Platform :: pi_version ( ) { std :: string ret = " " ; std :: string val ; if ( ! get_platform_string ( val ) ) { return ret ; } std :: string const prefix = " " ; if ( val . find ( prefix ) != 0 ) { ret = " " ; return ret ; } char version = val [ prefix . length ( ) ] ; if ( version == ' ' ) { version = ' ' ; } ret = " " ; ret += version ; assertq ( ' ' <= version && version <= ' ' , " " ) ; #ifdef ARM64 ret += " " ; #endif return ret ; }
Return short string with main version of the current pi
Return short string with main version of the current pi
// Pi1 has no explicit number in version string; this checks the 'M' in 'Raspberry Pi Model B Rev 2'