I have perfect working code on Windows which communicates with a USB device. I'm trying to find the equivalent in linux using ioctrl(), but am at a complete loss (linux newbie ).
Here's my stripped down Windows code:
I only need one buffer. This is filled in by the USB device.
DWORD dwJunk; // discard results from DeviceIOControl()
// cBuffer initialization here
HANDLE hDevice; // handle to the drive to be examined
CString sDrive = _T(\\\\.\\H:); // drive H: for this test
hDevice = CreateFile(sDrive, // drive to open
GENERIC_READ | GENERIC_WRITE, // read and write access to the drive
FILE_SHARE_READ | FILE_SHARE_WRITE, // share mode
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, // file attributes
NULL); // do not copy file attributes
iReply = DeviceIoControl(hDevice, IOCTL_SCSI_PASS_THROUGH_DIRECT, &cBuffer, sizeof(cBuffer), &cBuffer, sizeof(cBuffer), &dwJunk, (LPOVERLAPPED)NULL);
So, what is the linux equivalent of IOCTL_SCSI_PASS_THROUGH_DIRECT, and how do i use it with ioctrl()? A code snippet would be vey much appreciated.