SkillAgentSearch skills...

Gousbdrivedetector

Detecting USB Storage Drives in Go

Install / Use

/learn @deepakjois/Gousbdrivedetector
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Detecting USB Storage Drives in Go

GoDoc

Simple API to detect USB Storage device for Go. Works OS X, Linux and (with some issues, see note below) on Windows.

Usage

Check the example folder.

Issues with some USB flash drives on Windows

On Windows, we use the following command to detect removable media on the system:

wmic logicaldisk where drivetype=2 get deviceid

This checks for a special bit descriptor on the flash drive which indicates that the USB flash drive is a removable device. This should work as expected on most new flash drives. On some older drives, this bit may not be set leading to drives getting recognized as a local disk instead of a removable drive, which can lead to a false negative.

Credits

The code was inspired by USB Drive Detector, which is written for Java.

View on GitHub
GitHub Stars31
CategoryDevelopment
Updated7mo ago
Forks11

Languages

Go

Security Score

82/100

Audited on Sep 6, 2025

No findings