Skip to content

Commit

Permalink
Set IOError in __spidev_set_mode if readback differs
Browse files Browse the repository at this point in the history
This fixes doceme#108
  • Loading branch information
JonathonReinhart committed Sep 8, 2020
1 parent a5d82b8 commit d8725c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spidev_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,9 @@ static int __spidev_set_mode( int fd, __u8 mode) {
return -1;
}
if (test != mode) {
PyErr_Format(PyExc_IOError,
"Attempted to set mode 0x%x but mode 0x%x returned",
(unsigned int)mode, (unsigned int)test);
return -1;
}
return 0;
Expand Down

0 comments on commit d8725c4

Please sign in to comment.