[英]Linux i2c eeprom /sys/bus/i2c/…/eeprom file is read only
Thank you. 谢谢。
Peio io
PD: I tried chmod the eeprom file to rwx, but in anycase I receive an error trying to write to the eeprom: "bash: eeprom: Permission denied". PD:我尝试将eeprom文件chmod更改为rwx,但是无论如何,我都会收到尝试写入eeprom的错误消息:“ bash:eeprom:权限被拒绝”。
It appears eeprom Linux driver only implements drivers/misc/eeprom/eeprom.c read sysfs attribute: 看来eeprom Linux驱动程序仅实现driver / misc / eeprom / eeprom.c读取sysfs属性:
https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/eeprom.c#L117 https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/eeprom.c#L117
static const struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};
One problem is that the eeprom.c driver you are using does not support writing the eeprom, as it has no write function. 一个问题是您使用的eeprom.c驱动程序不支持编写eeprom,因为它没有写功能。
Consider using instead the driver at24.c. 考虑改用驱动程序at24.c。 It has functions for writing, for example at24_eeprom_write()
它具有写功能,例如at24_eeprom_write()
In fact, the probe() function of this driver will decide if the part is writable or not, and then setup function calls as needed, when it is writable. 实际上,此驱动程序的probe()函数将确定部件是否可写,然后在需要时调用setup函数。 And the write function isn't available, when the part is read-only.
当零件为只读时,写入功能不可用。 It takes care of this automatically.
它会自动处理此问题。
Here is the code for the at24.c driver for v3.3 of the linux kernel, as you indicate: https://elixir.bootlin.com/linux/v3.3/source/drivers/misc/eeprom/at24.c 如下所示,这是Linux内核v3.3的at24.c驱动程序的代码: https ://elixir.bootlin.com/linux/v3.3/source/drivers/misc/eeprom/at24.c
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.