Linux Symbolic Link to USB device not working - symlink

On my Raspberry Pi I am trying to create a symbolic link for a device plugged into the USB port. I have done this before and it worked just fine, but recently I re-flashed the Pi's SD card to start from a clean slate again and now the Symbolic link does not work. I can see it in (/dev/GPS), but when I go to use it nothing happens. To the best of my knowledge I have set it up in exactly the same way. More info on the setup below.
The device in question: Its a Ublox 6M GPS connected to the PI's USB via an FTDI. Because the Pi can assign the FTDI to either /dev/ttyUSB0 or /dev/ttyUSB1 as it sees fit at boot, I need to assign it a symbolic link so my program can always find it irrespoective of what name the OS wants to give it.
So I followed the instructions here to set up the symbolic link. I added the following line to /etc/udev/rules.d/10-local.rules.
ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="GPS"
These are the same instructions I followed originally (pre SD card re-flash) and they worked just fine, but now it doesn't work. I have tested the GPS/FTDI by using its OS assigned name and I can get GPS data out, but when I use my symbolic link name it does't work. So that is where the problem seems to be. I've triple checked the idVendor and idProduct values for the FTDI using
udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
Any ideas? Alternative solutions are welcome.
Thanks,
Ben

I think I've found a solution, but not the answer to the specific question. I still don't know why the above it not working, but I have found that I don't need to create my own symbolic links. The system creates is own in /dev/serial/by-id/. These seem to be working OK for me.

Related

M300 OSDK - drone version not obtained

Since I cannot get the manifold 2 in my region, I created a cable according to https://forum.dji.com/forum.php?mod=viewthread&tid=219723.
The cable is connected via FTDI converter directly to the drone's OSDK port.
when connected to a serial terminal application I get data from the drone
Terminal
When I try to debug the flightcontrol-sample in Linux, I get the following:
LinuxOutput
Data is also received in Linux using 'screen' command.
testing the cable for 'loopback' works fine.
I have changed the port baud rate to several options (230400 & 921600) to no avail.
the ACM cable is connected through an additional USB port to the drone's port directly.
Am I missing some HW components in my setup?
I have entered all the relevant Linux commands to get the required permissions as advised in
https://developer.dji.com/onboard-sdk/documentation/quickstart/development-environment.html
&
https://developer.dji.com/onboard-sdk/documentation/quickstart/run-the-sample.html
Am I missing something in that department?
The final goal is to use STM32 as FC, but testing is easier using the Linux environment.
Any additional things I can test?
Are there other working setup designs I can try?
Thanks for your help.
i got M300 osdk connection up at Apr 2020.
So far not many issues. There are many tricks and rules that you need to follows e.g osdk adapter board usb type C seam side face inside. make sure osdk adapter board is powered up by checking the output supply voltage. 3.3V FTDI. and make sure it is pull up properly by checking voltage as well
After you check through the hardware.
the software has many tricks as well. for M300 only osdk/osdkros 4.0 and above can drive. The new userconfig.txt format changed and you have to change accordingly. and you can go through my checklist which I posted on DJI forum https://forum.dji.com/forum.php?mod=viewthread&tid=216529
If you really still have a problem. do provide photos on your connection, the terminal output for the error message.
As Dr. Yuan suggested, have a look at the UserConfig.txt file. Depending on which OSDK version you are using, it has a different format.
In my case, using osdk 3.9 configuring it this way solved my issues:
app_id : xxx (number)
app_key : xxx (number)
device : /dev/ttyUSB0
baudrate : 230400
Also check your FTDI cable, it once burned out for me and it was the reason for this error too. You should try a new one just in case.
I use the OSDK with a raspberry pi, in case you are using this kind of linux environment, I suggest you check the configuration files (cmdline.txt and config.txt) doing sudo nano /boot/cmdline.txt and same for config.txt.
my configuration for cmdline.txt is:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
And for config.txt just add this at the end:
enable_uart=1
init_uart_clock=64000000
start_x=1
I hope these can help and that I am not too late.

Getting the battery level of a Bluetooth headset on Mac OSX

I would like to know if it is possible to get the battery level of a connected Bluetooth device (for example, a headset) on Mac OSX.
I'm looking for a command line or a library that would offer this possibility.
Thanks.
There is no easy way to get this information without special application.
There is an app especially designed for this only purpose - called AKKU.
It worked with Bose and Sony's headphones (checked)
https://github.com/jariz/Akku/
Remember to download version 0.1.0-beta.10.
The app works after restart.
Just follow this guide: http://osxdaily.com/2014/05/18/how-to-check-bluetooth-keyboard-battery-levels-from-the-command-line-on-mac-os-x/
Basically:
You just need to know the name of the device and then use ioreg, like this:
ioreg -c <devicename> |grep '"BatteryPercent" ='
Additionally, you could retrieve broader battery information with:
ioreg -c BeatsBluetoothHeadset |grep Battery
Next time, just google ... Since a similar question was already answered https://apple.stackexchange.com/questions/215256/check-the-battery-level-of-connected-bluetooth-headphones-from-the-command-line

