usbdrivedetector

package module
v0.0.0-...-ea439de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2022 License: MIT Imports: 7 Imported by: 12

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.

Documentation

Overview

Package usbdrivedetector detects all USB storage devices connected to a computer. It currently works on OS X and Linux.

Source code and other details for the project are available at Github:

https://github.com/deepakjois/gousbdrivedetector

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect() ([]string, error)

Detect returns a list of file paths pointing to the root folder of USB storage devices connected to the system.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL