## 全志V3S上通过蓝牙播放音乐
`我使用的是RTL8723DS模块,引脚与BS是兼容的,内核使用的是5.10, Bluez使用的是5.55 终端是UART0,蓝牙串口使用的是UART2,板子是参照licheepi 自己画的`
[参考链接](https://gitee.com/yocop/drv_bt_rtl8723ds)
[BT参考链接](https://github.com/Poco-Ye/rtl8723DS-BT-uart-driver)
[WIFI参考链接](https://github.com/lwfinger/rtl8723ds)
1. 首先在buildroot里勾选上bluez5-utils,bluez-tools及blue-alsa
2. 在内核里勾选
[*]UART(H4) protocol support
[/*]Realtek Three-wireUART(H5) protocol support
系统启动时会显示如下信息:
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.10.19 (xfdr@virtualbox) (arm-linux-gnueabihf-gcc (Linaro GCC 7.5-2019.12) 7.5.0, GNU ld (Linaro_Binutils-2019.12) 2.28.2.20170706) #13 SMP Fri Jul 23 12:00:59 CST 2021
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Zero with Dock
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 16 MiB at 0x41c00000
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000040000000-0x0000000043ffffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x0000000043ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff]
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: Using PSCI v0.1 Function IDs from DT
[ 0.000000] percpu: Embedded 15 pages/cpu s31052 r8192 d22196 u61440
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 console=ttyS0 rootwait vt.global_cursor_default=0 root=/dev/mmcblk0p2 earlyprintk rw
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 34900K/65536K available (8192K kernel code, 918K rwdata, 2244K rodata, 1024K init, 284K bss, 14252K reserved, 16384K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] GIC: Using split EOI/Deactivate mode
[ 0.000000] random: get_random_bytes called from start_kernel+0x328/0x4c0 with crng_init=0
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000008] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.000022] Switching to timer-based delay loop, resolution 41ns
[ 0.000278] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000593] Console: colour dummy device 80x30
[ 0.000661] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[ 0.000684] pid_max: default: 32768 minimum: 301
[ 0.000852] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.000873] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001748] CPU: Testing write buffer coherency: ok
[ 0.002186] /cpus/cpu@0 missing clock-frequency property
[ 0.002218] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.002989] Setting up static identity map for 0x40100000 - 0x40100060
[ 0.003218] rcu: Hierarchical SRCU implementation.
[ 0.003764] smp: Bringing up secondary CPUs ...
[ 0.003792] smp: Brought up 1 node, 1 CPU
[ 0.003802] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[ 0.003811] CPU: All CPU(s) started in HYP mode.
[ 0.003818] CPU: Virtualization extensions available.
[ 0.004452] devtmpfs: initialized
[ 0.008373] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.008733] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.008771] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.009561] pinctrl core: initialized pinctrl subsystem
[ 0.011091] NET: Registered protocol family 16
[ 0.012326] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.013612] thermal_sys: Registered thermal governor 'step_wise'
[ 0.014006] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.014032] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.036802] SCSI subsystem initialized
[ 0.037553] usbcore: registered new interface driver usbfs
[ 0.037622] usbcore: registered new interface driver hub
[ 0.037689] usbcore: registered new device driver usb
[ 0.037967] mc: Linux media interface: v0.10
[ 0.038015] videodev: Linux video capture interface: v2.00
[ 0.038161] pps_core: LinuxPPS API ver. 1 registered
[ 0.038174] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.038198] PTP clock support registered
[ 0.038880] Advanced Linux Sound Architecture Driver Initialized.
[ 0.039575] Bluetooth: Core ver 2.22
[ 0.039667] NET: Registered protocol family 31
[ 0.039679] Bluetooth: HCI device and connection manager initialized
[ 0.039703] Bluetooth: HCI socket layer initialized
[ 0.039717] Bluetooth: L2CAP socket layer initialized
[ 0.039750] Bluetooth: SCO socket layer initialized
[ 0.040956] clocksource: Switched to clocksource arch_sys_counter
[ 0.052288] NET: Registered protocol family 2
[ 0.053034] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.053084] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.053112] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.053136] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.053298] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.053357] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.053602] NET: Registered protocol family 1
[ 0.054648] RPC: Registered named UNIX socket transport module.
[ 0.054681] RPC: Registered udp transport module.
[ 0.054690] RPC: Registered tcp transport module.
[ 0.054698] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.056301] Initialise system trusted keyrings
[ 0.056732] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.063874] NFS: Registering the id_resolver key type
[ 0.063951] Key type id_resolver registered
[ 0.063960] Key type id_legacy registered
[ 0.064015] ntfs: driver 2.1.32 [Flags: R/W].
[ 0.163771] Key type asymmetric registered
[ 0.163804] Asymmetric key parser 'x509' registered
[ 0.163906] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[ 0.163922] io scheduler mq-deadline registered
[ 0.163931] io scheduler kyber registered
[ 0.168836] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.169687] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pb not found, using dummy regulator
[ 0.170628] pwm-backlight backlight: supply power not found, using dummy regulator
[ 0.171287] pwm-backlight backlight: invalid default brightness level: 100, using 6
[ 0.239906] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.244637] printk: console [ttyS0] disabled
[ 0.264964] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 45, base_baud = 1500000) is a U6_16550A
[ 0.932953] printk: console [ttyS0] enabled
[ 0.938208] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pe not found, using dummy regulator
[ 0.968606] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 46, base_baud = 1500000) is a U6_16550A
[ 0.999932] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 47, base_baud = 1500000) is a U6_16550A
[ 1.014962] panel-simple panel: supply power not found, using dummy regulator
[ 1.022545] panel-simple panel: Specify missing connector_type
[ 1.030391] libphy: Fixed MDIO Bus: probed
[ 1.035212] CAN device driver interface
[ 1.039657] dwmac-sun8i 1c30000.ethernet: IRQ eth_wake_irq not found
[ 1.046143] dwmac-sun8i 1c30000.ethernet: IRQ eth_lpi not found
[ 1.052210] dwmac-sun8i 1c30000.ethernet: No regulator found
[ 1.057984] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[ 1.064221] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[ 1.071527] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[ 1.078747] dwmac-sun8i 1c30000.ethernet: COE Type 2
[ 1.083730] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[ 1.090514] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[ 1.096184] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[ 1.101867] dwmac-sun8i 1c30000.ethernet: device MAC address d6:56:90:e0:09:09
[ 1.109732] libphy: stmmac: probed
[ 1.114430] dwmac-sun8i 1c30000.ethernet: Found internal PHY node
[ 1.121248] libphy: mdio_mux: probed
[ 1.124869] dwmac-sun8i 1c30000.ethernet: Switch mux to internal PHY
[ 1.131286] dwmac-sun8i 1c30000.ethernet: Powering internal PHY
[ 1.139085] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.145759] ehci-platform: EHCI generic platform driver
[ 1.151239] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.157465] ohci-platform: OHCI generic platform driver
[ 1.164161] input: 1c22800.lradc as /devices/platform/soc/1c22800.lradc/input/input0
[ 1.173440] rotary-encoder rotary@0: gray
[ 1.178460] input: rotary@0 as /devices/platform/rotary@0/input/input1
[ 1.187134] sun6i-rtc 1c20400.rtc: registered as rtc0
[ 1.192416] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01T01:26:51 UTC (5211)
[ 1.200591] sun6i-rtc 1c20400.rtc: RTC enabled
[ 1.205482] i2c /dev entries driver
[ 1.210476] input: ns2009_ts as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input2
[ 1.220426] Driver for 1-wire Dallas network protocol.
[ 1.227208] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.235342] Bluetooth: HCI UART driver ver 2.3
[ 1.239793] Bluetooth: HCI UART protocol H4 registered
[ 1.245041] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 1.252426] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, using dummy regulator
[ 1.263407] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pg not found, using dummy regulator
[ 1.274623] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.281222] sun4i-ss 1c15000.crypto: Die ID 7
[ 1.288761] usbcore: registered new interface driver usbhid
[ 1.294484] usbhid: USB HID core driver
[ 1.299370] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.306740] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB
[ 1.316119] sun4i-codec 1c22c00.codec: Failed to register our card
[ 1.324501] NET: Registered protocol family 17
[ 1.328998] can: controller area network core
[ 1.333627] NET: Registered protocol family 29
[ 1.338086] can: raw protocol
[ 1.341133] can: broadcast manager protocol
[ 1.345329] can: netlink gateway - max_hops=1
[ 1.350297] Bluetooth: RFCOMM TTY layer initialized
[ 1.355353] Bluetooth: RFCOMM socket layer initialized
[ 1.360538] Bluetooth: RFCOMM ver 1.11
[ 1.364363] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1.369672] Bluetooth: BNEP filters: protocol multicast
[ 1.374928] Bluetooth: BNEP socket layer initialized
[ 1.379890] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 1.385825] Bluetooth: HIDP socket layer initialized
[ 1.391148] Key type dns_resolver registered
[ 1.395595] Registering SWP/SWPB emulation handler
[ 1.400448] Loading compiled-in X.509 certificates
[ 1.437437] sun4i-drm display-engine: bound 1100000.mixer (ops 0xc097c610)
[ 1.445077] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc097891c)
[ 1.453961] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.465480] sunxi-mmc 1c10000.mmc: card claims to support voltages below defined range
[ 1.475874] mmc1: new high speed SDIO card at address 0001
[ 1.493616] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.495706] mmc0: new high speed SDHC card at address 0002
[ 1.496918] mmcblk0: mmc0:0002 MSD20 3.73 GiB
[ 1.499651] mmcblk0: p1 p2 p3
[ 1.507412] Console: switching to colour frame buffer device 100x30
[ 1.566756] sun4i-drm display-engine: [drm] fb0: sun4i-drmdrmfb frame buffer device
[ 1.576864] debugfs: Directory '1c22c00.codec' with parent 'V3s Audio Codec' already present!
[ 1.591054] ALSA device list:
[ 1.594055] #0: V3s Audio Codec
[ 1.612781] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 1.621158] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 1.629553] devtmpfs: mounted
[ 1.633946] Freeing unused kernel memory: 1024K
[ 1.638711] Run /sbin/init as init process
[ 1.690069] random: fast init done
[ 1.792914] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting mdev... OK
[ 3.206544] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 3.248879] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 3.258062] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 3.266896] cfg80211: failed to load regulatory.db
[ 3.359658] 8723ds: module is from the staging directory, the quality is unknown, you have been warned.
Initializing random number generator: OK
Saving random seed: [ 3.742299] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting system message bus: [ 3.812938] random: dbus-uuidgen: uninitialized urandom read (12 bytes read)
[ 3.820155] random: dbus-uuidgen: uninitialized urandom read (8 bytes read)
done
Starting bluetoothd: OK
Starting network: OK
[ 6.200965] random: crng init done
[ 6.204396] random: 3 urandom warning(s) missed due to ratelimiting
Starting sshd: OK
Welcome to Buildroot for the LicheePi Zero
licheepi-zero login:
3. UART2默认速率是9600可以使用cat /dev/ttyS2来测试串口是否正常
4. 使用rtk_hciattach绑定uart端口
rtk_hciattach -n -s 115200 /dev/ttyS2 rtk_h5 &
`注意这个过程需要加载固件才行,如果固件不存在、不匹配或者错误就会失败。需要把固件放到提示的位置`
5. 固件及配置文件加载完后
Realtek Bluetooth :Init Process finished
Realtek Bluetooth post process
Device setup complete
`出现这个说明蓝牙模块初始化完成 此时hci0蓝牙端口已经生成,使用hciconfig工具可以查看端口及状态`
6. hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: 34:20:03:AA:A3:7E ACL MTU: 1021:8 SCO MTU: 255:12
UP RUNNING PSCAN ISCAN
RX bytes:165747 acl:159 sco:0 events:1160 errors:0
TX bytes:16622 acl:158 sco:0 commands:225 errors:0
Features: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'Sonavox-BT'
Class: 0x040428
Service Classes: Rendering
Device Class: Audio/Video, HiFi Audio Device
HCI Version: 4.1 (0x7) Revision: 0xaa7a
LMP Version: 4.1 (0x7) Subversion: 0x8cb2
Manufacturer: Realtek Semiconductor Corporation (93)
7. bluealsa -p a2dp-sink &
`建立bluez与alsa之前的桥梁,否则无法播放音频,只能连接上`
8. bluetoothd启动需要加载一些配置文件在/etc/bluetooth/main.conf 不加载也可以
#Default adaper name
#Defaults to 'BlueZ X.YZ'
Name = Sonavox-BT
#Default device class. Only the major and minor device class bits are
#considered. Defaults to '0x000000'.
Class = 0x000428
#How long to stay in discoverable mode before going back to non-discoverable
#The value is in seconds. Default is 180, i.e. 3 minutes.
#0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 0
#How long to stay in pairable mode before going back to non-discoverable
#The value is in seconds. Default is 0.
#0 = disable timer, i.e. stay pairable forever
PairableTimeout = 0
#Automatic connection for bonded devices driven by platform/user events.
#If a platform plugin uses this mechanism, automatic connections will be
#enabled during the interval defined below. Initially, this feature
#intends to be used to establish connections to ATT channels. Default is 60.
AutoConnectTimeout = 60
9. 使用蓝牙界的瑞士军刀bluetoothctl来调试蓝牙
10. 下面是可用的命令
Available commands:
-------------------
advertise Advertise Options Submenu
scan Scan Options Submenu
gatt Generic Attribute Submenu
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller
devices List available devices
paired-devices List paired devices
system-alias <name> Set controller alias
reset-alias Reset controller alias
power <on/off> Set controller power
pairable <on/off> Set controller pairable mode
discoverable <on/off> Set controller discoverable mode
discoverable-timeout [value] Set discoverable timeout
agent <on/off/capability> Enable/disable agent with given capability
default-agent Set agent as the default one
advertise <on/off/type> Enable/disable advertising with given type
set-alias <alias> Set device alias
scan <on/off> Scan for devices
info [dev] Device information
pair [dev] Pair with device
cancel-pairing [dev] Cancel pairing with device
trust [dev] Trust device
untrust [dev] Untrust device
block [dev] Block device
unblock [dev] Unblock device
remove <dev> Remove device
connect <dev> Connect device
disconnect [dev] Disconnect device
menu <name> Select submenu
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print environment variables
11. 操作记录如下: trust dev 之后,再连接就不再提示密码了,直接连接上
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[CHG] Device D8:8F:76:51:A7:87 Connected: yes
Request confirmation
[agent] Confirm passkey 151930 (yes/no): yes
Authorize service
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no):
[CHG] Device D8:8F:76:51:A7:87 ServicesResolved: yes
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): yes
Authorize service
[agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes
[ 2681.328397] input: iPhone (AVRCP) as /devices/virtual/input/#input5
[iPhone]# list
Controller 34:20:03:AA:A3:7E Sonavox-BT [default]
[iPhone]# devices
Device D8:8F:76:51:A7:87 iPhone
[iPhone]# info
Device D8:8F:76:51:A7:87 (public)
Name: iPhone
Alias: iPhone
Class: 0x007a020c
Icon: phone
Paired: yes
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Vendor specific (00000000-deca-fade-deca-deafdecacafe)
UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Current Time Service (00001805-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (02030302-1d19-415f-86f2-22a2106a0a77)
UUID: Vendor specific (7905f431-b5ce-4e99-a40f-4b1e122d00d0)
UUID: Vendor specific (89d3502b-0f36-433a-8ef4-c502ad55f8dc)
UUID: Vendor specific (9fa480e0-4967-4542-9390-d343dc5d04ae)
UUID: Vendor specific (d0611e78-bbb4-4591-a5f8-487910ae4366)
Modalias: bluetooth:v004Cp710Cd0E70
Battery Percentage: 0x55 (85)
[iPhone]# quit
# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="1c22800.lradc"
P: Phys=sun4i_lradc/input0
S: Sysfs=/devices/platform/soc/1c22800.lradc/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=3 0 0 0 0 0 0 0 c0000 0 0 0
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="rotary@0"
P: Phys=
S: Sysfs=/devices/platform/rotary@0/input/input1
U: Uniq=
H: Handlers=event1
B: PROP=0
B: EV=5
B: REL=1
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="ns2009_ts"
P: Phys=input/ts
S: Sysfs=/devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input2
U: Uniq=
H: Handlers=event2
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3
I: Bus=0005 Vendor=004c Product=710c Version=0e70
N: Name="iPhone (AVRCP)"
P: Phys=34:20:03:aa:a3:7e
S: Sysfs=/devices/virtual/input/input5
U: Uniq=
H: Handlers=kbd event3
B: PROP=0
B: EV=100007
B: KEY=2fc800 1452 0 0 0 0 10300 49e8 c00 e1680 f f8100000 10000ffc
B: REL=0
12. 通过AVRCP来控制手机上一曲,下一曲等 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/media-api.txt
`注意这里的蓝牙地址是你手机的,不是蓝牙模块的,因为要控制的是你的手机进行一一曲,下一曲的,地址不对会提示错误,就是这个原因,另外我测试除了不能调节音量外,其它的都能控制,不知道为什么?`
Error org.freedesktop.DBus.Error.UnknownObject: Method "Previous" with signature "" on interface "org.bluez.MediaControl1" doesn't exist
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.Pause
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.Play
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.Previous
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.Next
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.VolumeUp
# dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_D8_8F_76_51_A7_87 org.bluez.MediaControl1.VolumeDown
以下返回结果,可以看到"org.bluez.MediaControl1"已经注册了,但是提示已废弃,新的方法是"org.bluez.MediaPlay1",但是我这里用不了
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
<interface name="org.bluez.Device1">
<method name="Disconnect"></method>
<method name="Connect"></method>
<method name="ConnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="DisconnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="Pair"></method>
<method name="CancelPairing"></method>
<property name="Address" type="s" access="read"></property>
<property name="AddressType" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
<property name="Class" type="u" access="read"></property>
<property name="Appearance" type="q" access="read"></property>
<property name="Icon" type="s" access="read"></property>
<property name="Paired" type="b" access="read"></property>
<property name="Trusted" type="b" access="readwrite"></property>
<property name="Blocked" type="b" access="readwrite"></property>
<property name="LegacyPairing" type="b" access="read"></property>
<property name="RSSI" type="n" access="read"></property>
<property name="Connected" type="b" access="read"></property>
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Adapter" type="o" access="read"></property>
<property name="ManufacturerData" type="a{qv}" access="read"></property>
<property name="ServiceData" type="a{sv}" access="read"></property>
<property name="TxPower" type="n" access="read"></property>
<property name="ServicesResolved" type="b" access="read"></property>
<property name="WakeAllowed" type="b" access="readwrite"></property>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.bluez.Network1">
<method name="Connect">
<arg name="uuid" type="s" direction="in"/>
<arg name="interface" type="s" direction="out"/>
</method>
<method name="Disconnect"></method>
<property name="Connected" type="b" access="read"></property>
<property name="Interface" type="s" access="read"></property>
<property name="UUID" type="s" access="read"></property>
</interface>
<interface name="org.bluez.MediaControl1">
<method name="Play">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="Pause">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="Stop">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="Next">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="Previous">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="VolumeUp">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="VolumeDown">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="FastForward">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<method name="Rewind">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
<property name="Connected" type="b" access="read"></property>
<property name="Player" type="o" access="read"></property>
</interface>
<interface name="org.bluez.Battery1">
<property name="Percentage" type="y" access="read"></property>
</interface>
<node name="fd1"/>
<node name="player2"/>
<node name="sep1"/>
<node name="sep2"/>
<node name="sep3"/>
<node name="sep4"/>
<node name="sep5"/>
<node name="sep6"/>
<node name="service0006"/>
<node name="service000a"/>
<node name="service000f"/>
<node name="service0014"/>
<node name="service0018"/>
<node name="service001e"/>
<node name="service0023"/>
<node name="service002d"/>
</node>"
13. 另外在蓝牙连接成功时会在/dev/input/目录下注册一个event3
I: Bus=0005 Vendor=004c Product=710c Version=0e70
N: Name="iPhone (AVRCP)"
P: Phys=34:20:03:aa:a3:7e
S: Sysfs=/devices/virtual/input/input5
U: Uniq=
H: Handlers=kbd event3
B: PROP=0
B: EV=100007
B: KEY=2fc800 1452 0 0 0 0 10300 49e8 c00 e1680 f f8100000 10000ffc
B: REL=0
我偿试过使用sendevent 去操作/dev/input/event3 但是没有任何反应,不知道能不能这样操作?
# ./sendevent /dev/input/event3 1 116 1
# ./sendevent /dev/input/event3 0 0 0
# ./sendevent /dev/input/event3 1 114 1
14. 至此,BLUETOOTH,DLNA,AIRPLAYER都可以通过Alsa声卡一起同时播放了
最近编辑记录 xfdr0805 (2021-07-28 13:05:08)
离线
蓝牙连接成功后,自动生成了一个event3 通过这个为什么不能控制手机呢?还是说我的手机变成了一个输入设备,按手机音量加减 也没事件输出啊?
# evtest /dev/input/event3
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x4c product 0x710c version 0xe70
Input device name: "iPhone (AVRCP)"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 2 (KEY_1)
Event code 3 (KEY_2)
Event code 4 (KEY_3)
Event code 5 (KEY_4)
Event code 6 (KEY_5)
Event code 7 (KEY_6)
Event code 8 (KEY_7)
Event code 9 (KEY_8)
Event code 10 (KEY_9)
Event code 11 (KEY_0)
Event code 28 (KEY_ENTER)
Event code 52 (KEY_DOT)
Event code 59 (KEY_F1)
Event code 60 (KEY_F2)
Event code 61 (KEY_F3)
Event code 62 (KEY_F4)
Event code 63 (KEY_F5)
Event code 64 (KEY_F6)
Event code 65 (KEY_F7)
Event code 66 (KEY_F8)
Event code 67 (KEY_F9)
Event code 103 (KEY_UP)
Event code 105 (KEY_LEFT)
Event code 106 (KEY_RIGHT)
Event code 108 (KEY_DOWN)
Event code 113 (KEY_MUTE)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 138 (KEY_HELP)
Event code 139 (KEY_MENU)
Event code 163 (KEY_NEXTSONG)
Event code 165 (KEY_PREVIOUSSONG)
Event code 166 (KEY_STOPCD)
Event code 167 (KEY_RECORD)
Event code 168 (KEY_REWIND)
Event code 171 (KEY_CONFIG)
Event code 174 (KEY_EXIT)
Event code 200 (KEY_PLAYCD)
Event code 201 (KEY_PAUSECD)
Event code 208 (KEY_FASTFORWARD)
Event code 353 (KEY_SELECT)
Event code 356 (KEY_POWER2)
Event code 358 (KEY_INFO)
Event code 362 (KEY_PROGRAM)
Event code 364 (KEY_FAVORITES)
Event code 395 (KEY_LIST)
Event code 398 (KEY_RED)
Event code 399 (KEY_GREEN)
Event code 400 (KEY_YELLOW)
Event code 401 (KEY_BLUE)
Event code 402 (KEY_CHANNELUP)
Event code 403 (KEY_CHANNELDOWN)
Event code 405 (KEY_LAST)
Event type 2 (EV_REL)
Key repeat handling:
Repeat type 20 (EV_REP)
Repeat code 0 (REP_DELAY)
Value 300
Repeat code 1 (REP_PERIOD)
Value 33
Properties:
Testing ... (interrupt to exit)
离线
无法用dbus 发送事件去上下曲 ,应当是bluealsa 的插件没打开
可以使用dbus发送事件,只是不太清楚,在蓝牙连接后自动生成的那个event是干什么的,看起来像个键盘
离线
楼主,您好,您可以分享一下您的RTL8723DS这个天线的原理图和PCB布局吗?借鉴一下您的天线布局布线,麻烦楼主了,谢谢。
PS:QQ(2985438804)
这个是Kicad里系统自带的天线 分左和右2种
离线