assign static ttyUSB - linux

I have 2 USB devices connected to raspberry pi,
CP2108 USB to serial converter which has 4 ports, when I connect to usb I get 4 ttyUSBx
EC25 GSM modem, for this also same case. when I connect I get 4 ports.
How do I assign a static name to all of them?
I have used bellow method but no result.
SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", SYMLINK+="ttyUSB_EC25_Modem_%s{devpath}"
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea71", SYMLINK+="ttyUSB_CP2108X_%s{devpath}"

Connect the devices and look under /dev/serial/by-id/. You should have symlinks to these ttyUSBx devices with longer and more descriptive names. No need to use udev rules.

Related

What is bluez "bluetoothctl scan on" (StartDiscovery) doing that "hcitool lescan" is not

I see its adding a file to /var/lib/bluetooth/hci MAC/cache/ for each discovered device with its name as the address. Documentation says its creating device objects. Where and what are they, virtual dbus objects? ( ex: /dev_F8:41:1B:6B:95:2A). I know the device is removed after 3 minutes if not connected. And what else is it doing to make a device available for connecting with the bluez dbus interface. Thanks.
Bluetoothctl uses the Bluez DBus apis to do everything it does. When you do 'scan on' in bluetoothctl, it will call the StartDiscovery method of the Adapter object. Internally the Dbus will use the HCI interface to start a lescan. Once advertisement come in, Bluez will create objects for them on the Dbus and will send an InterfaceAdded or PropertiesChanged signals on the Dbus. Your application can listen to those signals which contain the address of the objects they are about.

What's the difference between Jackdaw and KillerBee on RZ Raven USB Stick

What is the difference between Jackdaw and KillerBee on ZigBee USB Stick, both seem to be sniffing packet, but Jackdaw can act as a network interface, and KillerBee is only used for pentest? As far as I understand it, you can't use either to connect to like a hub or Wireless router, but only to ZigBee based devices, which would be the IoT devices such as sensors or smart socket etc.
Thank you

Determine USB device file Path

How can i get USB device file path correctly in Linux.
I used command: find / -iname "usb" and got the result as below:
/dev/bus/usb
/sys/bus/usb
/sys/bus/usb/drivers/usb
/sys/kernel/debug/usb
Under /dev/bus/usb i see:
001 002 003 004 005 006
But I think they aren't files as i need.
Under /sys/bus/usb/devices/:
sh-3.2# ls /sys/bus/usb/devices/
1-0:1.0 1-1:1.0 3-0:1.0 5-0:1.0 usb1 usb3 usb5
1-1 2-0:1.0 4-0:1.0 6-0:1.0 usb2 usb4 usb6
And Under /sys/bus/scsi/devices/ when i pluged an USB i see:
2:0:0:0 host0 host2 target2:0:0
And when i removed USB i see:
sh-3.2# ls
host0
So which device file is used for USB? How can i indentify it? I need to make a C program with USB device file...
Further more, could you explain to me the number 1-1:1.0? What does it mean?
Thank you.
So which device file is used for USB? How can i indentify it?
What you see behind /sys/ is mainly configuration/information about devices. /dev/bus/usb is what you are looking for. I think that the following article can help you
http://www.linuxjournal.com/article/7466?page=0,0
Is quite old, but still it can help you. (In the article they speak about /proc/bus/usb, today we have /dev/bus/usb)
Further more, could you explain to me the number 1-1:1.0? What does it mean?
The generic form is
X-Y.Z:A.B
Each field identify the connection point of your device. The first two field are mandatory:
X is the USB bus of your motherboard where is connected the USB system.
Y is the port in use on the bus system
So the USB device identified with the string 3-3 is the device connected on the port 3 of the bus 3.
If you connect an USB hub, you are extending the connection capability of a single USB port. The Linux kernel identify this situation by appending the Z field.
Z is the port is use on an hub
So, the USB device identified with the string 1-2.5 is the device connected on the port 5 of the hub connected on the port 2 of the bus 1.
USB specification allow you to connect in cascade more then one USB hub, so the Linux kernel continue to append the port in use on the different hubs. So, the USB device identified with the string 1-2.1.1 is the device connected on the port 1 of the hub connected on the port 1 of the hub connected to the port 2 of the bus 1.
A fast way to retrieve these information is to read the kernel messages (if you can).
$ dmesg | grep usb
[... snip ...]
[ 2.047950] usb 4-1: new full-speed USB device number 2 using ohci_hcd
[ 2.202628] usb 4-1: New USB device found, idVendor=046d, idProduct=c318
[ 2.202638] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.202643] usb 4-1: Product: Logitech Illuminated Keyboard
[ 2.202648] usb 4-1: Manufacturer: Logitech
[... snip ...]
Then, the last two fields of the pattern (after colon) identify an internal section of an USB device :
A is the configuration number of the device
B is the interface number of a configuration
So, the string 4-1:1.1 means: the interface 1, on configuration 1 that is connected on the port 1 of the bus 4.
You can retrieve these information with the command lsusb.

How to Find the dev path in which usb device is connected?

I have connected two data cards in my server. One is connected in port dev/ttyUSB2. I want to find the other's port.
There are four ports
ttyUSB0,
ttyUSB1,
ttyUSB2,
ttyUSB3.
I already tried lsusb -vv and found out this:
Bus 001 Device 005: ID 19d2:2003
You can look it up in dmesg logs
dmesg|less

USB Keyboard Protocol

I am trying to build an HID keyboard. I got my STM32 MCU to recognize as a keyboard, but for some reason when I try to send the HID report (8 bytes) using Endpoint 1 in Interrupt mode. The host side doesn't get the data(key pressed) . Do I need to use the standard method Get_Report ?
I have also tried another implementation on a AT90USB1287. It works well but for some odd reason I must set the endpoint to 3 in order to get it working.
i am wondering if the USB HID keyboard protocol only looks at end point 3 when getting data?
The USB HID (keyboard) protocol uses the endpoint you specify in your USB descriptor. Look at the Endpoint address in the Endpoint descriptor.

Resources