Sign in to follow this  
Followers 0
chenni

How to detect removable disk is USB 2.0 or USB 3.0?

7 posts in this topic

How to detect removable disk is USB 2.0 or USB 3.0?

 

Share this post


Link to post
Share on other sites



i suppose you could write a test file and measure the transfer speed.  Even the slowest usb3 device should hit 500MB/s, which would be faster than any USB2.0 device.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Hi

measure test  Spend too much time. I would like to get bcdUSB field .I don't know how to get bcdUSB ? like USBDeview.exe

USB.png

The bcdUSB field is a hexadecimal number that will indicate the highest USB version the device supports in a packed-decimal format:

0x0100 = USB 1.0
0x0110 = USB 1.1
0x0200 = USB 2.0
0x0300 = USB 3.0

 

#include <WinAPIFiles.au3>
$var2 = DriveGetDrive("REMOVABLE")

;Get Lable

Local $sLabel = DriveGetLabel($var2[1] & "\")
Local $sLabe2 = DriveGetLabel($var2[2] & "\")

;Get bcdUSB  ???

 

 

 

Share this post


Link to post
Share on other sites

First you have to identify a USB 3 port.
Then you can do a speed test on the USB 3 port.

I had written a CMD script to measure transfer times.

Just copy the CMD file to the USB 3 device and click on it.

The script measures the transfer time of a 128 MB file and shows the result.

The result is also logged to the end of the CMD file.

@echo off
call :DriveInfo
set Drive=%_drive%
set Home=%USERPROFILE:~0,2%
set f=%~nx0
echo:&echo: Running %f% on drive %drive% (%_volume% %_serial%) at %date%  %time%
set log=%COMPUTERNAME% %USERNAME% %drive% (%_volume% %_serial%) at %date% %time%

%home% & del /Q %temp%\%f% >nul  2>&1 & md %temp%\%f% >nul  2>&1 & cd %temp%\%f% >nul  2>&1
echo:&echo: Creating   %f%.bigfile.txt   in temporary directory.
echo: Time before file create: %Time%

echo  This is a very very lange file.  You can delete it. Thanks.  >~
copy ~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~ ~~ /b >nul  2>&1 & del ~ & ren ~~ ~ >nul  2>&1 & rem dir *.*|find "~"
copy ~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~ ~~ /b >nul  2>&1 & del ~ & ren ~~ ~ >nul  2>&1 & rem dir *.*|find "~"
copy ~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~ ~~ /b >nul  2>&1 & del ~ & ren ~~ ~ >nul  2>&1 & rem dir *.*|find "~"
copy ~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~ ~~ /b >nul  2>&1 & del ~ & ren ~~ ~ >nul  2>&1 & rem dir *.*|find "~"
:: 64 MB created
copy ~+~ ~~ /b >nul  2>&1 & del ~ & ren ~~ ~ >nul  2>&1 & rem dir *.*|find "~"
:: 128 MB created
ren ~ %f%.bigfile.txt
echo: Time after  file create: %Time%
dir %f%.*|find "%f%."
REM ~ echo:xN | choice  >nul  2>&1

echo:&echo: Copying   %f%.bigfile.txt   from temporary directory to %drive%


del %drive%\%f%.bigfile.txt >nul  2>&1
set t1=%time%
echo: Time before file copy to %drive%  %t1%
copy %f%.bigfile.txt %drive%\%f%.bigfile.txt >nul  2>&1
set t2=%time%
echo: Time after  file copy to %drive%  %t2%
call  :TimeDiff "%t1%" "%t2%" diff
echo:                    Duration  %diff%
set log=%log% Diff: %diff%
dir %drive%\%f%.*|find "%f%."

del %drive%\%f%.bigfile.txt >nul  2>&1


del %drive%\%f%.bigfile.txt >nul  2>&1
set t1=%time%
echo: Time before file copy to %drive%  %t1%
copy %f%.bigfile.txt %drive%\%f%.bigfile.txt >nul  2>&1
set t2=%time%
echo: Time after  file copy to %drive%  %t2%
call  :TimeDiff "%t1%" "%t2%" diff
echo:                    Duration  %diff%
set log=%log% %diff%
dir %drive%\%f%.*|find "%f%."

del %drive%\%f%.bigfile.txt >nul  2>&1


del %drive%\%f%.bigfile.txt >nul  2>&1
set t1=%time%
echo: Time before file copy to %drive%  %t1%
copy %f%.bigfile.txt %drive%\%f%.bigfile.txt >nul  2>&1
set t2=%time%
echo: Time after  file copy to %drive%  %t2%
call  :TimeDiff "%t1%" "%t2%" diff
echo:                    Duration  %diff%
set log=%log% %diff%
dir %drive%\%f%.*|find "%f%."

del %drive%\%f%.bigfile.txt >nul  2>&1


echo:xN | choice  >nul  2>&1

cd .. & rd /Q /S %temp%\%f%  >nul  2>&1
echo:&echo: End of %f% &echo:&echo:
set log=%log:00:=%
echo: %log%
echo: %log%>>%~f0%
pause
goto :eof

:DriveInfo
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set _dr=%~1%cd%&set _dr=!_dr:~0,1!:&FOR /f "tokens=1-5*" %%a in ('vol !_dr! 2^>nul') do (set _s=%%b&set _v=!_v!%%f&set _z=!_z!%%d)
endlocal&set _drive=%_z%&set _volume=%_v%&set _serial=%_s%&goto :eof

:TimeDiff
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set _dc=%~1&set _dc=!_dc:~-3,1!&set _i1=%~1&set _i1=!_i1: =0!&set _i2=%~2&set _i2=!_i2: =0!
for /F "tokens=1-4 delims=:.," %%a in ("%_i1%") do (set /A "_c1=((((1%%a %% 100)*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100")
for /F "tokens=1-4 delims=:.," %%a in ("%_i2%") do (set /A "_c2=((((1%%a %% 100)*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100")
set /A _d=((_c2-_c1)+ 8640000)%%8640000, _h=_d/360000, _m=(_d-_h*360000)/6000, _s=(_d-_h*360000-_m*6000)/100, _c=(_d-_h*360000-_m*6000-_s*100)
set /A _h=_h+100, _m=_m+100, _s=_s+100, _c=_c+100
endlocal & set %~3=%_h:~1,2%:%_m:~1,2%:%_s:~1,2%%_dc%%_c:~1,2%& goto :eof

**************************************************************************
:Summary
**************************************************************************

 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites
40 minutes ago, chenni said:

measure test  Spend too much time

ummm, I have bad news if you came here looking for speed.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I cant test because i dont have any USB devices around , but shouldn't  the info be stored somewhere here ?

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0