前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ubuntu蓝牙耳机切换到头戴式耳机

ubuntu蓝牙耳机切换到头戴式耳机

作者头像
超级大猪
发布2021-03-15 11:08:31
1K0
发布2021-03-15 11:08:31
举报
文章被收录于专栏:大猪的笔记

参考https://askubuntu.com/questions/831331/failed-to-change-profile-to-headset-head-unit 备份

  1. sudo apt install ofono
  2. Goto /etc/pulse/default.pa find the line load-module module-bluetooth-discover and change it in load-module module-bluetooth-discover headset=ofono.
  3. Add the user pulse to group bluetooth to grant the permission: sudo usermod -aG bluetooth pulse (probably it's already correct)
  4. VERY IMPORTANT: To grant the permission, add this to /etc/dbus-1/system.d/ofono.conf (before ): <policy user="pulse"> <allow send_destination="org.ofono"/> </policy>
  5. Provide phonesim to ofono. In order to make ofono work, you have to provide a modem to it! You can install a modem emulator called phonesim (implemented by ofono) to make it work:
  6. install ofono-phonesim (in some distros it is called phonesim). in Ubuntu 18.04 (for Ubuntu 20.04 follow this link): sudo apt install ofono-phonesim sudo add-apt-repository ppa:smoser/bluetooth sudo apt-get update sudo apt-get install ofono-phonesim
  7. Configure phonesim by adding the following lines to /etc/ofono/phonesim.conf: [phonesim] Driver=phonesim Address=127.0.0.1 Port=12345
  8. Restart ofono:sudo systemctl restart ofono.service
  9. Start phonesim:ofono-phonesim -p 12345 /usr/share/phonesim/default.xml
  10. To make sure phonesim is started correctly you can clone the ofono repo and use their test scripts:cd /tmp git clone git://git.kernel.org/pub/scm/network/ofono/ofono.git cd ofono/test ./enable-modem ./online-modem ./list-modems

20.04自动启动

/etc/systemd/system/ofono-phonesim.service

代码语言:javascript
复制
[Unit]

Description=Run ofono-phonesim in the background



[Service]

ExecStart=ofono-phonesim -p 12345 /usr/share/phonesim/default.xml

Type=simple

RemainAfterExit=yes



[Install]

WantedBy=multi-user.target

/etc/systemd/system/phonesim-enable-modem.service:

代码语言:javascript
复制
[Unit]
Description=Enable and online phonesim modem
Requires=ofono-phonesim.service
[Service]
ExecStart=/<path-to-cloned-ofono-git-repo>/test/enable-modem /phonesim
ExecStart=/<path-to-cloned-ofono-git-repo>/test/online-modem /phonesim
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then run the following commands to run both daemons:

代码语言:javascript
复制
sudo systemctl daemon-reload

sudo systemctl enable ofono-phonesim.service

sudo systemctl enable phonesim-enable-modem.service

sudo service phonesim-enable-modem start

Check if the service is running with

代码语言:javascript
复制
sudo service phonesim-enable-modem status
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-03-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 20.04自动启动
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档