usb dongle android,在Android應用中使用libCEC + USB加密狗

My goal is to send HDMI CEC commands from a standard (i.e non-system) app running on an Android box equipped with Pulse-Eight's USB dongle.

我的目標是從配備Pulse-Eight USB加密狗的Android機箱上運行的標准(即非系統)應用程序發送HDMI CEC命令。

Following these instructions I successfully managed to compile libcec for Android and execute it as root on the box, with this command:

按照這些說明,我成功地設法為Android編譯libcec並在框中以root身份執行它,使用以下命令:

echo | cec-client -s /dev/ttyACM0

where /dev/ttyACM0 is the device file created by the system when plugging the dongle.

其中/ dev / ttyACM0是系統在插入加密狗時創建的設備文件。

However the permissions of this file prevent the command to be executed by a non-root user (therefore it cannot be executed from my Android app).

但是,此文件的權限會阻止該命令由非root用戶執行(因此無法從我的Android應用程序執行)。

On the other hand the app can actually access the USB dongle via the USB Host API of the Android SDK (provided the user grants the permission) and can even be wrapped into a USB serial controller with UsbSerial library.

另一方面,應用程序實際上可以通過Android SDK的USB Host API訪問USB加密狗(前提是用戶授予權限),甚至可以用UsbSerial庫封裝到USB串行控制器中。

But I don't see any way to make the bridge between the connection provided by Android's USB Host API and libcec/cec-client. Do you have any idea or suggestion?

但我沒有看到任何方法在Android的USB Host API和libcec / cec-client提供的連接之間架起橋梁。你有什么想法或建議嗎?

1 个解决方案

#1

0

The best solution that I have found so far is to use USB Host API + UsbSerial library to read/write CEC packets on the adapter's serial port with pure Java code (no embedded libCEC).

到目前為止,我發現的最佳解決方案是使用USB Host API + UsbSerial庫在適配器的串行端口上使用純Java代碼(無嵌入式libCEC)讀/寫CEC數據包。

I did some retro-engineering on libCEC to find out the appropriate commands for basic operations like switching TV on & off and setting active source.

我在libCEC上做了一些逆向工程,找出適合基本操作的命令,如開關電視和設置活動源。

And I finally came up with the following UsbCecConnection java class: https://gist.github.com/sdabet/ac4d7711d1a529806cb7b695530b1fac

我終於提出了以下UsbCecConnection java類:https://gist.github.com/sdabet/ac4d7711d1a529806cb7b695530b1fac

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值