Skip to content

Commit 8dfbf64

Browse files
committed
Fix spidev path mismatch (#216)
Remove unnecessary call to get_spi_bus_path_number() and use the bus and device passed to SPI_open(). Signed-off-by: Drew Fustini <drew@pdp7.com>
1 parent 2d5e218 commit 8dfbf64

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

source/spimodule.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ static PyObject *
703703
SPI_open(SPI *self, PyObject *args, PyObject *kwds)
704704
{
705705
int bus, device;
706-
int bus_path;
707706
int max_dt_length = 15;
708707
char device_tree_name[max_dt_length];
709708
char path[MAXPATH];
@@ -722,14 +721,7 @@ SPI_open(SPI *self, PyObject *args, PyObject *kwds)
722721
return NULL;
723722
}
724723

725-
bus_path = get_spi_bus_path_number(bus);
726-
if (bus_path == -1) {
727-
PyErr_SetString(PyExc_OverflowError,
728-
"Unable to find loaded spi bus path.");
729-
return NULL;
730-
}
731-
732-
if (snprintf(path, MAXPATH, "/dev/spidev%d.%d", bus_path, device) >= MAXPATH) {
724+
if (snprintf(path, MAXPATH, "/dev/spidev%d.%d", bus, device) >= MAXPATH) {
733725
PyErr_SetString(PyExc_OverflowError,
734726
"Bus and/or device number is invalid.");
735727
return NULL;

0 commit comments

Comments
 (0)