WiringPi: Update in response to the latest regulations about I2C/SPI nodes

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: Ia6992332b157a6b078f5d1f67b280d2fc3a09774
This commit is contained in:
Deokgyu Yang
2020-08-24 14:48:59 +09:00
parent 912e3d952b
commit 5ebe86a95c
3 changed files with 16 additions and 3 deletions

View File

@@ -207,7 +207,7 @@ static void doI2Cdetect (UNU int argc, char *argv [])
port = 1;
break;
case MODEL_ODROID_XU3:
if (cmpKernelVersion(KERN_NUM_TO_REVISION, 5, 4, 0))
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 5))
port = 0;
else
port = 1;

View File

@@ -244,15 +244,23 @@ int wiringPiI2CSetup (const int devId)
switch(model) {
case MODEL_ODROID_C1:
case MODEL_ODROID_C2:
case MODEL_ODROID_XU3:
device = "/dev/i2c-1";
break;
case MODEL_ODROID_XU3:
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 5))
device = "/dev/i2c-0";
else
device = "/dev/i2c-1";
break;
case MODEL_ODROID_N1:
device = "/dev/i2c-4";
break;
case MODEL_ODROID_N2:
case MODEL_ODROID_C4:
device = "/dev/i2c-2";
if (cmpKernelVersion(KERN_NUM_TO_REVISION, 4, 9, 230))
device = "/dev/i2c-0";
else
device = "/dev/i2c-2";
break;
}

View File

@@ -150,6 +150,11 @@ int wiringPiSPISetupMode (int channel, int speed, int mode)
sprintf(device, "%s%d", spiDevType0, channel);
break;
case MODEL_ODROID_XU3:
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 5))
sprintf(device, "%s%d", spiDevType0, channel);
else
sprintf(device, "%s%d", spiDevType1, channel);
break;
case MODEL_ODROID_N1:
sprintf(device, "%s%d", spiDevType1, channel);
break;