Android Linux usb:如何让';s bNumConfigurations值是否为0x01?
我正在linux PC上进行android手机测试,有时发现PC无法读取手机号码,如下所示:Android Linux usb:如何让';s bNumConfigurations值是否为0x01?,android,linux,usb,Android,Linux,Usb,我正在linux PC上进行android手机测试,有时发现PC无法读取手机号码,如下所示: **XXXXX@XXXXXX:~$ adb devices List of devices attached** 我运行lsusb命令并得到以下结果: *Bus 002 Device 088: ID 0fce:5178 Sony Ericsson Mobile Communications AB Device Descriptor: bLe
**XXXXX@XXXXXX:~$ adb devices
List of devices attached**
我运行lsusb命令并得到以下结果:
*Bus 002 Device 088: ID 0fce:5178 Sony Ericsson Mobile Communications AB
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0fce Sony Ericsson Mobile Communications AB
idProduct 0x5178
bcdDevice 2.28
iManufacturer 2 Sony
iProduct 3 LT*****
iSerial 4 CB5A****
**bNumConfigurations 0**
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)*
Based on this, if reconnet my mobile phone into linux PC, this is OK,and running lsusb commands, it will get the below:
*Bus 002 Device 089: ID 0fce:5178 Sony Ericsson Mobile Communications AB
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0fce Sony Ericsson Mobile Communications AB
idProduct 0x5178
bcdDevice 2.28
iManufacturer 2 Sony
iProduct 3 LT*****
iSerial 4 CB5A****
**bNumConfigurations 1**
配置描述符:
bLength 9
bDescriptorType 2
wTotalLength 62
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 0
iInterface 5 MTP
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x001c 1x 28 bytes
bInterval 6
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 66
bInterfaceProtocol 1
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
设备限定符(用于其他设备速度):
(公共汽车供电)*
很明显,bNumConfigurations值为1将得到正确的结果。
如果有可能,我没有重新连接android手机和linux PC,只输入一个或多个linux shell命令,让PC可以续费以获取android手机号码?如果我正确理解您的问题,您希望能够一致运行
adb get serialno
。我发现此命令失败有三个原因:
# $1 - VID[:PID]
usb_id_to_bind()
{
declare -r dev_name="$(lsusb|sed -rn 's_^Bus ([0-9]{3}) Device ([0-9]{3}): ID '"$1"'.*_/dev/bus/usb/\1/\2_p')"
declare -r dev_path="$(udevadm info -q path -n"$dev_name")"
basename "$dev_path"
}
usb_unbind()
{
echo "$(usb_id_to_bind "$@")"|sudo tee /sys/bus/usb/drivers/usb/unbind
}
usb_bind()
{
echo "$(usb_id_to_bind "$@")"|sudo tee /sys/bus/usb/drivers/usb/bind
}
usb_unbind 04e8:6866; usb_bind 04e8:6866
如果这不起作用,您可能需要重新启动手机(adb-reboot
)
对于3,您可以使用
adb kill server
修复此问题,然后再次执行命令。使用以下命令解除驱动程序绑定
*#$1-视频[:PID]
usb_id_to_bind()
{
declare-r dev_name=“$(lsusb | sed-rn的^总线([0-9]{3})设备([0-9]{3}):ID
“$1”.*u\dev/bus/usb/\1/\2\u p”)”
declare-r dev_path=“$(udevadm info-q path-n“$dev_name”)”
basename“$dev_path”
}
usb_unbind()
{
echo“$(usb_id_to_bind“$@”)”| sudo-tee/sys/bus/usb/drivers/usb/unbind
}
usb_bind()
{
echo“$(usb_id_to_bind“$@”)”| sudo-tee/sys/bus/usb/drivers/usb/bind
}
usb_解除绑定04e8:6866
但在运行lsusb命令时,手机似乎仍连接如下:
**XXXXX@XXXXXX:~$ adb devices
List of devices attached**
*总线008设备001:ID1D6B:0001 Linux基础1.1根Hub
总线007设备002:ID 03f0:0325 Hewlett-Packard总线007设备001:ID1D6B:0001 Linux基金会1.1根Hub
总线006设备001:ID1D6B:0001 Linux基金会1.1根Hub
总线005设备001:ID1D6B:0001 Linux基金会1.1根Hub
总线004设备001:ID1D6B:0001 Linux基金会1.1根Hub
总线003设备001:ID1D6B:0001 Linux基金会1.1根Hub
总线002设备014:ID 0fce:5178索尼爱立信移动通信AB 总线002设备006:ID 046d:c03d Logitech,Inc.M-BT96a导向光学鼠标 总线002设备003:ID 0409:005a NEC公司高速集线器总线002设备001:ID1D6B:0002 Linux基金会2根Hub
总线001设备001:ID1D6B:0002 Linux基础2根Hub */P> 如何让android设备更新以连接linux PC?我正在运行以下命令:
sudo sh-c“echo 0>/sys/bus/usb/devices/2-5/authorized”,让android手机续费连接PC,失败了 请正确地编排你的问题。最好在每行前面放四个空格来表示代码或输出