after close and recreate got Bad file decriptor
wiryonolau opened this issue · comments
Hi what is the clean way to close and reuse spidev
I close the board then try recreate and got this error when recreate ( program still running )
spi.close()
spi = spidev.SpiDev()
# when calling
spi.xfer([REG.LORA.OP_MODE | 0x80, 128])
<class 'OSError'>, OSError(9, 'Bad file descriptor')
We use the pySX127x Lora library
REG.LORA_OP_MODE is 0x01
Found the problem , closing this issue
I run in a GUI Application using pygobject which has start and stop button to read from spi
If I do spi.close() on stop event, the next start event will have bad file descriptor error.
I can only do spi.close() when the application is closing
It's looks like the application is still holding the file when you do spi.close() if it still running.