USB Device/PyUSB on Windows and LInux behaving differently - python

I have a device with USB interface which I can connect to both my Ubuntu 18.04 machine and my Windows 10 machine. On Windows 10 I have to install the CP210x driver and manually attach it to the device (otherwise Windows tries to find the device manufacturer's driver - it's a CP210x serial chip), and in Linux write the vendorID and productID to the cp210x driver to allow it to attach to ttyUSB0. This works fine.
The Windows driver is from SiliconLabs - the manufacturer of the UART-USB chip in the device.
So on Windows it is attached to COM5 and Linux to ttyUSB0 (Ubuntu, Raspbian)
Using Wireshark I can snoop the usb bus successfully on both operating systems.
The USB device sends data regularly over the USB bus and on Windows using Wireshark I can see this communication as "URB_INTERRUPT in" messages with the final few bytes actually containing the data I require.
On Linux it seems that the device connects but using Wireshark this time I can only see URB_BULK packets. Examining the endpoints using pyusb I see that there is no URB_Interrupt endpoint only the URB_Bulk.
Using the pyusb libraries on Linux it appears that the only endpoints available are URB_BULK.
Question mainly is how do I tell Linux to get the device to send via the Interrupt transfer mechanism as Windows seems to do. I don't see a method in pyusb's set_configuration to do this (as no Interrupt transfer endpoints appear) and haven't found anything in the manufacturer's specification.
Failing that, of course, I could snoop the configuration messages on Windows, but there has to be something I'm missing here?

Disregard this, the answer was simple in the end: Windows was reassigning the device address on the bus to a different device.

Related

USB CDC read using python

I have used usb communication in renesas microcontroller, I am able to get USB CDC as com port in my device manager of laptop running on windows 10, I am trying to read and write on this port using pyserial python but I am not able to open port, every time it shows exception that no such device there or permission error. Please provide me the solution.

How to capture the traffic of an Android device in Python?

I want to capture traffic of a particular Android device using a Python script. I am doing the same thing for a laptop using "pyshark" that monitors the real-time traffic of laptop for a specific time and then creates a pcap file for it. I want to do the same thing for my Android device. I have tried Tcpdump, scapy and packetsniffer but nothing helped me in capturing the traffic of my Android device.
Ideally I want an analyzer (a python script) that should run in such a fashion that when it is turned on, it continuously monitors the traffic of my Android device. I will have to make something similar to a proxy server but i am stucked how to do it.
pyshark usage for my laptop
Does your program run with the necessary rights at all? Under Linux and Windows a program needs extended rights to open raw sockets, which are necessary for sniffing. Under Windows there must be some group policy XY setting (I don't know Windows), under Linux the program needs root rights.
I don't know about such a policy too. But in the scenario displayed in the picture attached, there is no need for socket programming. I am also okay with passive sniffing.

USB-to-serial driver for Linux

I have a USB device that I need to control in Linux using Python and serial commands, it works with ASCII commands.
In Windows it works fine after I install the vendor driver and in Device Manager I see it as a COM3 port and I communicate using pyserial or pyvisa modules.
In Linux I see it as /dev/ttyUSB1 but I cannot communicate with it using pyserial or pyvisa. The problem is that the vendor doesn't provide Linux drivers.
How am I able to get the device behave as a serial port in Linux?
try python -m serial.tools.miniterm /dev/ttyUSB1 and read the issue on https://github.com/pyserial/pyserial/issues/67 especially the version of pyserial
if this issue is related to yours possibly this also works :
Managed to bypass this issue by passing dsrdtr=True and rtscts=True to
serial.Serial() ... as described here
your device is based on an FTDI chip, the inbuilt linux kernel module for this is ftdi_sio and usb_serial see http://www.ftdichip.com/Support/Documents/AppNotes/AN_220_FTDI_Drivers_Installation_Guide_for_Linux.pdf

How to establish serial connection with Bluetooth device on Win7

I am really frustrated and have no idea where to search for an answer.
Currently I am working on a project to detect drowsiness with an ECG device (Zephyr Bioharness 3). The device works but I can't find it with windows (For example like this). I tried several things:
Find the device with my Smartphone -> works
Find the device with an Ubuntu on the same Laptop -> works
Connect directly on Win7 via Bluetooth with this Python Script: Gist -> connects and sends data
Find other Bluetooth devices with my Laptop on Win7 -> Bluetooth radio is dound
COM port for (virtual) serial connection to a bluetooth device (device manager)
What I am trying, is getting this script to work: ZephyrApp. Beside some compatibility problems with QT and serial (which I was able to fix), the programm hangs here protocol.py. I suspect the problems of not finding the device relates to the problems with the program. I know this is very special case, but hope anyone has an idea, how to fix this.
Regards,
paul
EDIT: Another PC with Win7 can't detect the device as well, it seems it is a Windows problem.
The device can't be detected with Win7, but I found a way to connect via bluetooth directly: https://gist.github.com/darkopetrovic/2127217

List connected Bluetooth LE devices to Windows 8 with python

I want to be able to read out information about connected Bluetooth Low Energy HID devices in Windows 8. My main application uses Qt, but I thought it could be much easier to get help from a Python script. Since Windows 8.1 supports Bluetooth Low Energy natively, I connect my mouse to it and tried using the pywinusb package, but it doesn't seem to be able to read out this wirelessly connected device, only connected HID devices.
How can I read out information about my BLE device with Python?

Categories