Permalink
Browse files

Fix for Kernel 4.1.6 mailbox open bug

  • Loading branch information...
Gadgetoid committed Aug 24, 2015
1 parent fb6519b commit 5c03f81b72eb2e44c58f850db4e3fad90dc3d7a7
Showing with 16 additions and 9 deletions.
  1. +15 −8 python/rpi-ws281x/lib/mailbox.c
  2. +1 −1 python/rpi-ws281x/setup.py
@@ -272,19 +272,26 @@ int mbox_open(void) {
char filename[64];
// open a char device file used for communicating with kernel mbox driver
sprintf(filename, "/tmp/mailbox-%d", getpid());
unlink(filename);
if (mknod(filename, S_IFCHR|0600, makedev(100, 0)) < 0) {
printf("Failed to create mailbox device %s: %m\n", filename);
return -1;
}
sprintf(filename, "/dev/vcio");
file_desc = open(filename, 0);
if( file_desc < 0 ){
printf("Failed to open %s, trying old method.\n", filename);
sprintf(filename, "/dev/mailbox-%d", getpid());
unlink(filename);
if (mknod(filename, S_IFCHR|0600, makedev(100, 0)) < 0) {
printf("Failed to create mailbox device %s: %m\n", filename);
return -1;
}
file_desc = open(filename, 0);
}
if (file_desc < 0) {
printf("Can't open device file %s: %m\n", filename);
unlink(filename);
//unlink(filename);
return -1;
}
unlink(filename);
//unlink(filename);
return file_desc;
}
@@ -14,7 +14,7 @@ def run(self):
setup(name = 'rpi_ws281x',
version = '1.1.3',
version = '1.2.0',
author = 'Jeremy Garff',
author_email = 'jer@jers.net',
description = 'Userspace Raspberry Pi PWM library for WS281X LEDs.',

0 comments on commit 5c03f81

Please sign in to comment.