Easy way to do USB detection in Python for windows
You need to use 'from ctypes import windll' for WinAPI.
Easy way to do USB detection in Python for windows
While this is useful, it's very sloppy. I feel this would be much better received if it were cleaner. Functions should be something like_this instead ofThis. Words should be fully spelled out so it's readily apparent what it means and does. Just a suggestion.
Dear @Ming-Shu,
I landed on this repo hoping to get precisely what it announced: detection of USB plug-in. Your title says nothing of disks, but all it does is detect USB disks. I am trying to detect an Intel RealSense camera, which is clearly not storage and therefore doesn't get a drive letter.
Another highly misleading issue on the title is the detect part. Clearly English is not your native language, because when you announce detection of USB plug-in, you are saying that you detect the act of plugging in a USB device.
You do not do this, though. What you do is a polling spin scan on drives plugged. Polling is sooooo 1988 it hurts. I know, because I was already writing code then. Speaking of Jurassic Code, Python 2 was put to rest on New Year's Day 2020. print
is now a function, in case no one told you. I swear Github should have a filter for Python 2 code, possibly brown.
And the argument that "Well, it works." falls through the cracks of polling interval, or CPU usage, among others. Threading would address this, if the GIL were not preventing real threading in pure Python.
All in all, perhaps a less alluring title, such as How-to-list-USB-plugged-in-disks-on-Windows would do this piece of code a bit more justice, while preventing people in search of true event notification from ending up in this dead end.
Thank you for wasting my time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.