| 
									
										
										
										
											2009-03-28 08:57:34 +00:00
										 |  |  | // Most of the code in this file was shamelessly ripped from libcdio With minor adjustments
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | #include "CDUtils.h"
 | 
					
						
							| 
									
										
										
										
											2009-03-28 08:57:34 +00:00
										 |  |  | #include "Common.h"
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-30 02:45:42 +00:00
										 |  |  | #include <memory> // for std::unique_ptr
 | 
					
						
							| 
									
										
										
										
											2010-01-19 19:28:27 +00:00
										 |  |  | #ifdef _WIN32
 | 
					
						
							|  |  |  | #include <windows.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-27 18:51:02 -06:00
										 |  |  | #include "StringUtil.h"
 | 
					
						
							| 
									
										
										
										
											2010-01-19 19:28:27 +00:00
										 |  |  | #elif __APPLE__
 | 
					
						
							| 
									
										
										
										
											2010-07-12 20:11:19 +00:00
										 |  |  | #include <CoreFoundation/CoreFoundation.h>
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #include <IOKit/IOBSD.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-19 19:28:27 +00:00
										 |  |  | #include <IOKit/IOKitLib.h>
 | 
					
						
							|  |  |  | #include <IOKit/storage/IOCDMedia.h>
 | 
					
						
							|  |  |  | #include <IOKit/storage/IOMedia.h>
 | 
					
						
							| 
									
										
										
										
											2010-07-12 20:11:19 +00:00
										 |  |  | #include <paths.h>
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-01-19 19:28:27 +00:00
										 |  |  | #include <fcntl.h>
 | 
					
						
							|  |  |  | #include <sys/stat.h>
 | 
					
						
							|  |  |  | #include <sys/ioctl.h>
 | 
					
						
							|  |  |  | #endif // WIN32
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #ifdef __linux__
 | 
					
						
							|  |  |  | #include <linux/cdrom.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | #ifdef _WIN32
 | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | // takes a root drive path, returns true if it is a cdrom drive
 | 
					
						
							| 
									
										
										
										
											2013-02-27 18:51:02 -06:00
										 |  |  | bool is_cdrom(const TCHAR* drive) | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 	return (DRIVE_CDROM == GetDriveType(drive)); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | // Returns a vector with the device names
 | 
					
						
							|  |  |  | std::vector<std::string> cdio_get_devices() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	std::vector<std::string> drives; | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 	const DWORD buffsize = GetLogicalDriveStrings(0, NULL); | 
					
						
							| 
									
										
										
										
											2013-02-27 18:51:02 -06:00
										 |  |  | 	std::vector<TCHAR> buff(buffsize); | 
					
						
							|  |  |  | 	if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2013-02-27 18:51:02 -06:00
										 |  |  | 		auto drive = buff.data(); | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 		while (*drive) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 			if (is_cdrom(drive)) | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2013-02-27 18:51:02 -06:00
										 |  |  | 				std::string str(TStrToUTF8(drive)); | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 				str.pop_back();	// we don't want the final backslash
 | 
					
						
							|  |  |  | 				drives.push_back(std::move(str)); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-12 06:50:20 +00:00
										 |  |  | 			// advance to next drive
 | 
					
						
							|  |  |  | 			while (*drive++) {} | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return drives; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | #elif defined __APPLE__
 | 
					
						
							|  |  |  | // Returns a pointer to an array of strings with the device names
 | 
					
						
							|  |  |  | std::vector<std::string> cdio_get_devices() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	io_object_t   next_media; | 
					
						
							|  |  |  | 	mach_port_t   master_port; | 
					
						
							|  |  |  | 	kern_return_t kern_result; | 
					
						
							|  |  |  | 	io_iterator_t media_iterator; | 
					
						
							|  |  |  | 	CFMutableDictionaryRef classes_to_match; | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 	std::vector<std::string> drives; | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	kern_result = IOMasterPort( MACH_PORT_NULL, &master_port ); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if( kern_result != KERN_SUCCESS ) | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 		return( drives ); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	classes_to_match = IOServiceMatching( kIOCDMediaClass ); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if( classes_to_match == NULL ) | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 		return( drives ); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	CFDictionarySetValue( classes_to_match, | 
					
						
							|  |  |  | 		CFSTR(kIOMediaEjectableKey), kCFBooleanTrue ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kern_result = IOServiceGetMatchingServices( master_port, | 
					
						
							|  |  |  | 		classes_to_match, &media_iterator ); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if( kern_result != KERN_SUCCESS) | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 		return( drives ); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	next_media = IOIteratorNext( media_iterator ); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if( next_media != 0 ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		char psz_buf[0x32]; | 
					
						
							|  |  |  | 		size_t dev_path_length; | 
					
						
							|  |  |  | 		CFTypeRef str_bsd_path; | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 		do | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 		{ | 
					
						
							|  |  |  | 			str_bsd_path = | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 				IORegistryEntryCreateCFProperty( next_media, | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 					CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, | 
					
						
							|  |  |  | 					0 ); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 			if( str_bsd_path == NULL ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 				IOObjectRelease( next_media ); | 
					
						
							|  |  |  | 				continue; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 			// Below, by appending 'r' to the BSD node name, we indicate
 | 
					
						
							|  |  |  | 			// a raw disk. Raw disks receive I/O requests directly and
 | 
					
						
							|  |  |  | 			// don't go through a buffer cache.
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 			snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' ); | 
					
						
							|  |  |  | 			dev_path_length = strlen( psz_buf ); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-27 10:40:16 +00:00
										 |  |  | 			if( CFStringGetCString( (CFStringRef)str_bsd_path, | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 				(char*)&psz_buf + dev_path_length, | 
					
						
							|  |  |  | 				sizeof(psz_buf) - dev_path_length, | 
					
						
							|  |  |  | 				kCFStringEncodingASCII)) | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 				if(psz_buf != NULL) | 
					
						
							|  |  |  | 				{ | 
					
						
							|  |  |  | 					std::string str = psz_buf; | 
					
						
							|  |  |  | 					drives.push_back(str); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			CFRelease( str_bsd_path ); | 
					
						
							|  |  |  | 			IOObjectRelease( next_media ); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		} while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 ); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	IOObjectRelease( media_iterator ); | 
					
						
							|  |  |  | 	return drives; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | // checklist: /dev/cdrom, /dev/dvd /dev/hd?, /dev/scd? /dev/sr?
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | static struct | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	const char * format; | 
					
						
							|  |  |  | 	unsigned int num_min; | 
					
						
							|  |  |  | 	unsigned int num_max; | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | } checklist[] = | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #ifdef __linux__
 | 
					
						
							| 
									
										
										
										
											2011-02-15 21:27:15 +00:00
										 |  |  | 		{ "/dev/cdrom", 0, 0 }, | 
					
						
							|  |  |  | 		{ "/dev/dvd", 0, 0 }, | 
					
						
							|  |  |  | 		{ "/dev/hd%c", 'a', 'z' }, | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 		{ "/dev/scd%d", 0, 27 }, | 
					
						
							| 
									
										
										
										
											2011-02-15 21:27:15 +00:00
										 |  |  | 		{ "/dev/sr%d", 0, 27 }, | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 		{ "/dev/acd%d", 0, 27 }, | 
					
						
							|  |  |  | 		{ "/dev/cd%d", 0, 27 }, | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-02-15 21:27:15 +00:00
										 |  |  | 		{ NULL, 0, 0 } | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | // Returns true if a device is a block or char device and not a symbolic link
 | 
					
						
							|  |  |  | bool is_device(const char *source_name) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	struct stat buf; | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if (0 != lstat(source_name, &buf)) | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) && | 
					
						
							|  |  |  | 		!S_ISLNK(buf.st_mode)); | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | // Check a device to see if it is a DVD/CD-ROM drive
 | 
					
						
							|  |  |  | static bool is_cdrom(const char *drive, char *mnttype) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	bool is_cd=false; | 
					
						
							|  |  |  | 	int cdfd; | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	// Check if the device exists
 | 
					
						
							|  |  |  | 	if (!is_device(drive)) | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		return(false); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	// If it does exist, verify that it is a cdrom/dvd drive
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	cdfd = open(drive, (O_RDONLY|O_NONBLOCK), 0); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if ( cdfd >= 0 ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	{ | 
					
						
							|  |  |  | #ifdef __linux__
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 		if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 			is_cd = true; | 
					
						
							|  |  |  | 		close(cdfd); | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	return(is_cd); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-28 08:57:34 +00:00
										 |  |  | // Returns a pointer to an array of strings with the device names
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | std::vector<std::string> cdio_get_devices () | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	unsigned int i; | 
					
						
							|  |  |  | 	char drive[40]; | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 	std::vector<std::string> drives; | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	// Scan the system for DVD/CD-ROM drives.
 | 
					
						
							|  |  |  | 	for ( i=0; checklist[i].format; ++i ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 		unsigned int j; | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 		for ( j=checklist[i].num_min; j<=checklist[i].num_max; ++j ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 			sprintf(drive, checklist[i].format, j); | 
					
						
							|  |  |  | 			if ( (is_cdrom(drive, NULL)) > 0 ) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 				std::string str = drive; | 
					
						
							|  |  |  | 				drives.push_back(str); | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return drives; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | // Returns true if device is a cdrom/dvd drive
 | 
					
						
							|  |  |  | bool cdio_is_cdrom(std::string device) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #ifdef __linux__
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	// Resolve symbolic links. This allows symbolic links to valid
 | 
					
						
							|  |  |  | 	// drives to be passed from the command line with the -e flag.
 | 
					
						
							| 
									
										
										
										
											2013-09-04 02:04:31 -05:00
										 |  |  | 	char resolved_path[MAX_PATH]; | 
					
						
							|  |  |  | 	char *devname = realpath(device.c_str(), resolved_path); | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	if (!devname) | 
					
						
							|  |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-03-28 08:57:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 	std::vector<std::string> devices = cdio_get_devices(); | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	bool res = false; | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 	for (unsigned int i = 0; i < devices.size(); i++) | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | #ifdef __linux__
 | 
					
						
							| 
									
										
										
										
											2010-07-10 21:17:08 +00:00
										 |  |  | 		if (strncmp(devices[i].c_str(), devname, MAX_PATH) == 0) | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-07-10 21:17:08 +00:00
										 |  |  | 		if (strncmp(devices[i].c_str(), device.c_str(), MAX_PATH) == 0) | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 			res = true; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2010-07-22 03:29:35 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-07-07 19:47:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-16 08:46:21 +00:00
										 |  |  | 	devices.clear(); | 
					
						
							| 
									
										
										
										
											2009-02-24 15:06:52 +00:00
										 |  |  | 	return res; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-03-28 08:57:34 +00:00
										 |  |  | 
 |