Download program into AVR chip with FTDI4232

Background info
WinAVR:
I installed WinAVR, and use avrdude.exe comes with WinAVR to download program into our board.
Adapter card:
We have an adapter card with FTDI4232 and AVR m328p on it. PC connects to FTDI4232 with a micro USB cable.
Schematic:
Sorry, I cannot post pics. So just describe the major part of schematic here. Two wires from(DATA_P & DATA_N pins) out from macro USB connector to DP[pin8] and DM[pin7] on 4232. And four wires(SCK, MOSI, MISO, SS_N) out from 4232 to m328p.
How to download program into the card before: Via pocket programmer. But we cannot give one pocket programmer to every engineer, so try to find out a way to download the program into m328p. Coz we have already had FTDI4232 on board, so this seems to be the best choice.
Can I download program via FTDI4232 on adapter card?
I know there is dedicated programmer based on 4232 chip, but this is our own design, I am not sure we can do it or not according to the above schematic.
what I did
Run this command:
C:\WinAVR-20100110\bin\avrdude.exe -c 4232h -p m328p -U flash:w:\Desktop\work\a_card\WinAVR\blink\blink.hex:i
But got the following error:
avrdude.exe: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
Then, download the compiled libftdi package from this link:
https://code.google.com/p/picusb/downloads/detail?name=libftdi1-1.0_devkit_mingw32_17Feb2013.zip
, and extract it as “compiled_libftdi”.
There is not too much info about how to use this compiled package, so I just found info online.
(1) I installed WinUSB driver for the first two ports of 4232 by Zadig. I can choose one port in the drop down menu, then choose “WinUSB(v6.1,7600…)”, “Install WCID Driver”.
(2) Then, enter into the “compiled_libftdi” folder, run “find_all”, I saw:
Number of FTDI devices found:1
Checking device: 0
Manufactureer: FTDI, Description: USB <-> Serial Converter
I think it means the USB driver for libftdi package installed successfully.
Run the above download command again, still failed.
I thought maybe because the avrdude.exe is out of date. So download a .exe from here:
http://download.savannah.gnu.org/releases/avrdude/avrdude-6.0.1-mingw32.zip
And replace the old one in the WinAVR folder.
Still got the error, but got one extra line info:
avrdude.exe: programmer operation not supported

Why isn't my USB-To-Serial Adapter Working?

I have a USB-to-Serial Adapter that is being recognized on my Mac in the System Information as being connected to the USB Hub but when I run ls /dev in Terminal the usbserial is not showing up. It was working up until this morning but now it is not. I have tried rebooting, changing USB slots and the lot. Any suggestions?
So after doing some research I have found that the Prolific driver that is designed for the USB-to-Serial adapter is a little unstable. Therefore I used a third party driver that seems to have fixed the problem 100%. You can find it here, http://xbsd.nl/2011/07/pl2303-serial-usb-on-osx-lion.html, I recommend it even if the Prolific driver seems to be working okay.
This problem is arising almost every time in windows. and as a solution we go to devise manager->other device->right click on that->update driver software->browse my computer for driver software->Let me pick from a list of device drivers on my computer-> USB controller-> next.
Here my suggestion is to delete the driver from is the place and try to reboot you pc once and then check for the results. hope you get ride of this, best of luck.

Find out if USB device is connected. Ruby in Linux

I'm using Ruby 1.8 and linux (Ubuntu and SLAX), and i need to write a script in ruby which finds out if some specific usb device is connected to the system and on which USB port (0,1,2, etc). It was done before with the help of HAL (hal-find-by-capability --capability serial), but now i can't use this approach. I was trying to read /var/log/messages file trying to find the number of the usb port, but it appears that this number may not be written in some systems. Other thing i tried is to check /dev folder and search for ttyUSB# file, but it doesn't appear on some system when new device connects to USB.
I would appreciate any ideas how to do this.
lsusb is a linux command for displaying your usb hubs and listing the devices that are connected to them. In ruby I believe you'd be able to do something like this:
ls_results = `lsusb`
You should be able to parse that for whatever device you're looking for.
I'm sorry that I couldn't provide you an ruby sample. I had the same problem in C / C++ (QT). You can find my snippet here:
http://www.known-issues.net/cpp/how-to-detect-if-dev-is-a-usb-device.html
You have libusb ruby bindings which allow to control usb devices.

Resources