Exemplo n.º 1
0
//20101110, [email protected], Function for Warm-boot [START]
static ssize_t star_reset_show(struct device *dev, 
            struct device_attribute *attr, char *buf)
{

    unsigned char tmpbuf[3];
    int ret;
    int tag;

    read_cmd_reserved_buffer(tmpbuf, 3);
    printk(" power key reserved_buffer = %c%c%c\n",tmpbuf[0],tmpbuf[1],tmpbuf[2]);

    #define _COLDBOOT          0   
    #define _NORMAL_WARMBOOT   1
    #define _HIDDEN_RESET      2

    if ('p' == tmpbuf[0])
    {
      printk("star_powekey : hidden reset detected\n");
      tag = _HIDDEN_RESET;
      ret = sprintf(buf,"%d\n",tag);
      tmpbuf[1] = NULL; tmpbuf[2] = NULL;
      write_cmd_reserved_buffer(tmpbuf,3);
      return ret;
    }
  
    if ('w' == tmpbuf[0])
    {
	    switch (tmpbuf[1])
	    {
		    case 'm': // reboot immediately
		    case 'a': // panic
                    printk("star_powekey : hidden reset detected\n");
	            tag = _HIDDEN_RESET;
		    tmpbuf[2] = NULL;
		    break;
		    case 'e': //recovery
                    printk("star_powekey : factory reset detected\n");
		    tag = _NORMAL_WARMBOOT;
		    tmpbuf[2] = NULL;
		    break;
		    default : // reboot other case (ex adb)
                    printk("star_powekey : warm boot detected\n");
		    tag = _NORMAL_WARMBOOT;
		    tmpbuf[1] = NULL; tmpbuf[2] = NULL;
		    break;
	    }
    }
    else
    {
       printk("star_powekey : cold boot detected\n");
       tag = _COLDBOOT; 
       memset(tmpbuf,NULL,3);
    }    
    ret = sprintf(buf,"%d\n",tag);
    write_cmd_reserved_buffer(tmpbuf,3);
    return ret;
}
Exemplo n.º 2
0
static ssize_t star_reset_show(struct device *dev, 
            struct device_attribute *attr, char *buf)
{

    unsigned char tmpbuf[2];
    int ret;
    int tag;

    read_cmd_reserved_buffer(tmpbuf,1);
    printk(" power key reserved_buffer = %x\n",tmpbuf[0]);

    if ('w' == tmpbuf[0]||'p'== tmpbuf[0])
        tag = 1;
    else
        tag = 0;

    ret = sprintf(buf,"%d\n",tag);
    return ret;
}