『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: XCray

[基础教程] 【M401A】CoreELEC初步小试,毫无难度的安装和xue微折腾的蓝牙

[复制链接]

10

主题

60

帖子

530

积分

高级会员

Rank: 4

积分
530
金钱
470
HASS币
0
发表于 2022-10-3 17:43:46 | 显示全部楼层
M401A刷好hassio_supervisor后没有加入/run/dbus:/run/dbus:ro,后续怎么添加蓝牙进去?
回复

使用道具 举报

2

主题

199

帖子

3541

积分

论坛元老

Rank: 8Rank: 8

积分
3541
金钱
3342
HASS币
0
发表于 2022-10-7 23:42:06 | 显示全部楼层
XCray 发表于 2022-9-10 16:56
你就参考armbian里的方法试试吧,原理一样,操作gpio。

我对coreelec不熟,最近也没办法测试。

通过安装插件,coreelec可以使用gpioset了,但发现了新问题。在armbian和coreelec里芯片组是反着的。并且GPIO数量差了一个。在coreelec无法操作82 GPIO。麻烦X大再给指点一下
这是armbian里的GPIO 信息
root@armbian:~# gpiodetect
gpiochip0 [periphs-banks] (85 lines)
gpiochip1 [aobus-banks] (15 lines)
root@armbian:~# gpioinfo 0
gpiochip0 - 85 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed "regulator-usb_pwr_en" output active-high [used]
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed "regulator-vcc_5v" output active-high [used open-                                 drain]
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed      "reset"  output   active-low [used]
        line  38:      unnamed       unused   input  active-high
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed       unused   input  active-high
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
        line  44:      unnamed       unused   input  active-high
        line  45:      unnamed       unused   input  active-high
        line  46:      unnamed       unused   input  active-high
        line  47:      unnamed         "cd"   input   active-low [used]
        line  48:      unnamed       unused   input  active-high
        line  49:      unnamed       unused   input  active-high
        line  50:      unnamed       unused   input  active-high
        line  51:      unnamed       unused   input  active-high
        line  52:      unnamed       unused   input  active-high
        line  53:      unnamed       unused   input  active-high
        line  54:      unnamed       unused   input  active-high
        line  55:      unnamed       unused   input  active-high
        line  56:      unnamed       unused   input  active-high
        line  57:      unnamed       unused   input  active-high
        line  58:      unnamed       unused   input  active-high
        line  59:      unnamed       unused   input  active-high
        line  60:      unnamed       unused   input  active-high
        line  61:      unnamed       unused   input  active-high
        line  62:      unnamed       unused   input  active-high
        line  63:      unnamed       unused   input  active-high
        line  64:      unnamed       unused   input  active-high
        line  65:      unnamed       unused   input  active-high
        line  66:      unnamed       unused   input  active-high
        line  67:      unnamed       unused   input  active-high
        line  68:      unnamed       unused   input  active-high
        line  69:      unnamed       unused   input  active-high
        line  70:      unnamed       unused   input  active-high
        line  71:      unnamed       unused   input  active-high
        line  72:      unnamed       unused   input  active-high
        line  73:      unnamed       unused   input  active-high
        line  74:      unnamed       unused   input  active-high
        line  75:      unnamed       unused   input  active-high
        line  76:      unnamed       unused   input  active-high
        line  77:      unnamed       unused   input  active-high
        line  78:      unnamed       unused   input  active-high
        line  79:      unnamed       unused   input  active-high
        line  80:      unnamed       unused   input  active-high
        line  81:      unnamed       unused   input  active-high
        line  82:      unnamed       unused  output  active-high
        line  83:      unnamed       unused   input  active-high
        line  84:      unnamed       unused   input  active-high
root@armbian:~# gpioinfo 1
gpiochip1 - 15 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed    "net_led"  output   active-low [used]
        line  10:      unnamed "remote_led"  output   active-low [used]
        line  11:      unnamed  "power_led"  output   active-low [used]
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
root@armbian:~# gpioset 0 82=0
root@armbian:~# gpioset 0 82=1


