GithubHelp home page GithubHelp logo

cec-rs's People

Contributors

coral avatar dependabot[bot] avatar micolous avatar sbergen avatar ssalonen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cec-rs's Issues

Make CI faster

Bug description

CI is super-slow, probably due to

See
https://www.uffizzi.com/blog/optimizing-rust-builds-for-faster-github-actions-pipelines

and

https://github.com/Mozilla-Actions/sccache-action
https://xuanwo.io/en-us/reports/2023-04/ (using sccache-action with rust)
https://news.ycombinator.com/item?id=23191505 (using sccache with cmake generated builds)

To Reproduce

Expected behavior

Screenshots

Environment

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

Cannot build on Pi4

I am trying to build cec-rs on my Raspberry Pi 400.
I have installed:

  • pkg-config
  • libcec-dev
  • libcec6
  • rust and cargo and everything else

When I try cargo build I get "No such file or directory" for #include <cecc.h> in the build/smoke_abi*.c files

cfg.open() fails on macos and linux

I have tried to run the example on macos and linux, and both fail on the cfg.open()

This line of code : (I added the expect())

let connection = cfg.open().expect("Could not open config");

Is this expected to work as-is, or is there any specific hardware I need to be attached to for it to work?

Thanks

Invalid representation of empty CecLogicalAddresses

Currently cec-rs initializes an empty CecLogicalAddresses struct as:

cec_logical_addresses {
            primary: CecLogicalAddress::Unknown as i32,
            addresses: [CecLogicalAddress::Unknown as i32; 16],
        };

However this differs from libcec's representation, which marks an empty list with a primary address of UNREGISTERED:
https://github.com/Pulse-Eight/libcec/blob/76551ea1dd9a55f0ce1533e440dc12dbc594f7ba/include/cectypes.h#L1280-L1285

This seems to force cec-rs to always wake up devices even if CecConnectionCfg#wakeDevices is unset.

libcec >=v5 compatibility

Bug description

See compilation problem against libcec6 ssalonen/cec-alsa-sync#7, and related issue in libcec-sys ssalonen/libcec-sys#10

This wrapper library should probably expose feature flags for different ABI versions

To Reproduce

Expected behavior

Screenshots

Environment

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

private fields and lack of accessors make it impossible to interact with the library

For example CecConnectionCfg uses new type structs for a number of its attributes. Although the structs themselves are public, their fields are private making it impossible to construct them. For example it is impossible to configure wake_devices because the ArrayVec field in CecLogicalAddresses is private, making it impossible to construct an instance of CecLogicalAddresses.

This is also true of trying to construct or extract parameters from CecCommands: the ArrayVec in CecDatapacket is private. Forcing users to convert it to a libcec_sys::cec_command to access the underlying data.

Incorrect interpretation of cec_logical_addresses

It seems like the there is a mismatch of how libcec defines cec_logical_addresses and how CecLogicalAddresses interprets them.

libcec defines cec_logical_addresses as:
struct {
cec_logical_address primary; /< the primary logical address to use */
int addresses[16]; /
< the list of addresses */
}

Unfortunately the comment /**< the list of addresses */ is extremely misleading. It should actually be called a bit map rather than a list where the keys are logical addresses and the values are booleans that indicate if the address is present. This behavior is visible in the implementation for Set():

https://github.com/Pulse-Eight/libcec/blob/76551ea1dd9a55f0ce1533e440dc12dbc594f7ba/include/cectypes.h#L1312-L1318

  void Set(cec_logical_address address)
  {
    if (primary == CECDEVICE_UNREGISTERED)
      primary = address;

    addresses[(int) address] = 1;
  }

On the other hand cec-rs interprets the struct as list of logical addresses (where the primary address lives on its own).

Callbacks should be Send

I'm fairly new to rust, but it seems like callbacks (ie CecConnectionCfg#command_received_callback) should require the closure to be Send. libcec will invoke callbacks from a different thread than the main thread that constructed CecConnectionCfg.

Safety: CecConnection::transmit can crash with full packet size

Bug description

CecConnection::transmit will fail with libcec version x (TODO) when trying to transmit command having data packet of maximum size

The crash occurs in raspberry pi libcec adapter code.

https://github.com/Pulse-Eight/libcec/blob/master/src/libcec/adapter/RPi/RPiCECAdapterMessageQueue.cpp

Possible failure reason (not verified):

cec_adapter_message_state CRPiCECAdapterMessageQueue::Write(const cec_command &command, bool &bRetry, uint32_t iLineTimeout, bool bIsReply, VC_CEC_ERROR_T &vcReply)
<SNIP>

#if defined(RPI_USE_SEND_MESSAGE2)
<SNIP>
#else
<SNIP>
 uint8_t payload[32];
<SNIP>
    for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
      payload[iPtr + 1] = command.parameters.At(iPtr);
  }
<SNIP>


#fi

However, command.parameters can be up to 64 uint8_t cectypes.h --> payload local variable is not large enough!

To Reproduce

TODO

Expected behavior

Screenshots

Environment

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.