Updating the operating system on an Android media player or TV box.
#define WC_IOC_MAGIC 'W' #define WC_SET_BRIGHTNESS _IOW(WC_IOC_MAGIC, 1, int) #define WC_RESET_TIMER _IO(WC_IOC_MAGIC, 2) static long worldcup_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) struct worldcup_dev *dev = filp->private_data; int val; switch(cmd) case WC_SET_BRIGHTNESS: if (copy_from_user(&val, (int __user *)arg, sizeof(int))) return -EFAULT; // Write brightness value directly to hardware control register iowrite32(val, dev->mmio_base + WC_REG_CTRL); break; case WC_RESET_TIMER: iowrite32(WC_CTRL_RESET, dev->mmio_base + WC_REG_CTRL); break; default: return -ENOTTY; return 0; Use code with caution. 6. Summary of the Worldcup Driver Legacy worldcup device driver
static void __exit worldcup_exit(void) printk(KERN_INFO "WorldCup driver unloaded\n"); Updating the operating system on an Android media
Requesting and mapping the device’s MMIO regions via ioremap . int) #define WC_RESET_TIMER _IO(WC_IOC_MAGIC