STM32F0-Discovery: no tty - linux

I am currently trying to send data to my STM32F0308 board via USART.
The data is supposed to be sent by a Python script using PySerial.
However, when I plug in the board, I cannot find the corresponding /dev/ttyXXXX.
The board is branched and I can flash code on it (STLink via USB), but there is no port visible.
dmesg shows that the computer is aware of the board:
[10364.101554] usb 1-3: USB disconnect, device number 10
[10368.044231] usb 1-3: new full-speed USB device number 12 using xhci_hcd
[10368.173948] usb 1-3: New USB device found, idVendor=0483, idProduct=3748
[10368.173956] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10368.173959] usb 1-3: Product: STM32 STLink
[10368.173962] usb 1-3: Manufacturer: STMicroelectronics
[10368.173965] usb 1-3: SerialNumber: VÿnIxRT68\xffffffc2\xffffff87
Here is the output of lsusb:
Bus 001 Device 012: ID 0483:3748 STMicroelectronics ST-LINK/V2
Here's the output of ls /dev/tty*:
tty tty12 tty17 tty21 tty26 tty30 tty35 tty4 tty44 tty49 tty53 tty58 tty62 ttyprintk ttyS12 ttyS17 ttyS21 ttyS26 ttyS30 ttyS7
tty0 tty13 tty18 tty22 tty27 tty31 tty36 tty40 tty45 tty5 tty54 tty59 tty63 ttyS0 ttyS13 ttyS18 ttyS22 ttyS27 ttyS31 ttyS8
tty1 tty14 tty19 tty23 tty28 tty32 tty37 tty41 tty46 tty50 tty55 tty6 tty7 ttyS1 ttyS14 ttyS19 ttyS23 ttyS28 ttyS4 ttyS9
tty10 tty15 tty2 tty24 tty29 tty33 tty38 tty42 tty47 tty51 tty56 tty60 tty8 ttyS10 ttyS15 ttyS2 ttyS24 ttyS29 ttyS5
tty11 tty16 tty20 tty25 tty3 tty34 tty39 tty43 tty48 tty52 tty57 tty61 tty9 ttyS11 ttyS16 ttyS20 ttyS25 ttyS3 ttyS6
And here is my the function to initialize the serial port:
#function to initialize the serial port
def init_serial():
global ser #must be declared in each function
#set serial: port, baudrate, timeout (port does not hang)
ser = serial.Serial(port="/dev/ttyS3", baudrate=9600, timeout=5)
if ser.isOpen():
ser.close()
#open the serial port
ser.open()
#print: port is open or closed
if ser.isOpen():
print("Port open: " + ser.portstr)
else:
print("Port not open: We have a problem!")
#function ends here
I am using Ubuntu 15.04, but it also did not work on another computer using Debian.
According to ST, the STM32F0x0 line supports USB.
Edit:
As requested, the output of lsusb -v:
Bus 001 Device 003: ID 0483:3748 STMicroelectronics ST-LINK/V2
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x3748 ST-LINK/V2
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 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 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0

The device gets discovered and it's a ST-Link debug interface.
The STM32F0308-Discovery does not have a USB UART interface and the ST-Link does not include UART functionality as far as I can see. What you are trying to do appears to be impossible without extra hardware. You would have to get one of those USB UART interfaces with separate connectors and wire it up to the USART pins exposed on the headers.

Related

Bluetooth LE connection drops immediately after connecting

I'm building an application (runs on central device) in which I can scan, connect, pair, & reconnect in LE to a specific target device (peripheral device). My application is able to scan for Bluetooth LE devices and I have set the connection function. When I run my application, it scans until it find the target device and then it starts the connecting process.
On the target side (peripheral), I can see my central device was able to connect to it but the connection is dropped immediately. I think this is because it didn't find any compatible service (I think that just means there was no recognizable GATT attirubute/application/service?). I tried to connect to the same peripheral device through bluetoothctl and the connection drops immediately which makes me think something is missing from my target device (peripheral).
I'm wondering if I need to implement anything else before I try to connect to my peripheral device? Is it disconnecting because it didn't find any recognizable service on my central?
This is what I have from btmon on the peripheral side with another connection which was successful:
Connection request
Read remote supported features (understood remote as target device)
Turn off scan
Read remote extended features
Remote name request
Found this in the BTMON. "Attribute not found" possibly the issue?
> ACL Data RX: Handle 128 flags 0x02 dlen 11 #23 [hci0] 16.564046
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 128 flags 0x00 dlen 24 #24 [hci0] 16.564325
ATT: Read By Group Type Response (0x11) len 19
Attribute data length: 6
Attribute group list: 3 entries
Handle range: 0x0001-0x0005
UUID: Generic Access Profile (0x1800)
Handle range: 0x0006-0x000f
UUID: Generic Attribute Profile (0x1801)
Handle range: 0x0010-0x0012
UUID: Device Information (0x180a)
< ACL Data TX: Handle 128 flags 0x00 dlen 11 #25 [hci0] 16.564349
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0xffff
Attribute type: Unknown (0x2b3a)
> HCI Event: Number of Completed Packets (0x13) plen 5 #26 [hci0] 16.580038
Num handles: 1
Handle: 128
Count: 1
> ACL Data RX: Handle 128 flags 0x02 dlen 11 #27 [hci0] 16.596035
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0013-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5 #28 [hci0] 16.596041
Num handles: 1
Handle: 128
Count: 1
< ACL Data TX: Handle 128 flags 0x00 dlen 9 #29 [hci0] 16.596267
ATT: Error Response (0x01) len 4
Read By Group Type Request (0x10)
Handle: 0x0013
Error: Attribute Not Found (0x0a)
> ACL Data RX: Handle 128 flags 0x02 dlen 9 #30 [hci0] 16.620082
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0001
Error: Attribute Not Found (0x0a)

Diolan DLN-2 SPI controller on x86_64 platform

