Arduino is likely to release 1.8.5 on Monday or Tuesday.
I need to decide whether to go forward with using libudev, or revert to the old & kludgy scanning of /dev & /dev/bus/usb. Please help me to understand if this libudev change is going to work on a wide range of Linux distros.
As usual, my plan is a week or two of betas, where the first one or two is relatively open to merging features and the ones right before release are (supposed to be) for bug fixes only.
Paul - What things are you interested in merging in?
I have some host usb stuff - A few bug fixes (linked list issue, plus 2 pass looking at drivers for HID, such that Keyboard driver will get first shot even if a HID driver is seen first), plus started to add in additional query functions to get information like VID/PID and also first pass at getting strings...
The most risky is the strings stuff... So could issue PR for all or part.
Also may play some with keyboard stuff. Probably just learning for now.
Also wondering if you would be interested in some simple (maybe stop gap) updates to maybe help minimize system impact by things like yield() and changes to systick... i.e. in both cases don't call off to stuff if feature not used.
For Yield - Was thinking of adding maybe uint16_t variable named something like yieldEventsMask or some such thing.
Probably first pass use a simple KISS like: have Serial1.begin() do something like yieldEventsMask |= 2;
So some of yield might look like:
Code:
void yield(void) __attribute__ ((weak));
void yield(void)
{
static uint8_t running=0;
if (!yieldEventsMask) return; // nothing to do
if (running) return; // TODO: does this need to be atomic?
running = 1;
if ((yieldEventsMask & 1) && Serial.available()) serialEvent();
if ((yieldEventsMask & 2) && Serial1.available()) serialEvent1();
if ((yieldEventsMask & 4) && Serial2.available()) serialEvent2();
if ((yieldEventsMask & 8) && Serial3.available()) serialEvent3();
#ifdef HAS_KINETISK_UART3
if ((yieldEventsMask & 16) && Serial4.available()) serialEvent4();
#endif
#ifdef HAS_KINETISK_UART4
if ((yieldEventsMask & 32) && Serial5.available()) serialEvent5();
#endif
#if defined(HAS_KINETISK_UART5) || defined (HAS_KINETISK_LPUART0)
if ((yieldEventsMask & 64) && Serial6.available()) serialEvent6();
#endif
running = 0;
EventResponder::runFromYield();
};
So the SerialX calls will only be called for those Serial objects that the user actually does a begin on...
Plus I would change the default SerialEvent functions to disable the calls again like:
Code:
void serialEvent1() __attribute__((weak));
void serialEvent1() {yieldEventsMask &= ~2;}
So again the yieldEventsMask would be reset such that the SerialEvent1 will only be called once...
Again this is KISS version, more advanced would be change Serial1 ISR to set the mask value and have Serial1.read clear (when empty)...
Above is not quite correct as I bail if mask is zero... But it did not call the runFromYield... I would actually also change the EventResponder to set a bit in this mask when ever a user adds an event object with the option of running from yield...
Should I try doing this?