Ejemplo n.º 1
0
void update_atcmd_state(struct atcmd_dev *sdev, char *cmd, int state)
{
	char name_buf[120];
	char state_buf[120];
	char *prop_buf;
	char *envp[3];
	int env_offset = 0;
	int length;

// BEGIN: 0004336 [email protected]:2010-02-24
// MOD: 0004336: [ARM9] AT CMD module in kerne did not process same state command.
//	if (sdev->state != state) 
// END: 0004336:[email protected]:2010-02-24
	{
		sdev->state = state;
		sdev->name = cmd;

		prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
		if (prop_buf) {
			length = name_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(name_buf, sizeof(name_buf),
					"AT_NAME=%s", prop_buf);
//				snprintf(name_buf, sizeof(name_buf), prop_buf);
				envp[env_offset++] = name_buf;
			}

			length = state_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
//				snprintf(state_buf, sizeof(state_buf), prop_buf);
				snprintf(state_buf, sizeof(state_buf),
					"AT_STATE=%s", prop_buf);
				envp[env_offset++] = state_buf;
			}
			envp[env_offset] = NULL;
			kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
			free_page((unsigned long)prop_buf);
		} else {
			printk(KERN_ERR "out of memory in update_vlc_state\n");
			kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
		}
	}
}
void update_diagcmd_state(struct diagcmd_dev *sdev, char *cmd, int state)
{
	char name_buf[120];
	char state_buf[120];
	char *prop_buf;
	char *envp[3];
	int env_offset = 0;
	int length;

	/* 
	 * 2010-08-12, jinkyu.choi, Do not check the state
	 * Now, each command has own state number which is the sub command number of testmode tools.
	 * The sub commands can be same though the major commands are different.
	 * It is result in not sending the commnad to Android Diag application
	 */

	//if (sdev->state != state) {
		sdev->state = state;
		sdev->name = cmd;

		prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
		if (prop_buf) {
			length = name_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(name_buf, sizeof(name_buf),
					"DIAG_NAME=%s", prop_buf);
				envp[env_offset++] = name_buf;
			}
			length = state_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(state_buf, sizeof(state_buf),
					"DIAG_STATE=%s", prop_buf);
				envp[env_offset++] = state_buf;
			}
			envp[env_offset] = NULL;
			kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
			free_page((unsigned long)prop_buf);
		} else {
			printk(KERN_ERR "out of memory in update_diagcmd_state\n");
			kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
		}
	//}
}
Ejemplo n.º 3
0
void update_atcmd_state(struct atcmd_dev *sdev, char *cmd, int state)
{
	char name_buf[120];
	char state_buf[120];
	char *prop_buf;
	char *envp[3];
	int env_offset = 0;
	int length;

//	if (sdev->state != state) 
	{
		sdev->state = state;
		sdev->name = cmd;

		prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
		if (prop_buf) {
			length = name_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(name_buf, sizeof(name_buf),
					"AT_NAME=%s", prop_buf);
//				snprintf(name_buf, sizeof(name_buf), prop_buf);
				envp[env_offset++] = name_buf;
			}

			length = state_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
//				snprintf(state_buf, sizeof(state_buf), prop_buf);
				snprintf(state_buf, sizeof(state_buf),
					"AT_STATE=%s", prop_buf);
				envp[env_offset++] = state_buf;
			}
			envp[env_offset] = NULL;
			kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
			free_page((unsigned long)prop_buf);
		} else {
			printk(KERN_ERR "out of memory in update_vlc_state\n");
			kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
		}
	}
}
Ejemplo n.º 4
0
void switch_set_state(struct switch_dev *sdev, int state)
{
	char name_buf[120];
	char state_buf[120];
	char *prop_buf;
	char *envp[3];
	int env_offset = 0;
	int length;

	if (sdev->state != state) {

		if( switch_class_wake_lock_inited != 0)					//<<yamaia><system><jswoo>
		wake_lock_timeout(&switch_class_wake_lock, 2 * HZ);	//<<yamaia><system><JKCha>
		
		sdev->state = state;

		prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
		if (prop_buf) {
			length = name_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(name_buf, sizeof(name_buf),
					"SWITCH_NAME=%s", prop_buf);
				envp[env_offset++] = name_buf;
			}
			length = state_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(state_buf, sizeof(state_buf),
					"SWITCH_STATE=%s", prop_buf);
				envp[env_offset++] = state_buf;
			}
			envp[env_offset] = NULL;
			kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
			free_page((unsigned long)prop_buf);
		} else {
			printk(KERN_ERR "out of memory in switch_set_state\n");
			kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
		}
	}
}
void switch_set_udisk_state(struct switch_dev *sdev, const char* cmd)
{
  char name_buf[120];
  char state_buf[120];
  char *prop_buf;
  char *envp[3];
  int env_offset = 0;
  int length;

  prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
  if (prop_buf) {
    length = name_show(sdev->dev, NULL, prop_buf);
    if (length > 0) {
      if (prop_buf[length - 1] == '\n')
        prop_buf[length - 1] = 0;
      snprintf(name_buf, sizeof(name_buf),
        "SWITCH_NAME=%s", prop_buf);
      envp[env_offset++] = name_buf;

      /* only send uevent in mass_storage */
      if (strcmp(prop_buf, "usb_mass_storage"))
      {
        pr_err("switch_set_udisk_state: the name(%s) isn't support\n", prop_buf);
        free_page((unsigned long)prop_buf);
        return;
      }
    }
    length = sprintf(prop_buf, "%s\n", cmd);
    if (length > 0) {
      if (prop_buf[length - 1] == '\n')
        prop_buf[length - 1] = 0;
      snprintf(state_buf, sizeof(state_buf),
        "SWITCH_STATE=%s", prop_buf);
      envp[env_offset++] = state_buf;
    }
    envp[env_offset] = NULL;  
    pr_info("switch_set_udisk_state: %s\n", envp[env_offset-1]);
    kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
    free_page((unsigned long)prop_buf);
  }
}
Ejemplo n.º 6
0
void switch_set_state(struct switch_dev *sdev, int state)
{
	char name_buf[120];
	char state_buf[120];
	char *prop_buf;
	char *envp[3];
	int env_offset = 0;
	int length;

	if (sdev->state != state) {
		sdev->state = state;

		prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
		if (prop_buf) {
			length = name_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(name_buf, sizeof(name_buf),
					"SWITCH_NAME=%s", prop_buf);
				envp[env_offset++] = name_buf;
			}
			length = state_show(sdev->dev, NULL, prop_buf);
			if (length > 0) {
				if (prop_buf[length - 1] == '\n')
					prop_buf[length - 1] = 0;
				snprintf(state_buf, sizeof(state_buf),
					"SWITCH_STATE=%s", prop_buf);
				envp[env_offset++] = state_buf;
			}
			envp[env_offset] = NULL;
			kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp);
			free_page((unsigned long)prop_buf);
		} else {
			printk(KERN_ERR "out of memory in switch_set_state\n");
			kobject_uevent(&sdev->dev->kobj, KOBJ_CHANGE);
		}

		sysfs_notify(&sdev->dev->kobj, NULL, "state");
	}
}
Ejemplo n.º 7
0
UniValue QNameCoin::nameShow(const QString& name) {
	JSONRPCRequest request;
	request.params.setArray();
	request.params.push_back(name.toStdString());
	return name_show(request);
}