下面是CoreELEC里的GPIO信息
CoreELEC:~ # gpioinfo
gpiochip0 - 16 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed "avout_mute"  output  active-high [used]
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed          "?"  output   active-low [used]
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
gpiochip1 - 86 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused  output  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed       unused   input  active-high
        line  38:      unnamed      "amlsd"  output  active-high [used]
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed       unused   input  active-high
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
        line  44:      unnamed       unused   input  active-high
        line  45:      unnamed       unused   input  active-high
        line  46:      unnamed       unused   input  active-high
        line  47:      unnamed       unused   input  active-high
        line  48:      unnamed      "amlsd"   input  active-high [used]
        line  49:      unnamed       unused   input  active-high
        line  50:      unnamed       unused   input  active-high
        line  51:      unnamed       unused   input  active-high
        line  52:      unnamed       unused   input  active-high
        line  53:      unnamed       unused   input  active-high
        line  54:      unnamed       unused   input  active-high
        line  55:      unnamed       unused   input  active-high
        line  56:      unnamed       unused   input  active-high
        line  57:      unnamed       unused   input  active-high
        line  58:      unnamed       unused   input  active-high
        line  59:      unnamed       unused   input  active-high
        line  60:      unnamed       unused   input  active-high
        line  61:      unnamed       unused   input  active-high
        line  62:      unnamed       unused   input  active-high
        line  63:      unnamed       unused   input  active-high
        line  64:      unnamed       unused   input  active-high
        line  65:      unnamed       unused   input  active-high
        line  66:      unnamed       unused   input  active-high
        line  67:      unnamed       unused   input  active-high
        line  68:      unnamed       unused   input  active-high
        line  69:      unnamed       unused   input  active-high
        line  70:      unnamed       unused   input  active-high
        line  71:      unnamed       unused   input  active-high
        line  72:      unnamed  "sdio_wifi"  output  active-high [used]
        line  73:      unnamed  "sdio_wifi"   input  active-high [used]
        line  74:      unnamed       unused   input  active-high
        line  75:      unnamed       unused   input  active-high
        line  76:      unnamed       unused   input  active-high
        line  77:      unnamed       unused   input  active-high
        line  78:      unnamed       unused   input  active-high
        line  79:      unnamed       unused   input  active-high
        line  80:      unnamed       unused   input  active-high
        line  81:      unnamed       unused   input  active-high
        line  82:      unnamed       unused   input  active-high
        line  83:      unnamed  "bt_rfkill"   input  active-high [used]
        line  84:      unnamed       unused   input  active-high
        line  85:      unnamed  "bt_rfkill"  output  active-high [used]
