Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: Operation not supported or unimplemented on this platform #375

Closed
TitouanLabourdette opened this issue Jun 28, 2021 · 6 comments
Labels

Comments

@TitouanLabourdette
Copy link

Hi.

I'm in an internship and I want to read the USB port to see the type of data transiting. Ideally, I want to be able to both send and receive USB packets.
I'm trying to read on a port with the .read() method but I have this error popping up :

NotImplementedError: Operation not supported or unimplemented on this platform

I don't understand what could be the problem. Everything is up to date, I use the latest version of Python and Spyder, on Windows 10.

The code is as follow :

import usb.core
import usb.util

# find our device
dev = usb.core.find(idVendor = 0x152D, idProduct = 0x0576)
# was it found?
if dev is None:
    raise ValueError('Device not found')
else:
    print(dev)
    dev.read(0x81,100)
@jonasmalacofilho
Copy link
Member

I'm in an internship and I want to read the USB port to see the type of data transiting.

Using a USB traffic analyzer is probably more appropriate for that job. There are hardware options, but so far I've been able to get by with software-only tools like Wireshark.

(Technically Wireshark doesn't actually capture the data, only displays it, but searching for "Wireshark + USB + [operating system]" should help you get started).

I'm trying to read on a port with the .read() method but I have this error popping up :

Most likely, the driver that is installed for that device isn't compatible with libusb. Their FAQ has more information on using it with Windows.

@TitouanLabourdette
Copy link
Author

Using a USB traffic analyzer is probably more appropriate for that job. There are hardware options, but so far I've been able to get by with software-only tools like Wireshark.
(Technically Wireshark doesn't actually capture the data, only displays it, but searching for "Wireshark + USB + [operating system]" should help you get started).

I know of Wireshark and it really helped me to understand some things but I want to automatically read USB port to respond to certain data with a script now. I will look on Internet with the keywords you said.

Most likely, the driver that is installed for that device isn't compatible with libusb. Their FAQ has more information on using it with Windows.

I will check this then.

Thank you very much for your quick answer.

@mcuee mcuee added the question label Jun 28, 2021
@jonasmalacofilho
Copy link
Member

I want to automatically read USB port to respond to certain data with a script now.

In that case PyUSB is a suitable tool for the job after all.

@TitouanLabourdette
Copy link
Author

In that case PyUSB is a suitable tool for the job after all.

Well, yes, that was what I was trying to use in the snippet of code I wrote in my first post. But the problem is that once I have my device plugged in and found with the usb.core.find()'s method, I can't do dev.read() because it says Operation not supported or unimplemented on this platform and I don't understand why.

I followed the tutorial provided here : https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst

Maybe I have overlooked something ?

@jonasmalacofilho
Copy link
Member

I still think the most likely cause is that the installed driver isn't compatible with libusb.

Most likely, the driver that is installed for that device isn't compatible with libusb. Their FAQ has more information on using it with Windows.

@TitouanLabourdette
Copy link
Author

You were right, the port used were indeed not the same depending of the type of devices connected. I couldn't find any COM port because I used a hard drive. With another peripheral I finally got an open COM port.

Thank you very much for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants