Changeset 26296 in vbox for trunk/src/VBox/Main/linux
- Timestamp:
- Feb 5, 2010 2:53:35 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57365
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r26186 r26296 325 325 AssertPtrNullReturn(pchModel, VERR_INVALID_POINTER); 326 326 327 unsigned char u8Response[96] = { 0 }; 328 struct cdrom_generic_command CdromCommandReq = 329 { { INQUIRY, 0, 0, 0, sizeof(u8Response), 0 } /* INQUIRY */ }; 330 int rc, rcIoCtl = 0; 331 RTFILE file; 332 rc = RTFileOpen(&file, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK); 327 RTFILE hFile; 328 int rc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK); 333 329 if (RT_SUCCESS(rc)) 334 330 { 335 CdromCommandReq.buffer = u8Response; 336 CdromCommandReq.buflen = sizeof(u8Response); 331 int rcIoCtl = 0; 332 unsigned char u8Response[96] = { 0 }; 333 struct cdrom_generic_command CdromCommandReq; 334 RT_ZERO(CdromCommandReq); 335 CdromCommandReq.cmd[0] = INQUIRY; 336 CdromCommandReq.cmd[4] = sizeof(u8Response); 337 CdromCommandReq.buffer = u8Response; 338 CdromCommandReq.buflen = sizeof(u8Response); 337 339 CdromCommandReq.data_direction = CGC_DATA_READ; 338 CdromCommandReq.timeout = 5000; /* ms */ 339 rc = RTFileIoCtl(file, CDROM_SEND_PACKET, &CdromCommandReq, 0, 340 &rcIoCtl); 340 CdromCommandReq.timeout = 5000; /* ms */ 341 rc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl); 341 342 if (RT_SUCCESS(rc) && rcIoCtl < 0) 342 343 rc = RTErrConvertFromErrno(-CdromCommandReq.stat); 343 RTFileClose(file); 344 } 345 if (RT_SUCCESS(rc)) 346 { 347 if (pu8Type) 348 *pu8Type = u8Response[0] & 0x1f; 349 if (pchVendor) 350 RTStrPrintf(pchVendor, cchVendor, "%.8s", 351 (char *) &u8Response[8] /* vendor id string */); 352 if (pchModel) 353 RTStrPrintf(pchModel, cchModel, "%.16s", 354 (char *) &u8Response[16] /* product id string */); 344 RTFileClose(hFile); 345 346 if (RT_SUCCESS(rc)) 347 { 348 if (pu8Type) 349 *pu8Type = u8Response[0] & 0x1f; 350 if (pchVendor) 351 RTStrPrintf(pchVendor, cchVendor, "%.8s", 352 &u8Response[8] /* vendor id string */); 353 if (pchModel) 354 RTStrPrintf(pchModel, cchModel, "%.16s", 355 &u8Response[16] /* product id string */); 356 LogRelFlowFunc(("returning success: type=%u, vendor=%.8s, product=%.16s\n", 357 u8Response[0] & 0x1f, &u8Response[8], &u8Response[16])); 358 return VINF_SUCCESS; 359 } 355 360 } 356 361 LogRelFlowFunc(("returning %Rrc\n", rc)); 357 if (RT_SUCCESS(rc))358 LogRelFlowFunc((" type=%u, vendor=%.8s, product=%.16s\n",359 u8Response[0] & 0x1f, (char *) &u8Response[8],360 (char *) &u8Response[16]));361 362 return rc; 362 363 } … … 801 802 pList, (unsigned) isDVD, pfSuccess)); 802 803 PRTDIR pDir = NULL; 803 RTDIRENTRY entry = {0};804 804 int rc; 805 805 bool fSuccess = false; … … 813 813 fSuccess = true; 814 814 if (RT_SUCCESS(rc)) 815 while (true) 816 { 815 for (;;) 816 { 817 RTDIRENTRY entry; 817 818 rc = RTDirRead(pDir, &entry, NULL); 818 819 Assert(rc != VERR_BUFFER_OVERFLOW); /* Should never happen... */ … … 989 990 bool success = false; 990 991 991 deviceNodeArray aDevices = { { 0 } };992 992 char szPath[RTPATH_MAX] = "/dev"; 993 deviceNodeArray aDevices; 994 RT_ZERO(aDevices); 993 995 devFindDeviceRecursive(szPath, sizeof(szPath), aDevices, isDVD); 994 996 try
Note:
See TracChangeset
for help on using the changeset viewer.