static int flashlight_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
#endif
{
	int partId;
    int i4RetValue = 0;

    PK_DBG("XXflashlight_ioctl cmd,arg= %x, %x +\n",cmd,(unsigned int)arg);

    switch(cmd)
    {
        case FLASHLIGHTIOC_X_SET_DRIVER:
            i4RetValue = kdSetFlashlightDrv((unsigned int*)&arg);
            break;


       	case FLASH_IOC_GET_MAIN_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_MAIN_SENSOR);
       		g_strobePartIdMain = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_MAIN_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
		case FLASH_IOC_GET_SUB_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_SUB_SENSOR);
       		g_strobePartIdSub = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_SUB_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
		case FLASH_IOC_GET_MAIN2_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_MAIN_2_SENSOR);
       		g_strobePartIdMainSecond = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_MAIN2_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
    	default :
    	    if (g_pFlashlightFunc) {
    	        i4RetValue = g_pFlashlightFunc->flashlight_ioctl(cmd,arg);
    	    }
    		break;
    }

    return i4RetValue;
}
static int flashlight_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
#endif
{
    int i4RetValue = 0;

    //PK_DBG("%x, %x \n",cmd,arg);

    switch(cmd)
    {
        case FLASHLIGHTIOC_X_SET_DRIVER:
            i4RetValue = kdSetFlashlightDrv((unsigned int*)&arg);
            break;
    	default :
    	    if (g_pFlashlightFunc) {
    	        i4RetValue = g_pFlashlightFunc->flashlight_ioctl(cmd,arg);
    	    }
    		break;
    }

    return i4RetValue;
}
static int flashlight_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
#endif
{
    int temp;
	int partId;
    int i4RetValue = 0;

    PK_DBG("XXflashlight_ioctl cmd,arg= %x, %x +\n",cmd,(unsigned int)arg);

    static int bInit=1;
    if(bInit==1)
    {
#if DEF_HAS_LOW_POWER_KERNEL
        register_low_battery_notify(&lowPowerCB, LOW_BATTERY_PRIO_FLASHLIGHT);
#endif
        bInit=0;
    }

    switch(cmd)
    {
        case FLASHLIGHTIOC_X_SET_DRIVER:
            i4RetValue = kdSetFlashlightDrv((unsigned int*)&arg);
            break;


       	case FLASH_IOC_GET_MAIN_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_MAIN_SENSOR);
       		g_strobePartIdMain = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_MAIN_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
		case FLASH_IOC_GET_SUB_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_SUB_SENSOR);
       		g_strobePartIdSub = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_SUB_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
		case FLASH_IOC_GET_MAIN2_PART_ID:
       		partId = strobe_getPartId(e_CAMERA_MAIN_2_SENSOR);
       		g_strobePartIdMainSecond = partId;
       		if(copy_to_user((void __user *) arg , (void*)&partId , 4))
			{
			    PK_DBG("[FLASH_IOC_GET_MAIN2_PART_ID] ioctl copy to user failed\n");
			    return -EFAULT;
			}
          	break;
        case FLASH_IOC_HAS_LOW_POWER_DETECT:
    		PK_DBG("FLASH_IOC_HAS_LOW_POWER_DETECT");
    		temp=FL_hasLowPowerDetect();
    		if(copy_to_user((void __user *) arg , (void*)&temp , 4))
            {
                PK_DBG(" ioctl copy to user failed\n");
                return -1;
            }
    		break;
    	case FLASH_IOC_LOW_POWER_DETECT_START:
    	    PK_DBG("FLASH_IOC_LOW_POWER_DETECT_START");
    		detLowPowerStart();
    		break;
    	case FLASH_IOC_LOW_POWER_DETECT_END:
    	    PK_DBG("FLASH_IOC_LOW_POWER_DETECT_END");
    		i4RetValue = detLowPowerEnd();
    		break;

    	default :
    	    if (g_pFlashlightFunc) {
    	        i4RetValue = g_pFlashlightFunc->flashlight_ioctl(cmd,arg);
    	    }
    		break;
    }

    return i4RetValue;
}