Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add specification for Fullhan .FLS files #671

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

armijnhemel
Copy link
Collaborator

A fairly simple file format for a Chinese brand of IP cameras. Basically it is a header, with a number of entries, each containing a name, offset and length and then data. I don't know what each field means, so there is also a big chunk of "unknown". The header also contains two names, which I think refer to a model and submodel, or a chip and a board, or something like that. I could not find reliable information about that.

@armijnhemel
Copy link
Collaborator Author

It seems like other (cheap) brands are also using this file format, so I guess that it is not specific to Fullhan. What should we rename it to?

@KOLANICH
Copy link
Contributor

KOLANICH commented May 3, 2023

kaitai-io/kaitai_struct#1031 should be related.

@KOLANICH
Copy link
Contributor

KOLANICH commented May 3, 2023

meta:
  id: fullhan_fls
  title: Fullhan FLS
  license: CC0-1.0
  endian: le
  encoding: UTF-8
doc: |
  Test files:
  - https://www.nvripc.com/new-chinese-ip-camera-firmwares-update/
  - https://www.herospeed.net/hs/ipc_test/fuhan/
seq:
  - id: header
    type: header
  - id: blob
    size: header.len_file - sizeof<header>
    type: body
types:
  header:
    seq:
      - id: model
        size: 8
        type: strz
      - id: submodel
        size: 8
        type: strz
      - id: len_file
        type: u4
      - id: num_entries
        type: u4
  body:
    seq:
      - id: entries
        type: entry
        repeat: expr
        repeat-expr: _root.header.num_entries
      - id: blob_area
        size-eos: true
        type: dummy
    instances:
      lea_blob_area:
        -affected-by: 84
        #value: entries._sizeof
        value: _root.header.num_entries * sizeof<entry>
      lea_lea_blob_area_global:
        value: sizeof<header> + lea_blob_area
    types:
      dummy: {}
      entry:
        seq:
          - id: name
            size: 128
            type: strz
          - id: len_data
            type: u4
          - id: ofs_data
            type: u4
          - id: unknown
            size: 120
        instances:
          offs_base_blob_area:
            -affected-by: 1031
            value: ofs_data - _parent.lea_lea_blob_area_global
          data:
            -affected-by: 1031
            io: _parent.blob_area._io
            pos: offs_base_blob_area
            size: len_data

Comment on lines +8 to +9
doc: |
Test files:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for declaring where to find test files (I'll check them out), but I think /doc should also include some general description of the format. You put the .ksy spec in the firmware directory, which suggests that the format is somehow firmware-related, but anything beyond that is left to the reader to guess. I guess it's a firmware update format of IP cameras of a certain brand Fullhan? At least one or two sentences would go a long way for someone not knowing the purpose of the format or perhaps trying to find a .ksy spec for it via certain keywords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants