I need to clarify type of USB device. I donn't see differences between USB flash stick and USB HDD. On Windows and Linux I can find out type of device, but I don't know any approches to find out that on macOS. Can you help me?
Differences between USB Flash and USB HDD
what criteria do you want to use? What criteria are Windows and Linux using? You can find out if a disk is removable, and what connection method is used for it. Check out the IORegistry, use ioreg at the command line, or IORegistryExplorer from the developer tools. You can walk the IORegistry tree programmatically to pull out the details you may need. Also, why do you need to know? They're both mass storage devices...
It is bussiness goal to determine type of USB device. I have 2 devices, USB HDD and and USB flash stick:
"uid" = "USB:105825A2374556325444"
"kUSBSerialNumberString" = "575839314542374556325444"
"bDeviceClass" = 0
"bDeviceSubClass" = 0
"iSerialNumber" = 3
"Bus Power Available" = 450
"Built-In" = No
"AppleUSBAlternateServiceRegistryID" = 4294972871
"iProduct" = 2
"USB Serial Number" = "575839314542374556325444"
"USB Vendor Name" = "Western Digital"
"bNumConfigurations" = 1
"kUSBProductString" = "Elements 25A2"
"IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
"kUSBVendorString" = "Western Digital"
"USB Product Name" = "Elements 25A2"
"iManufacturer" = 1
"idVendor" = 4184
"Device Speed" = 3
"kUSBCurrentConfiguration" = 1
"idProduct" = 9634
"bcdDevice" = 4129
"non-removable" = "no"
"USB Address" = 2
"sessionID" = 19316584569713
"IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
"IOClassNameOverride" = "IOUSBDevice"
"PortNum" = 2
"bDeviceProtocol" = 0
"locationID" = 19005440
"IOGeneralInterest" = "IOCommand is not serializable"
"bcdUSB" = 784
"bMaxPacketSize0" = 9
}
{
"sessionID" = 19202157925367
"idProduct" = 1574
"iManufacturer" = 1
"bDeviceClass" = 9
"bMaxPacketSize0" = 9
"bcdDevice" = 1620
"iProduct" = 2
"iSerialNumber" = 0
"bNumConfigurations" = 1
"Bus Power Available" = 450
"USB Address" = 1
"Built-In" = No
"locationID" = 18874368
"bDeviceSubClass" = 0
"bcdUSB" = 784
"USB Product Name" = "USB3.1 Hub"
"PortNum" = 2
"non-removable" = "no"
"AppleUSBAlternateServiceRegistryID" = 4294972717
"bDeviceProtocol" = 3
"IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
"IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
"kUSBCurrentConfiguration" = 1
"Device Speed" = 3
"USB Vendor Name" = "GenesysLogic"
"idVendor" = 1507
"IOGeneralInterest" = "IOCommand is not serializable"
"kUSBProductString" = "USB3.1 Hub"
"kUSBVendorString" = "GenesysLogic"
"IOClassNameOverride" = "IOUSBDevice"
}
I don't see any fields to distinguish that two types of devices and determine which is USB flash stick and which is USB HDD. On Linux I can use Removable attribute to determine flash drive, on Windows it is DRIVE_FIXED (for HDD) type of disk.
Sry for mistake, flash description:
{
| | "uid" = "USB:090C1000119120002447"
| | "kUSBSerialNumberString" = "0361119120002447"
| | "bDeviceClass" = 0
| | "bDeviceSubClass" = 0
| | "iSerialNumber" = 3
| | "Bus Power Available" = 450
| | "Built-In" = No
| | "AppleUSBAlternateServiceRegistryID" = 4295145545
| | "iProduct" = 2
| | "USB Serial Number" = "0361119120002447"
| | "USB Vendor Name" = "Samsung"
| | "bNumConfigurations" = 1
| | "kUSBProductString" = "Flash Drive FIT"
| | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | "kUSBVendorString" = "Samsung"
| | "USB Product Name" = "Flash Drive FIT"
| | "iManufacturer" = 1
| | "idVendor" = 2316
| | "Device Speed" = 3
| | "kUSBCurrentConfiguration" = 1
| | "idProduct" = 4096
| | "bcdDevice" = 4352
| | "non-removable" = "no"
| | "USB Address" = 60
| | "sessionID" = 1761124863409195
| | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | "IOClassNameOverride" = "IOUSBDevice"
| | "PortNum" = 4
| | "bDeviceProtocol" = 0
| | "locationID" = 2244608
| | "IOGeneralInterest" = "IOCommand is not serializable"
| | "bcdUSB" = 784
| | "bMaxPacketSize0" = 9
| | }