~mmach/netext73/busybox

« back to all changes in this revision

Viewing changes to miscutils/i2c_tools.c

  • Committer: mmach
  • Date: 2023-07-06 04:40:25 UTC
  • Revision ID: netbit73@gmail.com-20230706044025-2ia9985i8wzdn2a7
1.36.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
//config:config I2CGET
12
12
//config:       bool "i2cget (5.5 kb)"
13
13
//config:       default y
 
14
//config:       depends on PLATFORM_LINUX
14
15
//config:       help
15
16
//config:       Read from I2C/SMBus chip registers.
16
17
//config:
17
18
//config:config I2CSET
18
19
//config:       bool "i2cset (6.7 kb)"
19
20
//config:       default y
 
21
//config:       depends on PLATFORM_LINUX
20
22
//config:       help
21
23
//config:       Set I2C registers.
22
24
//config:
23
25
//config:config I2CDUMP
24
26
//config:       bool "i2cdump (7.1 kb)"
25
27
//config:       default y
 
28
//config:       depends on PLATFORM_LINUX
26
29
//config:       help
27
30
//config:       Examine I2C registers.
28
31
//config:
29
32
//config:config I2CDETECT
30
33
//config:       bool "i2cdetect (7.1 kb)"
31
34
//config:       default y
 
35
//config:       depends on PLATFORM_LINUX
32
36
//config:       help
33
37
//config:       Detect I2C chips.
34
38
//config:
35
39
//config:config I2CTRANSFER
36
40
//config:       bool "i2ctransfer (4.0 kb)"
37
41
//config:       default y
 
42
//config:       depends on PLATFORM_LINUX
38
43
//config:       help
39
44
//config:       Send user-defined I2C messages in one transfer.
40
45
//config:
120
125
        return ioctl(fd, I2C_SMBUS, &args);
121
126
}
122
127
 
 
128
#if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CDETECT
123
129
static int32_t i2c_smbus_read_byte(int fd)
124
130
{
125
131
        union i2c_smbus_data data;
131
137
 
132
138
        return data.byte;
133
139
}
 
140
#endif
134
141
 
135
142
#if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP
136
143
static int32_t i2c_smbus_write_byte(int fd, uint8_t val)
1212
1219
                }
1213
1220
        }
1214
1221
 
1215
 
        exit(EXIT_SUCCESS);
 
1222
        exit_SUCCESS();
1216
1223
}
1217
1224
 
1218
1225
static void NORETURN no_support(const char *cmd)