I have a small USB device from Windows XP times. It receives a sea weather report on a special frequency and transmits it in text form. This requires a program and driver that only runs on Windows XP. (Old Page here: http://www.navichart.com/wettermaus.htm)
I would now like to try to get the device running with python3 under Linux in order to later turn it into a raspberry project.
The device is recognized by Linux:
lsusb results in:
Bus 001 Device 016: ID 0403: f9d9 Future Technology Devices International, Ltd NAVCODE weather mouse
I opened the Device and found some Chips on it: FTDI FT232BM, Atmel ATMEGA8L and some others, smaller ones.
For this reason I thought it might be possible to access the device with pylibfdti and read the weather report.
I proceeded here according to:
https://pylibftdi.readthedocs.io/en/latest/installation.html
But if I try the following code I only get an empty list and nothing to print.
#!/usr/bin/env python3
import sys
import pylibftdi
print(pylibftdi.Driver().list_devices())
Results in
[]
I checked in a VirtualBox running Windows XP: The old programm and the USB-Devive are working normal.
I have no experience with programming such chips and i have no other device to check wether i made an mistake.
Do I have a "mistake in my thoughts" and my project cannot work at all?
Thanks for your advice.
F.E.
Related
I am stuck at a very unusual problem. I am making a project in which i am using two USB ports of RaspberryPi for attaching a GPS module and a S2 Xbee. The code of python i am using is using both the GPS and the S2 Xbee. The biggest problem i am facing is whenever i switch off my raspberryPi and start it again, the ports gets interchanged. Basically, for GPS i am using USB0 and for Xbee i am using USB1, but they gets interchanged.
Please suggest me some solution. I searched a lot but could not find much.
Each USB device has a unique vendor id and product id combination. The command 'lsusb -v' or 'udevadm info --query=all -n /dev/bus/usb/001/00x' x = [1..4] on raspi, will identify the device name where they are mounted by the raspi.
Here is another way without starting linux commands from python:
Simple way to query connected USB devices info in Python?
I just got a wifi pineapple nano, and have been a longtime raspberry pi enthusiast, so I'm super stoked to start joining the two. I've already got it connected to my Pi and have played around a bit with the setup. My specific curiosity right now is whether it's possible to write a program to perform GPIO tasks on the raspberry pi based on events occurring on a wireless LAN broadcast by the pineapple. An example would be to turn an LED on if a specific MAC address is detected, and said client is within some power threshold. My lack of knowledge at this stage is how the pineapple fits with the pi (or any other "host" for that matter).
Specifically, do I write my program (probably python, and later some html and JavaScript served over flask) and host it on the pi? If so, how does it interact with the pineapple to get the MAC address and connection power dB? If not, do I host it on the pineapple? If so, how does the program interact with the pi to utilize its GPIO pins? How would I compile my code so that the pineapple can use it? Are there modules already available that can get me most of the way to my goal?
I don know Pineapple Nano very much, but I found, there is an API with module Tracking.
API You should be able to set script which will run when client with specific MAC address connect to AP. In script you can call some method API/Flask on your Pi.
Next solution can be gpiozero library, which has module pingserver doc,
where you can checking some URL if is online. If you set on your AP static IP addresses for clients you want to track, you can use this module to determine, if is online (connected) or offline (disconnected)
example:
from gpiozero import PingServer, LED
from signal import pause
client= PingServer('192.168.0.155')
led = LED(4)
led.source_delay = 60 # check once per minute
led.source = client.values
pause()
In this example, when client with IP address 192.168.0.155 go online, LED will turn on.
Maybe it will help you.
Peace
I'm trying to develop a USB board that can connect to the computer as a HID device and talk to a Python application I'd write. I want to use Python and I went with a HID device to be driver free.
This seems like a great solution until I ran into lilbusb-win32. After working with it for a bit it looks like I have to create an INF file for my USB device. I've read that the INF recognizes the USB device's IDs (VID and PID). Wouldn't this mean every single device would need to ship with its own INF file basically negating the idea of being driver free with HID in the first place?
Would Libusb-win32 and PyUsb allow me to create a program to talk to any board as long as they were all the same HID devices (just having different product id's)? If so, do users need to download the INF with my program?
This seems to defeat the purpose of going with HID in the first place.
I have a device with a built-in USB/Serial adapter (shows up as a Prolific PL2303). The device documentation provides full details on how to communicate with it, and provides a sample Windows app. However, I need to use it on Linux - ideally with Python but I'm not too precious about that.
The device docs state the device runs at 9600, 8N1 with half duplex. The Windows app works fine - device works fine (so I know it's not a device problem). However, I can't communicate with it using Python on Linux. I'm using pySerial, and I've tried a similar (full duplex, also PL2303) device which works fine.
I've tried several combinations of setting xonxoff, rtscts etc. I've also tried RTS toggling using setRTS(True) and checking for CTS and DSR etc - gets all return False. I can successfully open the device using pySerial (I can see activity light flashing - simple but effective test) and pySerial complains if you unplug it during reads/writes.
Doesn't seem to matter what flags/lines I set or what data I send, always get the same result.
>>> s=serial.Serial()
>>> s.port('/dev/ttyUSB1')
>>> s.open()
>>> s
Serial<id=0x7fe94b533b50, open=True>(port='/dev/ttyUSB1', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=3, xonxoff=0, rtscts=0, dsrdtr=0)
>>> s.write('\2CMD2292\r')
>>> s.inWaiting()
0
>>> s.setRTS(True)
>>> s.getCTS()
False
(several iterations of above with different flags).
Ignore the data in the write command - that's just a status check command. Doesn't matter what goes there, the device should either respond with an answer or an error.
I've even resorted to closing and re-opening the device in between setting various ctsrts flags etc., and unplugging / replugging it to force resets. As above it continues to work fine using the Windows test app. I can't use Portmon etc. to sniff the Windows port traffic as it's a 64bit Win7 install and I don't currently have time to build an XP machine.
Any thoughts?
UPDATE: I've also tried all of the above using Python on the same Windows box that the demo app works on. It definitely opens the port and communicates, but again no info back regardless of what's written.
UPDATE2: It looks like it might be device-driver related. Some additional background research suggests that some PL2303 chips have functionality to support half-duplex, but this isn't supported by the Linux drivers. The Windows demo app comes with a dedicated device driver and the app doesn't work on a clean test machine using default Windows drivers. This makes me think that while I can connect to it successfully through Python, I can't control the duplex comms (e.g. even in an STX/ETX way) and therefore this might be a hopeless case. sigh.
UPDATE3: Thanks for the comments below. However, I couldn't find any way round this. I tried a USB protocol analyser, and I tried disassembling the driver but it just became rather time-consuming, so in the end I took the device apart and after some tinkering I managed to replace the existing usb-serial adapter with a proper PL2303 part - on the device side, it was just a basic 2-wire serial interface so it didn't care what was talking to it. I can't seem to close this question so I'll leave it as-is.
Try
s.flush()
just after your s.write call
I am using an RS232 Serial - USB Converter to connect to a controller. I am trying to connect to this port programmatically.
The device is getting listed as below when I give lsusb
Bus 003 Device 003: ID 05ad:0fba Y.C. Cable U.S.A., Inc.
But I am not able to see it's device path (something like /dev/ttyUSB*).
I would like to know the way to get the path from device id (or) a way to create / find the path which can be used to open the port from a program (Ruby, Python, C)
Centos has a fairly old kernel. It may be lacking in support for your device.
Are you able to try with a newer distribution (Fedora, Ubuntu, etc) to test whether it works or not? Failing that, do you have a different dongle you can use?
You can Google for "Centos 05ad:0fba" or similar combinations to find out whether it's supported.