|
@@ -16,6 +16,16 @@
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
+#ifndef __BIN_ATTR_WO
|
|
|
+#define __BIN_ATTR_WO(_name, _size) { \
|
|
|
+ .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \
|
|
|
+ .write = _name##_write, \
|
|
|
+ .size = _size, \
|
|
|
+}
|
|
|
+#endif // __BIN_ATTR_WO
|
|
|
+
|
|
|
+/////////////////////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
int g_hw = -1, g_sw = -1;
|
|
|
TIVA_ADC g_tadc;
|
|
|
unsigned long long g_nUpTime = 0;
|
|
@@ -301,7 +311,7 @@ static ssize_t period_store(struct kobject *kobj, struct kobj_attribute *attr, c
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
+#if 0
|
|
|
static ssize_t image_read(struct file *pf, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t len)
|
|
|
{
|
|
|
return -EACCES;
|
|
@@ -317,7 +327,10 @@ static ssize_t image_read(struct file *pf, struct kobject *kobj, struct bin_attr
|
|
|
KALERT("%s buf: %p, off: %lld, len: %zu\n", __FUNCTION__, buf, off, len);
|
|
|
return len;*/
|
|
|
}
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
+// only works with image-version 0x144 or greater!
|
|
|
static ssize_t image_write(struct file *pf, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t len)
|
|
|
{
|
|
|
int nRet;
|
|
@@ -696,6 +709,8 @@ static ssize_t ctrl_store(struct kobject *kobj, struct kobj_attribute *attr, con
|
|
|
{
|
|
|
SfAttLockFirmware(false);
|
|
|
KALERT("%s: I2C-Test error: %d!\n", __FUNCTION__, ret);
|
|
|
+ if(ret == -ENOTSUPP)
|
|
|
+ ret = -48; // ENOTSUP in userland
|
|
|
return ret;
|
|
|
}
|
|
|
else
|
|
@@ -822,7 +837,7 @@ struct bin_attribute g_tivaAdcBinAtt = __BIN_ATTR_RO(AdcBin, sizeof(TIVA_ADC));
|
|
|
// tiva firmware
|
|
|
|
|
|
struct kobj_attribute g_tivaVersionAtt = __ATTR_RO(version);
|
|
|
-struct bin_attribute g_tivaFwImageAtt = __BIN_ATTR_RW(image, 0);
|
|
|
+struct bin_attribute g_tivaFwImageAtt = __BIN_ATTR_WO(image, 0);
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
// tiva memory
|