I'm developing a program in C++ on Linux which interacts with a USB2Serial adapter to fetch some information from the remote terminal. I was able to set it the IOCTL on windows using the following code:
#define IOCTL_SERIAL_XOFF_COUNTER CTL_CODE(FILE_DEVICE_SERIAL_PORT,28,METHOD_BUFFERED,FILE_ANY_ACCESS)
unsigned char xoff_counter[] = {0xd0,0x07,0x00,0x00,0x05,0x00,0x00,0x00,0x13,0x00,0x00,0x00};
bool result = DeviceIoControl(file,IOCTL_SERIAL_XOFF_COUNTER,
&xoff_counter, sizeof(xoff_counter),
NULL,0,
&junk,
&o);
I tried doing the same on Linux using the following code:
#define SERIAL_XOFF_COUNTER 28
unsigned char xoff_counter[] = {0xd0,0x07,0x00,0x00,0x05,0x00,0x00,0x00,0x13,0x00,0x00,0x00};
int retVal = ioctl(fd,SERIAL_XOFF_COUNTER,xoff_counter);
if(retVal < 0){
cout << "Error while setting ioctl:"<<strerror(errno)<<endl;
}
This is raising an error when I run the program:
Error while setting ioctl:Inappropriate ioctl for device
If anyone has worked in these ioctls before, please let me know what the Linux equivalents are for this flag.
TIA!