I am attempting to utilize the DLN-2 in an x86_64 Linux environment (kernel version 4.18) to provide SPI and I2C bus controllers to the userspace, in a similar manner you would using an ARM platform with DTS/DTB file modifications. I am having trouble identifying the proper method to attach a SPI slave device or mount the device to userspace with the spidev driver.
The kernel modules are loading successfully and the SPI bus is mounted as a spi_master. I am certain the chip itself is working because the I2C (/dev/i2c-#) and GPIO (/dev/gpiochip#) interfaces can be successfully manipulated. For reference, here is a list of all references in the Linux system tree for "dln":
# find /sys -name *dln*
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-i2c.1.auto
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-gpio.0.auto
/sys/fs/selinux/booleans/minidlna_read_generic_user_content
/sys/bus/platform/devices/dln2-i2c.1.auto
/sys/bus/platform/devices/dln2-spi.2.auto
/sys/bus/platform/devices/dln2-gpio.0.auto
/sys/bus/platform/drivers/dln2-gpio
/sys/bus/platform/drivers/dln2-gpio/dln2-gpio.0.auto
/sys/bus/platform/drivers/dln2-adc
/sys/bus/platform/drivers/dln2-spi
/sys/bus/platform/drivers/dln2-spi/dln2-spi.2.auto
/sys/bus/platform/drivers/dln2-i2c
/sys/bus/platform/drivers/dln2-i2c/dln2-i2c.1.auto
/sys/bus/usb/drivers/dln2
/sys/module/i2c_dln2
/sys/module/i2c_dln2/drivers/platform:dln2-i2c
/sys/module/industrialio_triggered_buffer/holders/dln2_adc
/sys/module/spi_dln2
/sys/module/spi_dln2/drivers/platform:dln2-spi
/sys/module/industrialio/holders/dln2_adc
/sys/module/dln2_adc
/sys/module/dln2_adc/drivers/platform:dln2-adc
/sys/module/gpio_dln2
/sys/module/gpio_dln2/drivers/platform:dln2-gpio
/sys/module/dln2
/sys/module/dln2/holders/i2c_dln2
/sys/module/dln2/holders/spi_dln2
/sys/module/dln2/holders/dln2_adc
/sys/module/dln2/holders/gpio_dln2
/sys/module/dln2/drivers/usb:dln2
Here is the matching portion of the boot log:
[ 1.578110] usb 1-2: new full-speed USB device number 2 using xhci_hcd
[ 1.705306] usb 1-2: New USB device found, idVendor=a257, idProduct=2013, bcdDevice= 1.00
[ 1.705310] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.705312] usb 1-2: Product: Diolan DLN2
[ 1.705314] usb 1-2: Manufacturer: Diolan
[ 10.485997] dln2 1-2:1.0: Diolan DLN2 serial 33632920
[ 10.486182] usbcore: registered new interface driver dln2
And the relevant portion of the usb device tree:
Bus 001 Device 002: ID a257:2013
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
idVendor 0xa257
idProduct 0x2013
bcdDevice 1.00
iManufacturer 1 Diolan
iProduct 2 Diolan DLN2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
At this point, I am assuming that an ACPI patch is the correct method. however, the device does not appear in the ACPI device tree, or I am not searching with the correct string. I am assuming it will be similar to the following, which I pulled from a kernel patch (https://lore.kernel.org/patchwork/patch/527210/) that appears to have since been removed from the current kernel.
DefinitionBlock ("dln2.aml", "SSDT", 1, "INTEL", "CpuDptf", 3)
{
Device (DLN0)
{
Name (_ADR, Zero)
Name (_HID, "DLN2000")
Device (TP40) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI4-CS0")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
1, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\DLN0.SPI0", // SPI host controller
0 // Must be 0
)
})
}
}
}
I have also tried udev rules, but my knowledge of udev is slim so they are likely incorrect. None of these appeared to have done the trick:
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0", DRIVER="spidev"
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0", KERNEL="spi-SPT0001:02", SUBSYSTEM="spi", DRIVER="spidev", ATTRS{driver_override}==""
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0/spi-SPT0001:02", KERNEL="spidev2.0", SUBSYSTEM="spidev", DRIVER=""
Okay, now I'm able to answer to the question.
First of all, assume that DSDT on the host machine, i.e. USB host controller excerpt, looks like this (some names maybe different, some methods may or may not be provided, just interesting us part):
Device (XHC)
{
Name (_ADR, 0x00110000)
...
Device (RHUB)
{
Name (_ADR, Zero)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized) {
Name (PCKG, Package () {
Buffer (0x10) {}
})
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (Index (PCKG, Zero)), Zero, 0x07, REV)
Store (0x02, REV)
// VISI: Port visibility to user per port
CreateField (DerefOf (Index (PCKG, Zero)), 0x40, One, VISI)
Store (Arg0, VISI)
Return (PCKG)
}
Device (HS01) { Name (_ADR, 1) }
Device (HS02) { Name (_ADR, 2) }
Device (SS01) { Name (_ADR, 3) }
Device (SS02) { Name (_ADR, 4) }
...
}
}
Important thing above is that port devices (HS01, SS01, etc) does not have _UPC() or _PLD() methods. If they are, you will need to override complete DSDT or upgrade it and ACPI SSDT overlays won't work.
Assume that Diolan device is connected to HS02 USB port. In this case we have to provide the following ACPI excerpt, either in DSDT or as SSDT overlay (Note, method GPLD(), if not present, should be copied from above excerpt):
External (\_SB.PCI0.XHC.RHUB.HS02, DeviceObj)
External (\_SB.PCI0.XHC.RHUB.GPLD, MethodObj)
/*
* We set the port to hard wired state to get the connected device
* enumerated properly. See more details here:
* https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/other-acpi-namespace-objects#acpi-namespace-hierarchy-and-_adr-for-embedded-usb-devices
*/
Scope (\_SB.PCI0.XHC.RHUB.HS02)
{
Name (_UPC, Package ()
{
0xFF,
0xFF,
Zero,
Zero,
})
Method (_PLD, 0, NotSerialized)
{
Return (GPLD (Zero))
}
Device (GPIO)
{
Name (_ADR, Zero)
Name (_STA, 0x0F)
}
Device (I2C)
{
Name (_ADR, One)
Name (_STA, 0x0F)
}
Device (SPI)
{
Name (_ADR, 0x02)
Name (_STA, 0x0F)
}
}
Note, this example now is a part of meta-acpi project.
After loading these tables we will get everything enumerated like:
$ grep -H HS02 /sys/bus/acpi/devices/device\:*/path
/sys/bus/acpi/devices/device:09/path:\_SB_.PCI0.XHC.RHUB.HS02
/sys/bus/acpi/devices/device:0e/path:\_SB_.PCI0.XHC.RHUB.HS02.GPIO
/sys/bus/acpi/devices/device:0f/path:\_SB_.PCI0.XHC.RHUB.HS02.I2C_
/sys/bus/acpi/devices/device:10/path:\_SB_.PCI0.XHC.RHUB.HS02.SPI_
$ ls -l /sys/bus/platform/devices/dln2-*/firmware_node
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-gpio.2.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:0e
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-i2c.3.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:0f
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-spi.4.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:10
This gets us the device object we can attach our slave devices to. So, more detailed this part has been answered in the following SO posts:
adding i2c client devices on x86_64
Building a i2c device controller
spidev Linux driver on Intel Atom board
Note, there are two patches to make it possible in Linux.
One is a599a0fb629a ("Add ACPI support for USB interface devices") and one is pending e3fadb35bc1b ("Allow to be enumerated via ACPI"). Both will be in v5.7-rc1.