CoreELEC:~ # gpiodetect
gpiochip0 [aobus-banks] (16 lines)
gpiochip1 [periphs-banks] (86 lines)
CoreELEC:~ # gpioset -s 1 -m time 0 82=0
gpioset: error setting the GPIO line values: Invalid argument
CoreELEC:~ # gpioset 0 82=0
gpioset: error setting the GPIO line values: Invalid argument
CoreELEC:~ # gpioget gpiochip1 0
gpioget: error reading GPIO values: Invalid argument
CoreELEC:~ # gpioget gpiochip0 0
1
CoreELEC:~ # gpioget gpiochip1 82
gpioget: error reading GPIO values: Invalid argument
CoreELEC:~ # gpioget gpiochip1 83
gpioget: error reading GPIO values: Device or resource busy
CoreELEC:~ # gpioget gpiochip0 82
gpioget: error reading GPIO values: Invalid argument
CoreELEC:~ # gpioset gpiochip0 0 0
gpioset: invalid offset<->value mapping: 0
CoreELEC:~ # gpioset gpiochip0 0 1
gpioset: invalid offset<->value mapping: 0
CoreELEC:~ # gpioinfo 0
gpiochip0 - 16 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed "avout_mute"  output  active-high [used]
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed          "?"  output   active-low [used]
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
CoreELEC:~ # gpioinfo 1
gpiochip1 - 86 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused  output  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed       unused   input  active-high
        line  38:      unnamed      "amlsd"  output  active-high [used]
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed       unused   input  active-high
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
        line  44:      unnamed       unused   input  active-high
        line  45:      unnamed       unused   input  active-high
        line  46:      unnamed       unused   input  active-high
        line  47:      unnamed       unused   input  active-high
        line  48:      unnamed      "amlsd"   input  active-high [used]
        line  49:      unnamed       unused   input  active-high
        line  50:      unnamed       unused   input  active-high
        line  51:      unnamed       unused   input  active-high
        line  52:      unnamed       unused   input  active-high
        line  53:      unnamed       unused   input  active-high
        line  54:      unnamed       unused   input  active-high
        line  55:      unnamed       unused   input  active-high
        line  56:      unnamed       unused   input  active-high
        line  57:      unnamed       unused   input  active-high
        line  58:      unnamed       unused   input  active-high
        line  59:      unnamed       unused   input  active-high
        line  60:      unnamed       unused   input  active-high
        line  61:      unnamed       unused   input  active-high
        line  62:      unnamed       unused   input  active-high
        line  63:      unnamed       unused   input  active-high
        line  64:      unnamed       unused   input  active-high
        line  65:      unnamed       unused   input  active-high
        line  66:      unnamed       unused   input  active-high
        line  67:      unnamed       unused   input  active-high
        line  68:      unnamed       unused   input  active-high
        line  69:      unnamed       unused   input  active-high
        line  70:      unnamed       unused   input  active-high
        line  71:      unnamed       unused   input  active-high
        line  72:      unnamed  "sdio_wifi"  output  active-high [used]
        line  73:      unnamed  "sdio_wifi"   input  active-high [used]
        line  74:      unnamed       unused   input  active-high
        line  75:      unnamed       unused   input  active-high
        line  76:      unnamed       unused   input  active-high
        line  77:      unnamed       unused   input  active-high
        line  78:      unnamed       unused   input  active-high
        line  79:      unnamed       unused   input  active-high
        line  80:      unnamed       unused   input  active-high
        line  81:      unnamed       unused   input  active-high
        line  82:      unnamed       unused   input  active-high
        line  83:      unnamed  "bt_rfkill"   input  active-high [used]
        line  84:      unnamed       unused   input  active-high
        line  85:      unnamed  "bt_rfkill"  output  active-high [used]
CoreELEC:~ # gpiodetect
gpiochip0 [aobus-banks] (16 lines)
gpiochip1 [periphs-banks] (86 lines)


麻烦X大再给看一下,感觉离成功应该不远了。
回复

使用道具 举报

0

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
金钱
27
HASS币
0
发表于 2022-10-12 01:02:55 | 显示全部楼层
EmuELEC 是基于 CoreELEC 弄出来的,想知道到是不是可以直接抄作业?但是我打开根目录只看到kernel.img和dtb.img两个img,另外还有几个文件夹, lib/firmware/rtl_bt 这个目录在哪里呢?
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-10-12 07:08:22 | 显示全部楼层
yingzaiha 发表于 2022-10-7 23:42
通过安装插件,coreelec可以使用gpioset了,但发现了新问题。在armbian和coreelec里芯片组是反着的。并且 ...

我感觉得重新编译dtb。

按说如果程序员们工作到位的话,在dtb里定义好gpio,rfkill就可以搞定硬件复位了。

现在的情况是dtb里定义了gpio但rfkill并没有正确发挥作用,同时那个gpio由于在dtb里定义了系统就不允许再用gpioget/gpioset访问了。
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-10-12 07:13:03 | 显示全部楼层
tofuliang 发表于 2022-10-12 01:02
EmuELEC 是基于 CoreELEC 弄出来的,想知道到是不是可以直接抄作业?但是我打开根目录只看到kernel.img和dt ...

