android驱动下生成设备节点的方法

echo 1 > /sys/devices/platform/s3c2440-i2c.2/i2c-2/2-0055/bqfs_update


static ssize_t set_bqfs_update(struct device *dev,
                        struct device_attribute *attr, const char *buf,
                        size_t count)
{
    struct bq27410_device_info *di = dev_get_drvdata(dev);
    unsigned int    val;

    if (!(sscanf(buf, "%u\n", &val)))
 return -EINVAL;
   
    //upgrade BFG file
    bq27410_DEBUG("set_bqfs_update %d\n", val);
    bq27410_upgrade(di);

    return count;
}

 

static DEVICE_ATTR(bqfs_update, S_IRUGO | S_IWUSR, NULL, set_bqfs_update);

static struct attribute *bq27410_sysfs_entries[] = {
        &dev_attr_bqfs_update.attr,
        NULL
};

static struct attribute_group bq27410_attr_group = {
        .name   = NULL,
        .attrs  = bq27410_sysfs_entries,
};

 

struct i2c_client *client
 retval = sysfs_create_group(&client->dev.kobj, &bq27410_attr_group);
    if (retval) {
        bq27410_DEBUG("sysfs_create_group failed\n");
        goto batt_failed_5;
    }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值