Decoding the meaning of hcitool info extended features for a Bluetooth 4.0 device

I have an embedded Bluetooth 4.0 module (A Laird BT900 with uses a CSR 8811). I am trying to debug some issues that occur during discovery and connection with other devices. So I am trying to understand exactly what this device is communicating about its capabilities to others during an inquiry.
On my embedded module if I disable pairing, and then run hcitool info I see the following
$ sudo hcitool -i hci0 info 00:16:A4:0F:B9:98
Requesting information ...
BD Address: 00:16:A4:0F:B9:98
OUI Company: Ezurio Ltd (00-16-A4)
Device Name: FOO BAR
LMP Version: 4.0 (0x6) LMP Subversion: 0x2031
Manufacturer: Cambridge Silicon Radio (10)
Features page 0: 0xff 0x07 0x87 0x7e 0xd8 0x1f 0x5b 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <CVSD> <paging scheme>
<power control> <broadcast encrypt> <EDR ACL 2 Mbps>
<EDR ACL 3 Mbps> <enhanced iscan> <interlaced iscan>
<interlaced pscan> <inquiry with RSSI> <AFH cap. slave>
<AFH class. slave> <LE support> <3-slot EDR ACL>
<5-slot EDR ACL> <sniff subrating> <pause encryption>
<AFH cap. master> <AFH class. master> <extended inquiry>
<LE and BR/EDR> <simple pairing> <encapsulated PDU>
<non-flush flag> <LSTO> <inquiry TX power> <EPC>
<extended features>
Features page 1: 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00
If I set the device to pairable the output looks like this
$ sudo hcitool -i hci0 info 00:16:A4:0F:B9:98
Requesting information ...
BD Address: 00:16:A4:0F:B9:98
OUI Company: Ezurio Ltd (00-16-A4)
Device Name: FOO BAR
LMP Version: 4.0 (0x6) LMP Subversion: 0x2031
Manufacturer: Cambridge Silicon Radio (10)
Features page 0: 0xff 0x07 0x87 0x7e 0xd8 0x1f 0x5b 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <CVSD> <paging scheme>
<power control> <broadcast encrypt> <EDR ACL 2 Mbps>
<EDR ACL 3 Mbps> <enhanced iscan> <interlaced iscan>
<interlaced pscan> <inquiry with RSSI> <AFH cap. slave>
<AFH class. slave> <LE support> <3-slot EDR ACL>
<5-slot EDR ACL> <sniff subrating> <pause encryption>
<AFH cap. master> <AFH class. master> <extended inquiry>
<LE and BR/EDR> <simple pairing> <encapsulated PDU>
<non-flush flag> <LSTO> <inquiry TX power> <EPC>
<extended features>
Features page 1: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
The only difference between these two is what is in Features page 1. In one case the first byte is 0x02, and in the other it is 0x03.
So here is my question: What is the meaning of this byte? Where can I locate documentation about these extended features? Is this something that I can only get from the vendor, or is there some standard meaning?
The answer to my question is: The extended features are documented in Table 3.3 in section section 3.3 "FEATURE MASK DEFINITION" of the Link Manager Protocol Specificiation which Volume 2 Part C the Bluetooth Core Specification v 5.2 (Pg 587). The HCI_Read_Remote_Extended_Features command is documented in sections 4.9 and 7.1.22.
I was able to find out the answer to this by performing a TCP dump, and analyzing the data in wireshark.
$ tcpdump -i bluetooth0 -w bt900_inquire_with_pairing_on.pcap &
[1] 26733
tcpdump: listening on bluetooth0, link-type BLUETOOTH_HCI_H4_WITH_PHDR (Bluetooth HCI UART transport layer plus pseudo-header), capture size 262144 bytes
$ hcitool scan
Scanning ...
00:16:A4:0F:B9:98 FOO BAR
$ sudo hcitool -i hci0 info 00:16:A4:0F:B9:98
Requesting information ...
BD Address: 00:16:A4:0F:B9:98
OUI Company: Ezurio Ltd (00-16-A4)
Device Name: FOO BAR
LMP Version: 4.0 (0x6) LMP Subversion: 0x2031
Manufacturer: Cambridge Silicon Radio (10)
Features page 0: 0xff 0x07 0x87 0x7e 0xd8 0x1f 0x5b 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <CVSD> <paging scheme>
<power control> <broadcast encrypt> <EDR ACL 2 Mbps>
<EDR ACL 3 Mbps> <enhanced iscan> <interlaced iscan>
<interlaced pscan> <inquiry with RSSI> <AFH cap. slave>
<AFH class. slave> <LE support> <3-slot EDR ACL>
<5-slot EDR ACL> <sniff subrating> <pause encryption>
<AFH cap. master> <AFH class. master> <extended inquiry>
<LE and BR/EDR> <simple pairing> <encapsulated PDU>
<non-flush flag> <LSTO> <inquiry TX power> <EPC>
<extended features>
Features page 1: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
$ fg 1
tcpdump -i bluetooth0 -w bt900_inquire_with_pairing_on.pcap
^C44 packets captured
1021 packets received by filter
0 packets dropped by kernel
$
From wireshark I scrolled through the packets and found a sequence:
Command Status (Read Remote Supported Features)
Read Remote Supported Features
Command Status (Read Remote Extended Features)
Read Remote Extended Features Complete
This last frame contained:
Bluetooth HCI Event - Read Remote Extended Features Complete
Event Code: Read Remote Extended Features Complete (0x23)
Parameter Total Length: 13
Status: Success (0x00)
Connection Handle: 0x000c
Page Number: 1
Max. Page Number: 1
LMP Features
.... ...0 = Secure Simple Pairing Host: False
.... ..1. = LE Supported Host: True
.... .0.. = Simultaneous LE and BR/EDR to Same Device Capable Host: False
.... 0... = Secure Connections Host: False
0000 .... = Reserved: 0x0
Reserved: 00000000000000
This gave me a lot of search terms to help me find what I was looking for, and bit 1 is the "Secure Simple Pairing (Host Support) feature bit" per the LMP protocol spec.

