Code Monkey home page Code Monkey logo

how-to-detect-usb-plug-in-on-windows-using-python's Introduction

How-to-list-USB-plugged-in-disks-on-Windows-using-Python2

Easy way to do USB detection in Python for windows

You need to use 'from ctypes import windll' for WinAPI.

how-to-detect-usb-plug-in-on-windows-using-python's People

Contributors

ming-shu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

how-to-detect-usb-plug-in-on-windows-using-python's Issues

Clean up sloppy code, syntax, non PEP8 statements

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.

Misleading title

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.