FarSync Drivers | ![]() |
![]() |
---|
When a new version of the FarSync base driver is released there may have been some new configuration items added to the fstioc_info structure that would mean that the size of the data structure passed in the ioctl(FSTSETCONFIG) or ioctl(FSTGETCONFIG) by the application would be a different size from that which the driver is expecting.
This problem could simply be solved by recompiling the application. However, it is possible to continue to use the old application by telling the driver which version of the fstioc)info structure to be compatible with. This can be done in a number of ways:
specify the base fstioc_info structure version at module load time. This is then the default value for all API sessions. If there is not a value set at module load time, then the structure version is assumed to be the latest version.
use the farutil <device> set_iocver <version> command. This will set the base version for a give FarSync port, e.g. sync0.
the application can use the ioctl(FSTCMD) with the command value of FSTCMD_SET_VERSION
For the FarSync base 2.2.x release the version numbers and their meanings are as follows:
The farsync and fsflex drivers can be passed a module load time parameter called fst_iocinfo_version. Depending on how the module is loaded the value can specified in one of two ways:
When using the farutil command to set the compatibility version number please make sure that it is used before the FarSync port has been opened for use. When you have set the value you can check it has been set correctly. Here is an example:
farutil sync0 set_iocver 3 farutil sync0 get_iocver
If you want to be sure that your application will always work with a given version of the structure you can add the following to the initialisation section of your code:
static void do_set_iocver (int version) { static struct fstioc_cmd my_cmd; unsigned char iocinfo_version; iocinfo_version = version; printf("Requesting IOC Info structure version to be %d\n", iocinfo_version); my_cmd.command = FSTCMD_SET_VERSION; my_cmd.version = 1; my_cmd.input_data_len=1; my_cmd.status = 0x55555555; my_cmd.data_ptr = &iocinfo_version; req.ifr_data = (char *)&my_cmd; if (ioctl(sock, FSTCMD, &req)) { perror("Error in setting IOC Info version number\n"); exit(0); } if (my_cmd.status == 0xaaaaaaaa) { printf("IOC Info version set to %d\n", iocinfo_version); } else { printf("Error processing IOC Info version. Status is %x\n", my_cmd.status); } }
Copyright © 2001-2021 FarSite Communications Ltd. |
![]() |
---|