你和“根目录”有着很深的误会
回复

使用道具 举报

0

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
金钱
27
HASS币
0
发表于 2022-10-12 17:05:04 来自手机 | 显示全部楼层
XCray 发表于 2022-10-12 07:13
你和“根目录”有着很深的误会

我猜误会的来源是,网上的是emuelec都是通过外接U盘启动的,我说的是U盘根目录,我还看到有个SYSTEM文件有1G+,这里面才是真正系系统吧?这种情况是不是要重新编译
SYSTEM文件才可以呢?
回复

使用道具 举报

0

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
金钱
27
HASS币
0
发表于 2022-10-13 00:22:25 | 显示全部楼层
tofuliang 发表于 2022-10-12 17:05
我猜误会的来源是,网上的是emuelec都是通过外接U盘启动的,我说的是U盘根目录,我还看到有个SYSTEM文件 ...

原来U盘系统里的根目录是可写的,参照一楼命令,编辑/storage/.config/custom_start.sh这个文件就搞定了自动连接了
(
ln -s /lib/firmware/rtl_bt/rtl8761b_fw.bin /lib/firmware/rtlbt/rtl8761b_fw
ln -s /lib/firmware/rtl_bt/rtl8761b_config.bin /lib/firmware/rtlbt/rtl8761b_config
rtk_hciattach -n -s 115200 ttyS1 rtk_h5
)&

(
echo "agent on" | bluetoothctl
echo "default-agent" | bluetoothctl
echo "power on" | bluetoothctl
echo "discoverable on" | bluetoothctl
echo "pairable on" | bluetoothctl
echo "scan on" | bluetoothctl
for MAC in 手柄MAC1 手柄MAC2;do
    (
        while [ true ];do
            if [ $(echo "paired-devices"|bluetoothctl |grep $MAC|wc -l) -lt 1 ];then
                echo "trust $MAC" |bluetoothctl
                echo "connect $MAC" |bluetoothctl
                sleep 3
            else
                sleep 15
            fi
        done
    )&
done
)&
回复

使用道具 举报

0

主题

5

帖子

42

积分

新手上路

Rank: 1

积分
42
金钱
37
HASS币
0
发表于 2022-10-16 10:37:25 | 显示全部楼层
yingzaiha 发表于 2022-10-7 23:42
通过安装插件,coreelec可以使用gpioset了,但发现了新问题。在armbian和coreelec里芯片组是反着的。并且 ...

最近我买了一个CM311也在弄蓝牙,参考了这个帖子也遇到了同样的问题。我看了一下coreelec里的gpio数量多了1个,复位蓝牙在armbian操作82脚,到coreelec里是操作83脚,但是83被占用了,可以把coreelec的dtb里占用83脚的那个bt-dev段删除了就可以操作83脚了。

更简单的方法直接用原来的dtb文件,使用命令
rfkill list|grep bt-dev|cut -c1|xargs rfkill unblock
或者直接
rfkill unblock 0
都可以重启蓝牙。rfkill命令操作的就是83管脚,看dtb文件里面也是定义的这个管脚蓝牙复位。
回复

使用道具 举报

0

主题

71

帖子

1399

积分

金牌会员

Rank: 6Rank: 6

积分
1399
金钱
1328
HASS币
0
发表于 2022-10-17 13:07:06 | 显示全部楼层
X大,按照你的方法成功用上了蓝牙遥控器,感谢!如果CoreELEC下想实现蓝牙音频,是不是修改rtk_hciattach -n -s 115200 ttyS1 rtk_h5中的115200为2m就行了呢?
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-10-17 16:15:26 | 显示全部楼层
wwjw 发表于 2022-10-17 13:07
X大,按照你的方法成功用上了蓝牙遥控器,感谢!如果CoreELEC下想实现蓝牙音频,是不是修改rtk_hciattach - ...

不是。

你再看看另一个帖子,需要另一个config文件。这条命令里的速率只是初始化用的,不能改。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 12:34 , Processed in 0.265900 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表