Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <fcntl.h>
- #include <sys/ioctl.h>
- #include <mtd/mtd-user.h>
- int main(int argc, char **argv)
- {
- mtd_info_t mtd_info;
- int fd;
- if (argc < 2) {
- fprintf(stderr, "usage: %s /dev/mtdDEVICE\n", argv[0]);
- return -1;
- }
- fd = open(argv[1], O_RDWR);
- ioctl(fd, MEMGETINFO, &mtd_info);
- printf("MTD type: %u\n", mtd_info.type);
- printf("MTD total size : %u %1$xh bytes\n", mtd_info.size);
- printf("MTD erase size : %u %1$xh bytes\n", mtd_info.erasesize);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment