USB Flash Drive

Dec 23, 2009 at 6:43am
Hello All! (Excuseme my english level)

I have a very big problem about USB Flash Drives.
I need to detect Memory USB Flash Drives connected in a PC. My purpose is enumerate maximum 2 Memory USB Flash Drives where is storaged a file called "profiles.acc" at the root of the memory.

Well... I have some Source code I've used for detect Memory USB Flash Drives in Windows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
TCHAR chUsb[32][8];
int nUsb = 0;

/*...*/

void EnumUSBDevices()
{
	TCHAR chDrives[32][8];
	int nDrives = 0;
	nUsb = 0;
	DWORD dwDrives = GetLogicalDrives();
	for(int x = 2; x < 32; x++)	// Starts from 2 to not consider the floppy [A: y B:]
	{
		DWORD dwComp = (1<<x);
		if(dwDrives & dwComp)
		{
			_sprintf(chDrives[nDrives], 8, _T("%c:\\"), ('A'+char(x)));
			nDrives++;
		}
	}
	for(int x = 0; x < nDrives; x++)
	{
		if(GetDriveType(chDrives[x]) == DRIVE_REMOVABLE)
		{
			_strcpy(chUsb[nUsb], chDrives[x]);
			nUsb++;
		}
	}
}


When I call this function, chUsb is filled with letters of different Memory USB Flash Drivers currently connected at PC. But... these functions are useless in Linux, beginning because linux does not use Driver Letters (As D:\ or Z:\), but use mounting points (/media/KINGSTON/ or /media/ZYRUS).

I need some function that helps me how to Detect these "Mounting points", not only for windows but for linux also.

I don't need the entire code, but if anyone does, please provide me! I need it so much!

Thanks for listening me!
Dec 23, 2009 at 12:16pm
Try libusb.
Jan 3, 2010 at 4:27pm
How to i use this? A Basic Example for enumerate USB Flash?
Topic archived. No new replies allowed.