How to configure unknown usb device as ethernet on Linux host?

When my USB device was connected, I got the following:
$ dmesg | tail
[ 79.612133] usb 2-2: new full-speed USB device number 3 using ohci-pci
[ 79.937340] usb 2-2: New USB device found, idVendor=238b, idProduct=0a21
[ 79.937343] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 79.937344] usb 2-2: Product: DMR Radio
[ 79.937346] usb 2-2: Manufacturer: Hytera Communications
[ 80.282770] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 80.286007] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 80.399206] usbcore: registered new interface driver cdc_ether
[ 80.404402] usbcore: registered new interface driver rndis_host
[ 80.421516] usbcore: registered new interface driver rndis_wlan
There is no message like "cdc_subset 1-4.4.2:1.1: usb0: register 'cdc_subset' at usb-0000:00:02.1-4.4.2, Linux Device".
So there is no ethernet named as usb0.
$ uname -a
Linux VB1804 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
It is shown as unknown device.
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 238b:0a21
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$ lsmod | grep usbnet
usbnet 45056 3 rndis_host,cdc_ether,rndis_wlan
mii 16384 1 usbnet
I got the same on physical Linux.
And,
$ usb-devices
--------- other usb devices ----
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=fe Prot=fe MxPS= 8 #Cfgs= 1
P: Vendor=238b ProdID=0a21 Rev=00.00
S: Manufacturer=Hytera Communications
S: Product=DMR Radio
C: #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=4mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=ff Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I add the idVendor and idProduct to the white list of structure array prodocts[] in file rndis_host.c.
static const struct usb_device_id products [] = {
{ /* DMR Radio*/
USB_DEVICE_AND_INTERFACE_INFO(0x238b, 0x0a21,
USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
.driver_info = (unsigned long) &rndis_info,
}, {
And, It works.

FTDI D2XX FT_DEVICE_LIST_INFO_NODE structure is all zeros

I am trying to get a Matlab MEX to run in Linux. It uses FTDI's D2XX library v1.3.6 (Documentation).
FT_CreateDeviceInfoList(&ftdi_count) gives me an ftdi_count of 1, so the FTDI chip is detected.
However, when iterating through the device list from FT_GetDeviceInfoList(device_list, &ftdi_count), my FT_DEVICE_LIST_INFO_NODE structure is all zeros, so obviously the code cannot find the device with the description it is looking for:
(gdb) p *p_device
$3 = {Flags = 1, Type = 3, ID = 0, LocId = 0, SerialNumber = '\000' <repeats 15 times>,
Description = '\000' <repeats 63 times>, ftHandle = 0x0}
My first guess was that udev wasn't set up. But the problem persists with
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}="6014", MODE="0666"
lsusb -v has access to the values:
Bus 001 Device 012: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0403 Future Technology Devices International, Ltd
idProduct 0x6014 FT232H Single HS USB-UART/FIFO IC
bcdDevice 9.00
iManufacturer 1 FTDI
iProduct 2 [company that provided me with their] Kit v3
iSerial 3 FT266WVA
bNumConfigurations 1
[...]
What can I do to make the FTDI functions work?
The problem is that Linux automatically loads the VCP driver (ftdi_sio).
In the Question How can I get Linux device with FTDI D2XX driver API, Akira shows a udev script to from A blog unload that driver. I modified it to work with my FT232H chip, which has only one port:
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", RUN+="/bin/sh -c 'echo -n $kernel:1.0 > /sys/bus/usb/drivers/ftdi_sio/unbind;'"

Resources