@@ -890,6 +890,35 @@ static int detect_techpoint_adc(sensor_ctx_t *ctx, int fd,
890890 return res ;
891891}
892892
893+ static int detect_imagedesign_sensor (sensor_ctx_t * ctx , int fd ,
894+ unsigned char i2c_addr ) {
895+ if (i2c_change_addr (fd , i2c_addr ) < 0 )
896+ return false;
897+
898+ int msb = i2c_read_register (fd , i2c_addr , 0x3000 , 2 , 1 );
899+ if (msb == -1 )
900+ return false;
901+
902+ int lsb = i2c_read_register (fd , i2c_addr , 0x3001 , 2 , 1 );
903+ if (lsb == -1 )
904+ return false;
905+
906+ int res = msb << 8 | lsb ;
907+ switch (res ) {
908+ case 0x2006 :
909+ case 0x2008 : // XM states 0x2008 is MIS2009, not going to believe that yet
910+ sprintf (ctx -> sensor_id , "MIS%04x" , res );
911+ return true;
912+ case 0x1311 :
913+ sprintf (ctx -> sensor_id , "MIS4001" );
914+ return true;
915+ default :
916+ SENSOR_ERR ("ImageDesign" , res );
917+ return false;
918+ }
919+ // MIS40C1 0xce4 @ 3107-3108 ?
920+ }
921+
893922static int detect_possible_sensors (sensor_ctx_t * ctx , int fd ,
894923 int (* detect_fn )(sensor_ctx_t * ctx , int ,
895924 unsigned char ),
@@ -958,6 +987,10 @@ static bool get_sensor_id_i2c(sensor_ctx_t *ctx) {
958987 SENSOR_TECHPOINT )) {
959988 strcpy (ctx -> vendor , "TechPoint" );
960989 detected = true;
990+ } else if (detect_possible_sensors (ctx , fd , detect_imagedesign_sensor ,
991+ SENSOR_IMAGEDESIGN )) {
992+ strcpy (ctx -> vendor , "ImageDesign" );
993+ detected = true;
961994 }
962995exit :
963996 close_sensor_fd (fd );
0 commit comments