[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tutor on bit and bitmasks



Hi all,

I need some tutoring on bit and bitmasks.  I am playing around with
the new joystick kernel driver(ver. 1.2.3) and it requires some
kernel options to specify the joystick configuration.  This is what
part of the info file says:

---Documentation/joystick.txt

  For other joystick types (more axes, hats, and buttons) support you'll
need to specify the types either on the kernel command line or on the module
command line, when inserting joy-analog.o into the kernel. The parameters
are:

        js_an=p0,m0,n0,p1,m1,n1 ...

  Where 'p' is the port number, eg. 0x201, which is the standard address.
'm' and 'n' are joystick 0 and joystick 1 bitmasks for the specified
joystick port. The bits in the bitmasks mean:

        Bit | Meaning
        -------------
         0  | Axis 0
         1  | Axis 1
         2  | Axis 2
         3  | Axis 3
         4  | Button 0
         5  | Button 1
         6  | Button 2
         7  | Button 3
         8  | CHF Buttons 4 and 5
         9  | CHF Hat 0
        10  | CHF Hat 1
        11  | FCS Hat

  An example that would confugure the driver to use two two axis, two button
joysticks connected to port 0x201, a single four button four axis joystick
connected to port 0x202, a four axis, six button and two hat CHF compatible
joystick on 0x203, and a two axis four button FCS compatible joystick with a
single hat on 0x207:

        js_an=0x201,0x33,0xcc,0x202,0xff,0x00,0x203,0x7ff,0x00,0x207,0x83f,0x00

--------------

I need to set bits 0,1,4,5,6,7,11 for port 0x201.  I have NO IDEA how
to calculate the bitmask!  Obviously I need to learn this stuff so were
can I read up on this.

Thanks,
Brian 
-- 
Mechanical Engineering                              servis@purdue.edu
Purdue University                   http://www.ecn.purdue.edu/~servis


--  
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: