@@ -538,7 +538,6 @@ int get_spi_bus_path_number(unsigned int spi)
538538
539539/*
540540 Refer to: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
541-
542541 Robert C. Nelson maintains the BeagleBoard.org Debian images and
543542 suggested adding this check to see if u-boot overlays are enabled.
544543
@@ -554,6 +553,7 @@ int uboot_overlay_enabled(void) {
554553 file = popen (cmd , "r" );
555554 if (file == NULL ) {
556555 fprintf (stderr , "error: uboot_overlay_enabled() failed to run cmd=%s\n" , cmd );
556+ syslog (LOG_ERR , "Adafruit_BBIO: error: uboot_overlay_enabled() failed to run cmd=%s\n" , cmd );
557557 return -1 ;
558558 }
559559 uboot_overlay = fgetc (file );
@@ -577,6 +577,7 @@ int pocketbeagle(void) {
577577 file = popen (cmd , "r" );
578578 if (file == NULL ) {
579579 fprintf (stderr , "error: pocketbeagle() failed to run cmd=%s\n" , cmd );
580+ syslog (LOG_ERR , "Adafruit_BBIO: error: pocketbeagle() failed to run cmd=%s\n" , cmd );
580581 return -1 ;
581582 }
582583 pocketbeagle = fgetc (file );
@@ -589,6 +590,35 @@ int pocketbeagle(void) {
589590 }
590591}
591592
593+
594+ /*
595+ Check if board is a BeagleBone Blue
596+
597+ Refer to GitHub issue for more information:
598+ https://github.com/adafruit/adafruit-beaglebone-io-python/issues/178
599+ */
600+ int beaglebone_blue (void ) {
601+ const char * cmd = "/bin/grep -c 'TI AM335x BeagleBone Blue' /proc/device-tree/model" ;
602+ char blue ;
603+ FILE * file = NULL ;
604+
605+ file = popen (cmd , "r" );
606+ if (file == NULL ) {
607+ fprintf (stderr , "error: beaglebone_blue() failed to run cmd=%s\n" , cmd );
608+ syslog (LOG_ERR , "Adafruit_BBIO: error: beaglebone_blue() failed to run cmd=%s\n" , cmd );
609+ return -1 ;
610+ }
611+ blue = fgetc (file );
612+ pclose (file );
613+
614+ if (blue == '1' ) {
615+ return 1 ;
616+ } else {
617+ return 0 ;
618+ }
619+ }
620+
621+
592622BBIO_err load_device_tree (const char * name )
593623{
594624 char line [256 ];
@@ -745,7 +775,7 @@ void initlog(int level, const char* ident, int option)
745775 option = BBIO_LOG_OPTION ;
746776 }
747777 openlog (ident , option , LOG_LOCAL1 );
748- syslog (LOG_NOTICE , "libadafruit-bbio version %s initialized" , "<unknown>" );
778+ syslog (LOG_NOTICE , "Adafruit_BBIO: version %s initialized" , "<unknown>" );
749779
750780 initialized = 1 ;
751781}
0 commit comments