Skip to content

Commit

Permalink
Added Support for Ubuntu 24.04/Fix for UUID/Github File descriptors l…
Browse files Browse the repository at this point in the history
…eak #5
  • Loading branch information
viswanathanchn committed Aug 20, 2024
1 parent e277835 commit 95c3b35
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <eapi.h>
#include <uuid/uuid.h>

#define Version "ADLINK-SEMA-EC-LINUX-V4_R3_1_24_08_01"
#define Version "ADLINK-SEMA-EC-LINUX-V4_R3_3_24_08_20"

char* ExeName;
uint8_t SetWatchdog, TriggerWatchdog, StopWatchdog, WatchDogCap,IsPwrUpWDogStart, IsPwrUpWDogStop;
Expand Down Expand Up @@ -535,7 +535,7 @@ int DispatchCMDToSEMA(int argc,char *argv[])
printf("Get EApi information failed\n");
errno_exit("EApiPwrUpWDogStop");
}
printf("Watchdog is disabled successfully\n");
printf("Watchdog is disabled successfully\n");
}


Expand Down
8 changes: 4 additions & 4 deletions driver/adl-ec-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,10 @@ static int adl_bmc_i2c_probe(struct platform_device *pdev)
adap4->owner = THIS_MODULE;
adap4->class = I2C_CLASS_DEPRECATED;

strlcpy(adap1->name, "ADLINK BMC I2C adapter bus 1", sizeof(adap1->name));
strlcpy(adap2->name, "ADLINK BMC I2C adapter bus 2", sizeof(adap2->name));
strlcpy(adap3->name, "ADLINK BMC I2C adapter bus 3", sizeof(adap3->name));
strlcpy(adap4->name, "ADLINK BMC I2C adapter bus 4", sizeof(adap4->name));
strscpy(adap1->name, "ADLINK BMC I2C adapter bus 1", sizeof(adap1->name));
strscpy(adap2->name, "ADLINK BMC I2C adapter bus 2", sizeof(adap2->name));
strscpy(adap3->name, "ADLINK BMC I2C adapter bus 3", sizeof(adap3->name));
strscpy(adap4->name, "ADLINK BMC I2C adapter bus 4", sizeof(adap4->name));

adap1->algo = &adlink_i2c_algo1;
adap2->algo = &adlink_i2c_algo2;
Expand Down
6 changes: 4 additions & 2 deletions lib/boardinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ uint32_t IsFileExist(char *sysf)
{
int fd;
fd = open(sysf, O_RDONLY);
if (fd < 1)
if (fd < 0)
return EAPI_STATUS_READ_ERROR;

close(fd);
return EAPI_STATUS_SUCCESS;

}
Expand Down Expand Up @@ -327,6 +327,7 @@ static int get_regulator_voltage(int id, uint32_t *mVolts, char *buf, uint32_t s

if(ret)
{
close(dev_handle);
return EAPI_STATUS_ERROR;
}
*mVolts = vm.volt;
Expand Down Expand Up @@ -370,6 +371,7 @@ uint32_t EApiBoardGetVoltageCap(uint32_t *value)
ret=ioctl(dev_handle , GET_VOLT_MONITOR_CAP, &vm_cap);
if(ret)
{
close(dev_handle);
return EAPI_STATUS_ERROR;
}
*value=vm_cap;
Expand Down
7 changes: 6 additions & 1 deletion lib/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
struct secure {
uint8_t Region;
uint8_t permission;
char passcode[4];
char passcode[8];
};
static char NVMEM_DEVICE[285];
//static char NVMEM_SEC_DEVICE[285];
Expand Down Expand Up @@ -485,9 +485,11 @@ uint32_t EApiStorageLock(uint32_t Id,uint32_t Region)
}
if(ioctl(fd, EAPI_STOR_LOCK, &data ) < 0)
{
close(fd);
return EAPI_STATUS_UNSUPPORTED;
}

close(fd);
return status;
}

Expand All @@ -503,6 +505,7 @@ uint32_t EApiStorageUnLock(uint32_t Id,uint32_t Region,uint32_t Permission, char
data.Region=Region;
data.permission=Permission;

memset(data.passcode,0,sizeof(data.passcode));
memcpy(data.passcode,passcode,strlen(passcode));

if((fd = open("/dev/ec-nvmem-eapi", O_RDWR)) < 0)
Expand All @@ -512,8 +515,10 @@ uint32_t EApiStorageUnLock(uint32_t Id,uint32_t Region,uint32_t Permission, char

if(ioctl(fd, EAPI_STOR_UNLOCK,&data ) < 0)
{
close(fd);
return EAPI_STATUS_UNSUPPORTED;
}

close(fd);
return status;
}

0 comments on commit 95c3b35

Please sign in to comment.