Skip to content

Commit

Permalink
Merge pull request doceme#109 from JonathonReinhart/108-error-return-…
Browse files Browse the repository at this point in the history
…without-exception-set

Set IOError in __spidev_set_mode if readback differs
  • Loading branch information
doceme authored Nov 3, 2022
2 parents a5d82b8 + d8725c4 commit 950f36a
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 950f36a

Please sign in to comment.