diff --git a/.gitignore b/.gitignore index bee8a64..82adb58 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +venv diff --git a/pyproject.toml b/pyproject.toml index c3f5375..09f29e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ ignore = ['E741', 'E501'] # TODO: fix E501 [tool.ruff.lint.flake8-quotes] inline-quotes = 'single' +multiline-quotes = 'single' [tool.ruff.format] quote-style = 'single' diff --git a/utils/cam-configs/am62.py b/utils/cam-configs/am62.py index 861bc4b..497caaa 100644 --- a/utils/cam-configs/am62.py +++ b/utils/cam-configs/am62.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 @@ -60,7 +58,6 @@ { 'entity': 'j721e-csi2rx', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], @@ -100,7 +97,6 @@ 'entity': 'rp1-cfe-csi2-ch1', 'fmt': meta_fmt_pix_imx219, 'embedded': True, - 'display': True, }, ], @@ -153,7 +149,6 @@ { 'entity': '30102000.ticsi2rx context 0', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], diff --git a/utils/cam-configs/am62a-fpd.py b/utils/cam-configs/am62a-fpd.py index 589aaa2..7e0a3bf 100644 --- a/utils/cam-configs/am62a-fpd.py +++ b/utils/cam-configs/am62a-fpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 @@ -95,7 +93,6 @@ def gen_imx219_pixel(port): { 'entity': f'{dma_ent} {port}', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], @@ -238,8 +235,6 @@ def gen_ub953_tpg(port): { 'entity': f'{dma_ent} {port}', 'fmt': fmt_tpg, - 'embedded': False, - 'dra-plane-hack': False, }, ], diff --git a/utils/cam-configs/debix-tpg.py b/utils/cam-configs/debix-tpg.py index 851d471..20fa54e 100644 --- a/utils/cam-configs/debix-tpg.py +++ b/utils/cam-configs/debix-tpg.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 configurations = {} @@ -64,8 +62,6 @@ { 'entity': 'rkisp1_mainpath', 'fmt': vfmt, - 'embedded': False, - 'dra-plane-hack': False, }, ], diff --git a/utils/cam-configs/debix.py b/utils/cam-configs/debix.py index a4625c1..80cc712 100644 --- a/utils/cam-configs/debix.py +++ b/utils/cam-configs/debix.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 sensor_fmt = (2592, 1940, v4l2.BusFormat.SRGGB12_1X12) @@ -59,8 +57,6 @@ { 'entity': 'rkisp1_mainpath', 'fmt': vid_fmt, - 'embedded': False, - 'dra-plane-hack': False, }, ], diff --git a/utils/cam-configs/desky.py b/utils/cam-configs/desky.py index 25994d6..fc315f6 100644 --- a/utils/cam-configs/desky.py +++ b/utils/cam-configs/desky.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 sensor_1_w = 1280 diff --git a/utils/cam-configs/dra76-fpd.py b/utils/cam-configs/dra76-fpd.py index c94737d..949f96a 100644 --- a/utils/cam-configs/dra76-fpd.py +++ b/utils/cam-configs/dra76-fpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 ov10635_w = 1280 @@ -111,8 +109,6 @@ def gen_imx390_pixel(port): { 'entity': f'CAL output {port}', 'fmt': fmt_pix_imx390, - 'embedded': False, - 'dra-plane-hack': False, }, ], @@ -252,8 +248,6 @@ def gen_imx219_pixel(port): { 'entity': f'CAL output {port}', 'fmt': fmt_pix_imx219, - 'embedded': False, - 'dra-plane-hack': False, }, ], @@ -393,7 +387,6 @@ def gen_ov10635_pixel(port): { 'entity': f'CAL output {port}', 'fmt': fmt_pix_ov10635, - 'embedded': False, }, ], @@ -517,8 +510,6 @@ def gen_ub953_tpg(port): { 'entity': f'CAL output {port}', 'fmt': fmt_tpg, - 'embedded': False, - 'dra-plane-hack': False, }, ], diff --git a/utils/cam-configs/dra76-ov5640.py b/utils/cam-configs/dra76-ov5640.py index bed74a3..c58a322 100644 --- a/utils/cam-configs/dra76-ov5640.py +++ b/utils/cam-configs/dra76-ov5640.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 sensor_1_w = 1280 diff --git a/utils/cam-configs/j7-ov5640.py b/utils/cam-configs/j7-ov5640.py index b5a2fe0..e8f0068 100644 --- a/utils/cam-configs/j7-ov5640.py +++ b/utils/cam-configs/j7-ov5640.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 sensor_1_w = 1280 diff --git a/utils/cam-configs/lappy.py b/utils/cam-configs/lappy.py index 296ae9d..1df22cf 100644 --- a/utils/cam-configs/lappy.py +++ b/utils/cam-configs/lappy.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 sensor_1_w = 1280 diff --git a/utils/cam-configs/loopback.py b/utils/cam-configs/loopback.py index 60048f1..55b3ada 100644 --- a/utils/cam-configs/loopback.py +++ b/utils/cam-configs/loopback.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 diff --git a/utils/cam-configs/rpi4.py b/utils/cam-configs/rpi4.py index 676574e..24853a0 100644 --- a/utils/cam-configs/rpi4.py +++ b/utils/cam-configs/rpi4.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 1920 @@ -57,8 +55,6 @@ { 'entity': 'unicam-image', 'fmt': fmt_pix_imx219, - 'embedded': False, - 'dra-plane-hack': False, }, ], diff --git a/utils/cam-configs/rpi5-fpd.py b/utils/cam-configs/rpi5-fpd.py index e413958..1728720 100644 --- a/utils/cam-configs/rpi5-fpd.py +++ b/utils/cam-configs/rpi5-fpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 # Pixel @@ -94,7 +92,6 @@ def gen_imx219_pixel(port): { 'entity': f'rp1-cfe-csi2-ch{port}', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], @@ -227,7 +224,6 @@ def gen_ub953_tpg(port): { 'entity': f'rp1-cfe-csi2-ch{port}', 'fmt': fmt_tpg, - 'embedded': False, }, ], diff --git a/utils/cam-configs/rpi5-gmsl.py b/utils/cam-configs/rpi5-gmsl.py index 3ee9cbe..097a258 100644 --- a/utils/cam-configs/rpi5-gmsl.py +++ b/utils/cam-configs/rpi5-gmsl.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 import v4l2.uapi @@ -33,8 +31,6 @@ mbus_fmt_imx219_meta = (imx219_w, 2, imx219_bus_fmt_meta) fmt_pix_imx219_meta = (imx219_w, 2, imx219_pix_fmt_meta) -configurations = {} - def gen_imx219_pixel(cameras, port): sensor_ent = cameras[port][1] ser_ent = cameras[port][0] @@ -99,8 +95,6 @@ def gen_imx219_pixel(cameras, port): { 'entity': f'rp1-cfe-csi2-ch{port}', 'fmt': fmt_pix, - 'embedded': False, - 'display': True, 'kms-format': v4l2.PixelFormats.RGB565, }, ], @@ -215,6 +209,7 @@ def get_configs(): num_cameras = len(cameras) + configurations = {} for i in range(num_cameras): configurations[f'cam{i}'] = gen_imx219_pixel(cameras, i) configurations[f'cam{i}-meta'] = gen_imx219_meta(cameras, i) diff --git a/utils/cam-configs/rpi5.py b/utils/cam-configs/rpi5.py index 6bc8e30..0f47b66 100644 --- a/utils/cam-configs/rpi5.py +++ b/utils/cam-configs/rpi5.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 @@ -63,7 +61,6 @@ { 'entity': 'rp1-cfe-csi2-ch0', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], @@ -103,7 +100,6 @@ 'entity': 'rp1-cfe-csi2-ch1', 'fmt': meta_fmt_pix_imx219, 'embedded': True, - 'display': True, }, ], @@ -139,7 +135,6 @@ { 'entity': 'rp1-cfe-csi2-ch0', 'fmt': fmt_pix_imx219, - 'embedded': False, }, ], diff --git a/utils/cam-configs/vimc.py b/utils/cam-configs/vimc.py index 22e3157..a3183d7 100644 --- a/utils/cam-configs/vimc.py +++ b/utils/cam-configs/vimc.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 diff --git a/utils/cam-configs/vivid.py b/utils/cam-configs/vivid.py index 4b3eadd..1d95c52 100644 --- a/utils/cam-configs/vivid.py +++ b/utils/cam-configs/vivid.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 diff --git a/utils/cam-configs/xilinx-tpg.py b/utils/cam-configs/xilinx-tpg.py index 494574e..42834a8 100644 --- a/utils/cam-configs/xilinx-tpg.py +++ b/utils/cam-configs/xilinx-tpg.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - import v4l2 imx219_w = 640 diff --git a/utils/cam.py b/utils/cam.py index 33df14a..c0029eb 100755 --- a/utils/cam.py +++ b/utils/cam.py @@ -104,19 +104,18 @@ def parse_args(ctx: Context): ctx.tx = None ctx.net_tx = None - if args.type and args.type not in ['drm', 'v4l2']: + if not args.type: + if args.display: + args.type = 'drm' + else: + args.type = 'v4l2' + + if args.type not in ['drm', 'v4l2']: print('Bad buffer type', args.type) sys.exit(-1) ctx.use_display = args.display - - if args.type: - ctx.buf_type = args.type - else: - if args.display: - ctx.buf_type = 'drm' - else: - ctx.buf_type = 'v4l2' + ctx.buf_type = args.type ctx.config = read_config(args.config_name, args.params) diff --git a/utils/cam_helpers.py b/utils/cam_helpers.py index 31f1a18..6f2457d 100644 --- a/utils/cam_helpers.py +++ b/utils/cam_helpers.py @@ -53,7 +53,6 @@ def enable_link(source, sink): if link.is_immutable: return - link.enabled = True #src_ent.setup_link(link) link.enable() @@ -87,6 +86,8 @@ def merge_configs(configs): if 'pads' in subdev: dst['pads'] += subdev['pads'] if 'routing' in subdev: + if 'routing' not in dst: + dst['routing'] = [] dst['routing'] += subdev['routing'] else: d['subdevs'].append(subdev) @@ -167,7 +168,6 @@ def configure_subdevs(ctx: Context, config): ent = md.find_entity(e['entity']) assert ent subdev = v4l2.SubDevice(ent.interface.dev_path) - assert subdev, f'no subdev for entity {ent}' if ctx.verbose: print(f'Configuring {ent.name}')