UAC

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zoosenpin/article/details/87439254

1 MIDI
USB3125T

2 iPod
2.1 iPod和Carplay模式切换
能力测试Control Transfer:
- 0xC0 0x53 0x0000 0x0000 0x0004
- 0x00000001,支持Carplay

模式切换Control Transfer:
bmRequestType = VENDOR|DIR_OUT = 0x40, bRequest = 0x51, wValue = 1, wIndex = 0, wLength = 0
- 请求失败(stall),iPhone维持在iPod模式,iPhone作为USB slave;控制iAP1/2数据走HID
- 成功表示iPhone已经切换到USB Host mode - Carplay;控制iAP1/2走私有USB接口类,视频H264编码走USB NCM,网络接口名字是usb0

2.2 iAP协议
2.2.1 Acronym
ATS:Accessory Test System
iAP1:iPod Accessory Protocol,适配30pin
iAP2:适配Lightning
IDPS:Identify Device Preferences and Settings
iUI:iPod USB Interface,配置2,车机用该接口播放音乐,提供HID接口走iAP协议

The Apple 30-pin Dock Connector
http://irq5.io/2012/06/25/the-apple-30-pin-dock-connector/

2.2.2 协议细节
small包格式:
offset 0:0xFF,Sync byte(仅用于串口)
offset 1:0x55,SOP
offset 2:payload长度;包含Lingo ID、Command ID和Command data
offset 3:Lingo ID,10表示Digital Audio lingo
offset 4:Command ID
offset 5 - N:Command data
last byte:Packet payload checksum

iAP2函数库有250多个函数

常见Command ID:
StartIDPS:0x38
EndIDPS:0x3B
ACK:0x02
- offset 7:ackStatus,0表示成功;没有2字节transID时offset 5是ackStatus,参见page453

2.2.3 usbmon tcpdump - 结点/dev/usbmonX
1)mount -t debugfs none_debugs /sys/kernel/debug
2)cat /sys/kernel/debug/usb/devices - 确定usb的总线号
3)tcpdump -D
4)tcpdump -i usbmon1 -s 128 -w /data/usblog.pcap &
5)killall tcpdump
6)wireshark工具打开usblog.pcap
7)wireshark过滤:usb.src == "1.6.1" and usb.dst == "host" - 改到对应的USB bus_no.addr.ep_no

2.3 充电电流设置
2.3.1 USB Vendor请求
bmRequestType:0x40
bRequest:0x40
wValue:0、100、500,USB suspend时额外吸收的电流,单位mA
wIndex:500、1600,正常充电时额外吸收的电流,单位mA
wLength:0

Apple charger utility
https://github.com/mkorenkov/ipad_charge/

2.3.2 iAP
SetAvailableCurrent

2.4 IC
PS8645
usb7002:支持carplay角色切换的hub

2.5 URLs
MFi Accessory Hardware Specification R8
https://www.docin.com/touch/detail.do?id=679433359

iPod Accessory Protocol Interface Specification
https://files-cdn.cnblogs.com/files/we-hjb/iPod_Accessory_Protocol_Interface_Spec_R38.pdf

基于Android车载娱乐系统的iPod功能实现
https://m.book118.com/html/2018/0205/152015608.shtm

iPod usb gadget for audio playback
https://github.com/oandrew/ipod-gadget

用串口控制iPad或iPod touch播放音乐
https://www.amobbs.com/thread-4631280-1-1.html

iPod认证过程
https://blog.csdn.net/mirkerson/article/details/53005279

判断iPhone设备是carplay和iPod的方法
http://m.bubuko.com/infodetail-1911192.html

Android添加iPod USB PCM音频
https://blog.csdn.net/zhong419040805/article/details/39736419

3 URLs
拒绝YY 从基础讲解USB/UAC运作原理
http://erji.net/forum.php?mod=viewthread&tid=1987631

猜你喜欢

转载自blog.csdn.net/zoosenpin/article/details/87439254
UAC