Esempio n. 1
0
void init_pantech_debug_option(void)
{
	int	r;
	
	printk(KERN_ERR "%s is called\n", __func__);

#ifndef FEATURE_AARM_RELEASE_MODE
	debug_flag.bytes = 0x07;
#else
	r = msm_nv_read(NV_SPARE_1_I, (nv_cmd_item_type *)&debug_flag.bytes);

	if (r != NV_DONE_S) { 
		// minus : RPC error, plus : NV error
		printk(KERN_ERR "%s: msm_nv_read error(%d)\n", __func__, r);
		return;
	}
	printk(KERN_ERR "%s is called debug_flag.bytes:%x\n", __func__,debug_flag.bytes);
#endif
	// TODO : set current status
	pantech_debug_opt.enable = debug_flag.bytes;

	// disable by jwcha101001@DS2
	if (debug_flag.bits.alog) {
		printk(KERN_INFO "%s: android UART log ON\n", __func__);
		logger_set_android_uart_log(1);
	}
	else {
		printk(KERN_INFO "%s: android UART log OFF\n", __func__);
		logger_set_android_uart_log(0);
	}

	if (console_loglevel == 0)
		printk(KERN_INFO "%s: PDIP printk console_loglevel (0x%x)\n", 
				__func__, debug_flag.bits.conloglvl);

	console_loglevel = debug_flag.bits.conloglvl;

	if (console_loglevel)
		printk(KERN_INFO "%s: PDIP printk console_loglevel (0x%x)\n", 
				__func__, debug_flag.bits.conloglvl);

	if (debug_flag.bits.dmterminal) {
		printk(KERN_INFO "%s: UART ROOT SHELL ON\n", __func__);
		msm_hsl_console_set_terminal_onoff(1);
	}
	else {
		printk(KERN_INFO "%s: UART ROOT SHELL OFF\n", __func__);
		msm_hsl_console_set_terminal_onoff(0);
	}

}
void init_pantech_debug_option(void)
{
	int	r;
	
	printk(KERN_INFO "%s is called\n", __func__);

	r = msm_nv_read(NV_SPARE_1_I, (nv_cmd_item_type *)&debug_flag.bytes);
	if (r != NV_DONE_S) { 
		// minus : RPC error, plus : NV error
		printk(KERN_ERR "%s: msm_nv_read error(%d)\n", __func__, r);
		return;
	}

	// TODO : set current status
	pantech_debug_opt.enable = debug_flag.bytes;

	if (debug_flag.bits.alog) {
		printk(KERN_INFO "%s: android UART log ON\n", __func__);
		logger_set_android_uart_log(1);
	}
	else {
		printk(KERN_INFO "%s: android UART log OFF\n", __func__);
		logger_set_android_uart_log(0);
	}

	if (console_loglevel == 0)
		printk(KERN_INFO "%s: console_loglevel (0x%x)\n", 
				__func__, debug_flag.bits.conloglvl);

	console_loglevel = debug_flag.bits.conloglvl;

	if (console_loglevel)
		printk(KERN_INFO "%s: console_loglevel (0x%x)\n", 
				__func__, debug_flag.bits.conloglvl);

#if 1//defined(FEATURE_AARM_RELEASE_MODE) //GPL_KERNEL SYLEE
	if(debug_flag.bits.dmterminal) {
		printk(KERN_INFO "%s: UART ROOT SHELL ON\n", __func__);
		msm_console_set_terminal_onoff(1);
	}
	else {
		printk(KERN_INFO "%s: UART ROOT SHELL OFF\n", __func__);
		msm_console_set_terminal_onoff(0);
	}
#endif

}
//lee.eunsuk 20110516 static size_t panmac_read(struct file *filp, char* buf, size_t count, loff_t *f_pos)
static ssize_t panmac_read(struct file *filp, char* buf, size_t count, loff_t *f_pos)
{
  nv_cmd_item_type item;
  int rc, result;
  int copy_len;
  char temp[PANMAC_MAC_MAX_LEN + 1];

  rc = msm_nv_rpc_connect();
  if (rc != 0) {
    printk(KERN_ERR "%s : msm_nv_rpc_connect error(%d)\n", __func__, rc);
    return 0;
  }
  result = msm_nv_read(NV_WLAN_MAC_ADDRESS_I, &item);
  if (result != 0)
  {
    printk(KERN_INFO "msm_nv_read failed (%d)\n", result);
    return 0;
  }
  
  printk(KERN_INFO "msm_nv_read: %08X %08X\n", item.wlan_mac_address[0], item.wlan_mac_address[1]);
    
  sprintf(temp, "%02x:%02x:%02x:%02x:%02x:%02x",
    (item.wlan_mac_address[0] >> 8)  & 0xFF,
    (item.wlan_mac_address[0] >> 16) & 0xFF,
    (item.wlan_mac_address[0] >> 24) & 0xFF,
    (item.wlan_mac_address[1] >> 16) & 0xFF,
    (item.wlan_mac_address[1] >> 24) & 0xFF,
    (item.wlan_mac_address[0])       & 0xFF);
    
  copy_len = PANMAC_MAC_MAX_LEN > count ? count: PANMAC_MAC_MAX_LEN;

  if(copy_to_user(buf, temp, copy_len))
  	return -EFAULT;
  
  if (*f_pos == 0)
  {
    *f_pos += copy_len;
    return copy_len;
  }

  return 0;
}