LibCecSharp 8.1.6

dotnet add package LibCecSharp --version 8.1.6
                    
NuGet\Install-Package LibCecSharp -Version 8.1.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibCecSharp" Version="8.1.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LibCecSharp" Version="8.1.6" />
                    
Directory.Packages.props
<PackageReference Include="LibCecSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LibCecSharp --version 8.1.6
                    
#r "nuget: LibCecSharp, 8.1.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LibCecSharp@8.1.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LibCecSharp&version=8.1.6
                    
Install as a Cake Addin
#tool nuget:?package=LibCecSharp&version=8.1.6
                    
Install as a Cake Tool

LibCecSharp

The managed binding for libCEC: control CEC-capable HDMI devices — power a TV on or to standby, become the active source, send remote keys, read device state — and receive bus events.

LibCecSharp (namespace CecSharp) is a pure C# assembly that binds the native library through its C API (P/Invoke over cecc.h), targeting net8.0. It runs anywhere the native library does: Windows, Linux, macOS and Raspberry Pi.

Requirements

  • A Pulse-Eight USB-CEC adapter, or a supported SoC-native CEC backend.
  • The native libCEC library on the loader path at runtime — cec.dll on Windows, libcec.so on Linux, libcec.dylib on macOS. This package is managed IL only; it does not carry the native library.

Install the native library with the Windows USB-CEC Adapter software, with apt-get install libcec8 on Debian/Ubuntu, or build it from source.

Usage

Derive from CecCallbackMethods to receive events, describe yourself in a LibCECConfiguration, then construct LibCecSharp.

using CecSharp;

class CecClient : CecCallbackMethods
{
    public override int ReceiveLogMessage(CecLogMessage message)
    {
        Console.WriteLine($"log: {message.Message}");
        return 1;
    }
}

var config = new LibCECConfiguration();
config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
config.DeviceName = "example";
config.ClientVersion = LibCECConfiguration.CurrentVersion;

using var lib = new LibCecSharp(new CecClient(), config);

// a null port opens the first adapter that opens, skipping any that another
// process is using
if (lib.Open(null, 10000))
{
    lib.PowerOnDevices(CecLogicalAddress.Tv);
    lib.Close();
}

Full API reference: https://pulse-eight.github.io/libcec/dotnet/

Licence

GPL-2.0-or-later, or a commercial licence from Pulse-Eight — the same dual licence as libCEC itself.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.6 35 8/7/2026