ODROID-COMMON: Add function for input data to sysnode.
Signed-off-by: steve.jeong <jkhpro1003@gmail.com> Change-Id: I7a1c6b82f8461b78aa5f9616531f9e2ae08c0fd3
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/types.h>
|
||||
#include <asm/ioctl.h>
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@@ -264,6 +265,29 @@ void setUsingGpiomem(const unsigned int value)
|
||||
libwiring.usingGpiomem = value;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* input data to sys node.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int inputToSysNode (const char* sysPath, const char* node, char* data) {
|
||||
char dest[(BLOCK_SIZE * 2)];
|
||||
FILE *fd;
|
||||
|
||||
memset(dest, 0, sizeof(dest));
|
||||
|
||||
sprintf(dest, "%s/%s", sysPath, node);
|
||||
|
||||
if((fd = fopen(dest, "w")) == NULL) {
|
||||
printf("Invalid sysnode path\n");
|
||||
return -1;
|
||||
}
|
||||
fprintf(fd, "%s\n", data);
|
||||
fclose(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* setKernelVersion:
|
||||
|
||||
@@ -342,6 +342,9 @@ extern unsigned int digitalReadByte2 (void) UNU;
|
||||
extern void digitalWriteByte (int value) UNU;
|
||||
extern void digitalWriteByte2 (int value) UNU;
|
||||
|
||||
// sys node
|
||||
extern int inputToSysNode (const char* sysPath, const char* node, char* data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user