@@ -399,6 +399,13 @@ bool VideoCapture::openCamera( uint8_t devId )
399
399
}
400
400
// <---- Open
401
401
402
+ int sn = getSerialNumber ();
403
+ if (mParams .verbose )
404
+ {
405
+ std::string msg = std::string (" Opened camera with SN: " ) + std::to_string (sn);
406
+ INFO_OUT (mParams .verbose ,msg);
407
+ }
408
+
402
409
// ----> Init
403
410
struct v4l2_capability cap;
404
411
memset (&cap, 0 , sizeof (v4l2_capability));
@@ -540,8 +547,8 @@ bool VideoCapture::openCamera( uint8_t devId )
540
547
541
548
int VideoCapture::getSerialNumber ()
542
549
{
543
- if (!mInitialized )
544
- return -1 ;
550
+ /* if(!mInitialized)
551
+ return -1;*/
545
552
546
553
int ulValue = -1 ;
547
554
@@ -553,7 +560,7 @@ int VideoCapture::getSerialNumber()
553
560
int try_count = 0 ;
554
561
while (res!=0 )
555
562
{
556
- res = ll_SPI_FlashProgramRead (&UNIQUE_BUF[0 ], UNIQUE_ID_START, 64 );
563
+ res = ll_SPI_FlashProgramRead (&UNIQUE_BUF[0 ], UNIQUE_ID_START, 64 , true );
557
564
558
565
// check bytes read
559
566
if (UNIQUE_BUF[0 ] != ' O' ) {
@@ -901,12 +908,12 @@ const Frame& VideoCapture::getLastFrame( uint64_t timeout_msec )
901
908
return mLastFrame ;
902
909
}
903
910
904
- int VideoCapture::ll_VendorControl (uint8_t *buf, int len, int readMode, bool safe)
911
+ int VideoCapture::ll_VendorControl (uint8_t *buf, int len, int readMode, bool safe, bool force )
905
912
{
906
913
if (len > 384 )
907
914
return -2 ;
908
915
909
- if (!mInitialized )
916
+ if (!force && ! mInitialized )
910
917
return -3 ;
911
918
912
919
unsigned char tmp[2 ] = {0 };
@@ -1240,7 +1247,7 @@ int VideoCapture::ll_write_sensor_register(int side, int sscb_id, uint64_t addre
1240
1247
return hr;
1241
1248
}
1242
1249
1243
- int VideoCapture::ll_SPI_FlashProgramRead (uint8_t *pBuf, int Adr, int len) {
1250
+ int VideoCapture::ll_SPI_FlashProgramRead (uint8_t *pBuf, int Adr, int len, bool force ) {
1244
1251
1245
1252
int hr = -1 ;
1246
1253
uint8_t xu_buf[384 ];
@@ -1262,7 +1269,7 @@ int VideoCapture::ll_SPI_FlashProgramRead(uint8_t *pBuf, int Adr, int len) {
1262
1269
xu_buf[11 ] = ((len) >> 8 ) & 0xff ;
1263
1270
xu_buf[12 ] = ((len) >> 0 ) & 0xff ;
1264
1271
1265
- hr = ll_VendorControl (xu_buf, len, 1 , true );
1272
+ hr = ll_VendorControl (xu_buf, len, 1 , true , force );
1266
1273
memcpy (pBuf, &xu_buf[17 ], len);
1267
1274
return hr;
1268
1275
}
0 commit comments