forked from adurbin/iotools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smbus_rw.c
684 lines (602 loc) · 17.8 KB
/
smbus_rw.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
/*
Copyright 2008 Google Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "commands.h"
#include "linux-i2c-dev.h"
enum SMBUS_SIZE
{
/* The following 5 transactions issue a register address preceding the
* transaction. In SMBus lingo, this is "command code." */
SMBUS_SIZE_8 = SIZE8,
SMBUS_SIZE_16 = SIZE16,
SMBUS_SIZE_32 = SIZE32, /* new in smbus 3 */
SMBUS_SIZE_64 = SIZE64,
SMBUS_SIZE_BLOCK,
/* This transaction does not issue a register address. */
SMBUS_SIZE_BYTE,
/* Quick transactions. */
SMBUS_QUICK,
SMBUS_PROC_CALL,
SMBUS_BLOCK_PROC_CALL,
SMBUS_WRITE_READ,
};
typedef union {
data_store fixed;
uint8_t array[I2C_SMBUS_BLOCK_MAX+2];
} SMBUS_DTYPE;
struct smbus_op_params {
int fd;
uint8_t reg;
uint8_t i2c_bus;
uint8_t address;
uint8_t read_count;
int len;
SMBUS_DTYPE data;
};
struct smbus_op {
int size;
int (*perform_op)(struct smbus_op_params *params, const struct smbus_op *op);
};
/* setup a file descriptor for i2c slave access */
static int
open_i2c_slave(unsigned char i2c_bus, unsigned char slave_address)
{
char devfile[15];
int fd;
sprintf(devfile, "/dev/i2c-%d", i2c_bus);
fd = open(devfile, O_RDWR);
if (fd < 0) {
fprintf(stderr, "Couldn't open i2c device file: %s\n",
strerror(errno));
return -1;
}
/* Double cast the last argument for compat with klibc. */
if (ioctl(fd, I2C_SLAVE, (void *)(intptr_t)slave_address) < 0) {
fprintf(stderr,
"Could not attach to i2c bus %d slave address %d: %s\n",
i2c_bus, slave_address, strerror(errno));
close(fd);
return -1;
}
return fd;
}
static int
istrailingjunk(const char *arg, char *end)
{
if (*end != '\0') {
fprintf(stderr, "%s: is followed by junk\n", arg);
return -1;
}
return 0;
}
static int
ismaxortrailingjunk(const char *arg, char *end, unsigned long ldata)
{
if (ldata == LONG_MAX) {
fprintf(stderr, "%s: is LONG_MAX\n", arg);
return -1;
}
return istrailingjunk(arg, end);
}
static int
parse_uint8_base(const char *arg, uint8_t *ret, int base)
{
unsigned long ldata;
char *end;
ldata = strtoul(arg, &end, base);
if (ismaxortrailingjunk(arg, end, ldata))
return -1;
if (ldata > 0xff) {
fprintf(stderr, "%s: won't fit in a byte\n", arg);
return -1;
}
*ret = (uint8_t)ldata;
return 0;
}
static int
parse_uint8(const char *arg, uint8_t *ret)
{
return parse_uint8_base(arg, ret, 0);
}
static int
parse_uint8_hex(const char *arg, uint8_t *ret)
{
return parse_uint8_base(arg, ret, 16);
}
static int
parse_io_width(const char *arg, struct smbus_op_params *params,
const struct smbus_op *op) {
uint64_t ldata;
char *end;
memset(params->data.array, 0, sizeof(params->data.array));
switch (op->size) {
case SMBUS_QUICK:
ldata = strtoul(arg, &end, 0);
if (ismaxortrailingjunk(arg, end, ldata))
return -1;
if (ldata != 0 && ldata != 1) {
fprintf(stderr, "%s: isn't 0 or 1\n", arg);
return -1;
}
params->data.fixed.u8 = ldata;
break;
case SMBUS_SIZE_BYTE:
case SMBUS_SIZE_8:
ldata = strtoul(arg, &end, 0);
if (ismaxortrailingjunk(arg, end, ldata))
return -1;
params->data.fixed.u8 = ldata;
break;
case SMBUS_SIZE_16:
case SMBUS_PROC_CALL:
ldata = strtoul(arg, &end, 0);
if (ismaxortrailingjunk(arg, end, ldata))
return -1;
params->data.fixed.u16 = ldata;
break;
case SMBUS_SIZE_32:
ldata = strtoul(arg, &end, 0);
if (istrailingjunk(arg, end))
return -1;
params->data.fixed.u32 = ldata;
break;
case SMBUS_SIZE_64:
ldata = strtoull(arg, &end, 0);
if (istrailingjunk(arg, end))
return -1;
params->data.fixed.u64 = ldata;
break;
case SMBUS_SIZE_BLOCK:
case SMBUS_BLOCK_PROC_CALL:
case SMBUS_WRITE_READ:
{
int len;
const char *src = arg;
uint8_t *dest;
char str_nibble[3];
len = strlen(arg);
if ((len <= 0) || (len % 2 != 0)) {
fprintf(stderr, "data length (%d) is 0 or odd\n", len);
return -1;
}
if (arg[0] == '0' && (arg[1] == 'x' || arg[1] == 'X')) {
src = &arg[2];
len -= 2;
}
if (len / 2 > I2C_SMBUS_BLOCK_MAX) {
fprintf(stderr, "data has more than %d bytes\n",
I2C_SMBUS_BLOCK_MAX);
return -1;
}
/* NUL-terminate nibble. */
str_nibble[2] = '\0';
/* work by bytes (nibble pairs) */
for (dest = params->data.array; src[0] != '\0'; dest++) {
str_nibble[0] = src[0];
str_nibble[1] = src[1];
if (parse_uint8_hex(str_nibble, dest))
/* parse_uint8_hex has complained */
return -1;
src += 2;
}
params->len = len / 2;
}
break;
default:
fprintf(stderr, "%s: unknown operand size\n", arg);
return -1;
}
return 0;
}
/* print out the data read. */
static void
print_read_data(int size, int read_block_size, SMBUS_DTYPE *data) {
switch (size) {
case SMBUS_SIZE_BYTE:
case SMBUS_SIZE_8:
printf("0x%02X\n", data->fixed.u8);
break;
case SMBUS_SIZE_16:
printf("0x%04X\n", data->fixed.u16);
break;
case SMBUS_SIZE_32:
printf("0x%08X\n", data->fixed.u32);
break;
case SMBUS_SIZE_64:
printf("0x%016llX\n", (long long)data->fixed.u64);
break;
case SMBUS_SIZE_BLOCK:
{
int i;
if (read_block_size > I2C_SMBUS_BLOCK_MAX) /* sanity */
read_block_size = I2C_SMBUS_BLOCK_MAX;
for (i = 0; i < read_block_size; i++)
printf("%02X", data->array[i]);
printf("\n");
}
break;
}
}
/* smbus_prologue is responsible for doing the common bits for both smbus read
* and write. It will parse the comand line arguments and open the appropriate
* i2c device. It returns 1 on success, 0 on failure. */
static int
smbus_prologue(const char *argv[], struct smbus_op_params *params,
const struct smbus_op *op)
{
if (parse_uint8(argv[1], ¶ms->i2c_bus)) {
fprintf(stderr, "invalid adapter value\n");
return -1;
}
if (parse_uint8(argv[2], ¶ms->address)) {
fprintf(stderr, "invalid address value\n");
return -1;
}
/* Only obtain the register if size designates that it is not a byte
* or quick operation. */
if (op->size != SMBUS_SIZE_BYTE &&
op->size != SMBUS_QUICK &&
op->size != SMBUS_WRITE_READ) {
if (parse_uint8(argv[3], ¶ms->reg)) {
fprintf(stderr, "invalid register value\n");
return -1;
}
}
params->fd = open_i2c_slave(params->i2c_bus, params->address);
if (params->fd < 0) {
fprintf(stderr, "can't open slave\n");
return -1;
}
return 0;
}
static int
smbus_read(int argc, const char *argv[], const struct cmd_info *info)
{
int ret;
struct smbus_op_params params;
const struct smbus_op *op =
(const struct smbus_op *)info->privdata;
if (smbus_prologue(argv, ¶ms, op) < 0) {
return -1;
}
ret = op->perform_op(¶ms, op);
close(params.fd);
return ret;
}
static int
smbus_read_op(struct smbus_op_params *params, const struct smbus_op *op)
{
int64_t result;
memset(¶ms->data, 0, sizeof(params->data));
switch (op->size) {
case SMBUS_SIZE_8:
result = i2c_smbus_read_byte_data(params->fd, params->reg);
params->data.fixed.u8 = result;
break;
case SMBUS_SIZE_16:
result = i2c_smbus_read_word_data(params->fd, params->reg);
params->data.fixed.u16 = result;
break;
case SMBUS_SIZE_32:
result = i2c_smbus_read_i2c_block_data(params->fd, params->reg,
4, (uint8_t *)¶ms->data.fixed.u32);
if (result != 4)
result = -1;
break;
case SMBUS_SIZE_64:
result = i2c_smbus_read_i2c_block_data(params->fd, params->reg,
8, (uint8_t *)¶ms->data.fixed.u64);
if (result != 8)
result = -1;
break;
case SMBUS_SIZE_BLOCK:
/* result is number of bytes */
result = i2c_smbus_read_block_data(params->fd, params->reg,
params->data.array);
break;
case SMBUS_SIZE_BYTE:
result = i2c_smbus_read_byte(params->fd);
params->data.fixed.u8 = result;
break;
default:
fprintf(stderr, "Illegal SMBus size for read operation.\n");
return -1;
}
/* if result contains the number of bytes read; make sure it is >= 1
* otherwise make sure result >= 0 */
if (result < 0) {
if (op->size != SMBUS_SIZE_BYTE) {
fprintf(stderr, "can't read register 0x%02X, %s\n",
params->reg, strerror(errno));
} else {
fprintf(stderr, "can't read from device 0x%02X, %s\n",
params->address, strerror(errno));
}
return -1;
}
print_read_data(op->size, result, ¶ms->data);
return 0;
}
static int
smbus_write(int argc, const char *argv[], const struct cmd_info *info)
{
int ret;
struct smbus_op_params params;
const struct smbus_op *op =
(const struct smbus_op *)info->privdata;
/* All SMBus write operations use argv[4] except for the send_byte
* and quick operations which uses 3. */
int arg_num = 4;
if (smbus_prologue(argv, ¶ms, op) < 0) {
return -1;
}
if (op->size == SMBUS_SIZE_BYTE || op->size == SMBUS_QUICK) {
arg_num = 3;
}
if (parse_io_width(argv[arg_num], ¶ms, op) < 0 ) {
fprintf(stderr, "%s: %s: invalid value to write\n",
argv[0], argv[arg_num]);
close(params.fd);
return -1;
}
ret = op->perform_op(¶ms, op);
close(params.fd);
return ret;
}
static int
smbus_write_op(struct smbus_op_params *params, const struct smbus_op *op)
{
int result;
/* FIXME: Why is this needed if the open_i2c_slave performs the ioctl
* with I2C_SLAVE? */
/* Double cast the last argument for compat with klibc. */
if (ioctl(params->fd, I2C_SLAVE_FORCE,
(void *)(intptr_t)params->address) < 0) {
fprintf(stderr, "can't set address 0x%02X, %s\n",
params->address, strerror(errno));
return -1;
}
switch (op->size) {
case SMBUS_SIZE_8:
result = i2c_smbus_write_byte_data(params->fd, params->reg,
params->data.fixed.u8);
break;
case SMBUS_SIZE_16:
result = i2c_smbus_write_word_data(params->fd, params->reg,
params->data.fixed.u16);
break;
case SMBUS_SIZE_32:
result = i2c_smbus_write_i2c_block_data(params->fd, params->reg,
4, (uint8_t *)¶ms->data.fixed.u32);
break;
case SMBUS_SIZE_64:
result = i2c_smbus_write_i2c_block_data(params->fd, params->reg,
8, (uint8_t *)¶ms->data.fixed.u64);
break;
case SMBUS_SIZE_BLOCK:
result = i2c_smbus_write_block_data(params->fd, params->reg,
params->len, params->data.array);
break;
case SMBUS_SIZE_BYTE:
result = i2c_smbus_write_byte(params->fd,
params->data.fixed.u8);
break;
case SMBUS_QUICK:
result = i2c_smbus_write_quick(params->fd,
params->data.fixed.u8);
break;
default:
fprintf(stderr, "Illegal SMBus size for write operation.\n");
return -1;
}
if (result < 0) {
if (op->size != SMBUS_SIZE_BYTE && op->size != SMBUS_QUICK) {
fprintf(stderr, "can't write register 0x%02X, %s\n",
params->reg, strerror(errno));
} else {
fprintf(stderr, "can't write to device 0x%02X, %s\n",
params->address, strerror(errno));
}
return -1;
}
return 0;
}
/* Used for both process_call and block_process_call */
static int
smbus_process_call(int argc, const char *argv[], const struct cmd_info *info)
{
int ret;
struct smbus_op_params params;
const struct smbus_op *op = (const struct smbus_op *)info->privdata;
if (smbus_prologue(argv, ¶ms, op) < 0) {
return -1;
}
if (parse_io_width(argv[4], ¶ms, op) < 0) {
fprintf(stderr, "%s: %s: invalid value to write\n",
argv[0], argv[4]);
close(params.fd);
return -1;
}
ret = op->perform_op(¶ms, op);
close(params.fd);
return ret;
}
static int
smbus_process_call_op(struct smbus_op_params *params,
const struct smbus_op *op)
{
int result;
if (ioctl(params->fd, I2C_SLAVE_FORCE,
(void *)(intptr_t)params->address) < 0) {
fprintf(stderr, "can't set address 0x%02X, %s\n",
params->address, strerror(errno));
return -1;
}
result = i2c_smbus_process_call(params->fd, params->reg,
params->data.fixed.u16);
if (result < 0) {
fprintf(stderr, "SMBUS Process call failed: %s.\n",
strerror(errno));
return -1;
}
print_read_data(SMBUS_SIZE_16, 0, ¶ms->data);
return 0;
}
static int
smbus_block_process_call_op(struct smbus_op_params *params,
const struct smbus_op *op)
{
int read_block_size;
if (ioctl(params->fd, I2C_SLAVE_FORCE,
(void *)(intptr_t)params->address) < 0) {
fprintf(stderr, "can't set address 0x%02X, %s\n",
params->address, strerror(errno));
return -1;
}
/* returns number of read bytes */
read_block_size = i2c_smbus_block_process_call(params->fd, params->reg,
params->len,
params->data.array);
if (read_block_size < 0) {
fprintf(stderr, "SMBUS Process call failed: %s.\n",
strerror(errno));
return -1;
}
print_read_data(SMBUS_SIZE_BLOCK, read_block_size, ¶ms->data);
return 0;
}
static int
smbus_writeread(int argc, const char *argv[], const struct cmd_info *info)
{
int ret;
struct smbus_op_params params;
memset(¶ms, 0, sizeof(params));
const struct smbus_op *op = (const struct smbus_op *)info->privdata;
if (smbus_prologue(argv, ¶ms, op) < 0) {
return -1;
}
if (parse_io_width(argv[3], ¶ms, op) < 0) {
fprintf(stderr, "%s: %s: invalid value to write\n",
argv[0], argv[3]);
close(params.fd);
return -1;
}
if(parse_uint8(argv[4], ¶ms.read_count) < 0) {
fprintf(stderr, "invalid read count %s.\n", argv[4]);
return -1;
}
if (params.read_count > I2C_SMBUS_BLOCK_MAX) {
fprintf(stderr, "read count %s > %d.\n",
argv[3], I2C_SMBUS_BLOCK_MAX);
return -1;
}
ret = op->perform_op(¶ms, op);
close(params.fd);
return ret;
}
static int
smbus_writeread_op(struct smbus_op_params *params, const struct smbus_op *op)
{
struct i2c_msg msg[2];
struct i2c_rdwr_ioctl_data data;
/* First transfer: write the params bytes */
msg[0].addr = params->address;
msg[0].flags = 0;
msg[0].len = params->len;
msg[0].buf = (char*) params->data.array;
/* Second transfer: read `read_count` bytes */
msg[1].addr = params->address;
msg[1].flags = I2C_M_RD;
msg[1].len = params->read_count;
msg[1].buf = (char*) params->data.array;
/* Run the transfers */
data.msgs = msg;
data.nmsgs = 2;
int rv = ioctl(params->fd, I2C_RDWR, &data);
/* Error check */
if (rv < 0) {
fprintf(stderr, "I2C_RDWR failed: %s\n", strerror(errno));
return -1;
}
print_read_data(SMBUS_SIZE_BLOCK, params->read_count, ¶ms->data);
return 0;
}
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_read_params, 4,
"<adapter> <address> <register>", 0);
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_write_params, 5,
"<adapter> <address> <register> <value>", 0);
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_receive_byte_params, 3,
"<adapter> <address>", 0);
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_send_byte_params, 4,
"<adapter> <address> <value>", 0);
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_quick_params, 4,
"<adapter> <address> <0|1>", 0);
MAKE_PREREQ_PARAMS_FIXED_ARGS(smbus_writeread_params, 5,
"<adapter> <address> <write_value> <read_count>", 0);
#define MAKE_SMBUS_OP(name_, size_, fn_) \
static const struct smbus_op name_ = { \
.size = size_, \
.perform_op = fn_, \
}
#define MAKE_SMBUS_RW_OP(name_, size_, rd_fn_, wr_fn_) \
MAKE_SMBUS_OP(name_## _r, SMBUS_SIZE_ ##size_, rd_fn_); \
MAKE_SMBUS_OP(name_## _w, SMBUS_SIZE_ ##size_, wr_fn_)
MAKE_SMBUS_RW_OP(smbus_op_8, 8, smbus_read_op, smbus_write_op);
MAKE_SMBUS_RW_OP(smbus_op_16, 16, smbus_read_op, smbus_write_op);
MAKE_SMBUS_RW_OP(smbus_op_32, 32, smbus_read_op, smbus_write_op);
MAKE_SMBUS_RW_OP(smbus_op_64, 64, smbus_read_op, smbus_write_op);
MAKE_SMBUS_RW_OP(smbus_op_block, BLOCK, smbus_read_op, smbus_write_op);
MAKE_SMBUS_RW_OP(smbus_op_byte, BYTE, smbus_read_op, smbus_write_op);
MAKE_SMBUS_OP(smbus_op_quick, SMBUS_QUICK, smbus_write_op);
MAKE_SMBUS_OP(smbus_op_proc_call, SMBUS_PROC_CALL, smbus_process_call_op);
MAKE_SMBUS_OP(smbus_op_block_proc_call, SMBUS_BLOCK_PROC_CALL,
smbus_block_process_call_op);
MAKE_SMBUS_OP(smbus_op_writeread, SMBUS_WRITE_READ, smbus_writeread_op);
#define MAKE_SMBUS_RW_CMDS(size_) \
MAKE_CMD_WITH_PARAMS(smbus_read ##size_, smbus_read, \
&smbus_op_ ##size_## _r, &smbus_read_params), \
MAKE_CMD_WITH_PARAMS(smbus_write ##size_, smbus_write, \
&smbus_op_ ##size_## _w, &smbus_write_params)
static const struct cmd_info smbus_cmds[] = {
MAKE_SMBUS_RW_CMDS(8),
MAKE_SMBUS_RW_CMDS(16),
MAKE_SMBUS_RW_CMDS(32),
MAKE_SMBUS_RW_CMDS(64),
MAKE_SMBUS_RW_CMDS(block),
MAKE_CMD_WITH_PARAMS(smbus_receive_byte, smbus_read,
&smbus_op_byte_r, &smbus_receive_byte_params),
MAKE_CMD_WITH_PARAMS(smbus_send_byte, smbus_write,
&smbus_op_byte_w, &smbus_send_byte_params),
MAKE_CMD_WITH_PARAMS(smbus_quick, smbus_write,
&smbus_op_quick, &smbus_quick_params),
MAKE_CMD_WITH_PARAMS(smbus_process_call, smbus_process_call,
&smbus_op_proc_call, &smbus_write_params),
MAKE_CMD_WITH_PARAMS(smbus_block_process_call, smbus_process_call,
&smbus_op_block_proc_call, &smbus_write_params),
MAKE_CMD_WITH_PARAMS(smbus_writeread, smbus_writeread,
&smbus_op_writeread, &smbus_writeread_params),
};
MAKE_CMD_GROUP(SMBus, "commands to access the system management bus",
smbus_cmds);
REGISTER_CMD_GROUP(SMBus);