By seeing the manual, i completed till
Code: Select all
sudo modprobe pcan
Code: Select all
lspcan -T -t -a
In my application i implement like below :
Code: Select all
fd = pcanfd_open(
st_CanInfoTable[en_channel].dev_name,
st_CanInfoTable[en_channel].set_flag,
st_CanInfoTable[en_channel].bitrate
);
if (fd > 0){
pcanfd_set_init(...);
}
else{
printf("pcanfd_open ch=%d ERROR!! errno=%d:%s \n",en_channel, errno, strerror(errno));
}
I dont want this to happen.
Library code provided along with software goes like this :
Code: Select all
\peak-linux-driver-8.10.2\lib\src\libpcanfd.c
int pcanfd_open()
{
.......
.......
fd = __open(dev_pcan, o_flags);
if (fd < 0)
goto open_exit_1; //return negative fd
....
pcanfd_set_init(...)
....
}
- First i would like to "check if the drivers are succesfully loaded" - Is there any API to check this ?
- Then "is there any devices connected or not ?" - Is there any APIs for this ?
Code: Select all
int pcanfd_open()
{
.......
.......
//Check if drivers are loaded ?
//If loaded{
// Is there any devices connected or not ?
// If (Connected) {
fd = __open(dev_pcan, o_flags);
if (fd < 0)
goto open_exit_1; //return negative fd
....
pcanfd_set_init(...)
....
} //Connected
} //Loaded
}