Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array indices for kernel 4.7+ support #12

Merged
merged 2 commits into from
Jul 31, 2016

Commits on Jul 31, 2016

  1. eventtable.h: use correct array sizes to fix building against 4.7+ he…

    …aders
    
    During the 4.7 development cycle, commit 9a9b6aa6a8 (Input: add
    SW_PEN_INSERTED define) got added, which has the same numerical value as
    SW_MAX:
    
    +#define SW_PEN_INSERTED                0x0f  /* set = pen inserted */
    +#define SW_MAX                 0x0f
    
    This breaks the build as the SW_NAME array is sized using the SW_MAX macro:
    
    In file included from eventtable.h:21:0,
                     from eventnames.c:11:
    evtable_SW.inc:17:1: error: array index in initializer exceeds array bounds
     EV_MAP(SW_PEN_INSERTED),
     ^
    evtable_SW.inc:17:1: error: (near initialization for ‘SW_NAME’)
    
    The arrays should be sized using the <foo>_CNT (which is MAX+1) macros
    instead of <foo>_MAX.  These got added during the 2.6.24 development cycle,
    so it should be safe to do so unconditially:
    
    commit 7b19ada2ed3c1eccb9fe94d74b05e1428224663d
    Author: Jiri Slaby <jirislaby@gmail.com>
    Date:   Thu Oct 18 23:40:32 2007 -0700
    
        get rid of input BIT* duplicate defines
    
    Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
    jacmet committed Jul 31, 2016
    Configuration menu
    Copy the full SHA
    b906704 View commit details
    Browse the repository at this point in the history
  2. thd: fix off-by-one issue in list_event_table()

    Events are in the 0..MAX range (inclusive), so adjust the range, otherwise
    events equal to max (E.G. SW_PEN_INSERTED) do not get printed.
    
    Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
    jacmet committed Jul 31, 2016
    Configuration menu
    Copy the full SHA
    09dfe4c View commit details
    Browse the repository at this point in the history