Skip to content

Commit 3d8389b

Browse files
committed
Sensor identification on Rockchip
1 parent ab0f2ff commit 3d8389b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/hal/plus/rk_hal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ int rk_channel_unbind(char index)
218218
int rk_pipeline_create(short width, short height)
219219
{
220220
int ret, v4l2dev = rk_sensor_find_v4l2_endpoint();
221-
char endpoint[32];
221+
char endpoint[32], *snrStart, *snrEnd;
222222

223223
if (v4l2dev < 0)
224224
HAL_ERROR("rk_hal", "Failed to find sensor endpoint!\n");
@@ -228,6 +228,9 @@ int rk_pipeline_create(short width, short height)
228228
const char *snrEnt = rk_aiq.fnGetSensorFromV4l2(endpoint);
229229
if (!snrEnt)
230230
HAL_ERROR("rk_aiq", "Failed to get the sensor entity name!\n");
231+
else if ((snrStart = strrchr(snrEnt, '_')) &&
232+
(snrEnd = strchr(snrStart, ' ')) && snrEnd > ++snrStart)
233+
snprintf(sensor, snrEnd - snrStart + 1, "%s", snrStart);
231234

232235
if (ret = rk_aiq.fnPreInitBuf(snrEnt, "rkraw_rx", 2))
233236
HAL_ERROR("rk_aiq", "Failed to pre-initialize buffer!\n");
@@ -419,7 +422,7 @@ int rk_sensor_find_v4l2_endpoint(void)
419422
fgets(line, 32, fp);
420423
fclose(fp);
421424

422-
if (EQUALS(line, "rkisp_mainpath"))
425+
if (CONTAINS(line, "rkisp_mainpath"))
423426
{
424427
index = i;
425428
break;
@@ -807,10 +810,10 @@ void *rk_video_thread(void)
807810
outPack[0].nalu[n + 1].offset -
808811
outPack[0].nalu[n].offset;
809812
}
810-
else outPack[j].nalu[++outPack[j].naluCnt].type = pack->naluType.h264Nalu;
813+
else outPack[j].nalu[outPack[j].naluCnt++].type = pack->naluType.h264Nalu;
811814
break;
812815
case HAL_VIDCODEC_H265:
813-
outPack[j].nalu[++outPack[j].naluCnt].type = pack->naluType.h265Nalu;
816+
outPack[j].nalu[outPack[j].naluCnt++].type = pack->naluType.h265Nalu;
814817
break;
815818
}
816819
outPack[j].offset = 0;

0 commit comments

Comments
 (0)