aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2003-04-23 03:28:08 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2003-04-23 03:28:08 +0000
commit9714822cd34663b1b84b6ca50fc6489f6d861cb4 (patch)
tree8f62b126cb00c115b5391b74f60c24f7c8cc074b
parenteff0da1ac49d73efb7d0a592443dc21b47e5c9e5 (diff)
moved to rawhid folder
svn path=/trunk/externals/hcs/; revision=588
-rw-r--r--rawevent.c368
-rw-r--r--rawevent.pd14
-rw-r--r--rawjoystick.c267
-rw-r--r--rawjoystick.pd98
-rw-r--r--rawmouse.c415
-rw-r--r--rawmouse.pd16
6 files changed, 0 insertions, 1178 deletions
diff --git a/rawevent.c b/rawevent.c
deleted file mode 100644
index 8bcb01a..0000000
--- a/rawevent.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* (C) Guenter Geiger <geiger@epy.co.at> */
-
-
-#include <m_imp.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-#include <linux/input.h>
-
-#include <sys/stat.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <termios.h>
-
-#define DEBUG(x)
-/*#define DEBUG(x) x */
-
-#define RAWEVENT_DEVICE "/dev/input/event0"
-#define RAWEVENT_OUTLETS 4
-
-/*------------------------------------------------------------------------------
- * from evtest.c from the ff-utils package
- */
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x) ((x)%BITS_PER_LONG)
-#define BIT(x) (1UL<<OFF(x))
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
-
-
-char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL, "ForceFeedbackStatus"};
-char *keys[KEY_MAX + 1] = { "Reserved", "Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Minus", "Equal", "Backspace",
-"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "LeftBrace", "RightBrace", "Enter", "LeftControl", "A", "S", "D", "F", "G",
-"H", "J", "K", "L", "Semicolon", "Apostrophe", "Grave", "LeftShift", "BackSlash", "Z", "X", "C", "V", "B", "N", "M", "Comma", "Dot",
-"Slash", "RightShift", "KPAsterisk", "LeftAlt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
-"NumLock", "ScrollLock", "KP7", "KP8", "KP9", "KPMinus", "KP4", "KP5", "KP6", "KPPlus", "KP1", "KP2", "KP3", "KP0", "KPDot", "103rd",
-"F13", "102nd", "F11", "F12", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "KPEnter", "RightCtrl", "KPSlash", "SysRq",
-"RightAlt", "LineFeed", "Home", "Up", "PageUp", "Left", "Right", "End", "Down", "PageDown", "Insert", "Delete", "Macro", "Mute",
-"VolumeDown", "VolumeUp", "Power", "KPEqual", "KPPlusMinus", "Pause", "F21", "F22", "F23", "F24", "KPComma", "LeftMeta", "RightMeta",
-"Compose", "Stop", "Again", "Props", "Undo", "Front", "Copy", "Open", "Paste", "Find", "Cut", "Help", "Menu", "Calc", "Setup",
-"Sleep", "WakeUp", "File", "SendFile", "DeleteFile", "X-fer", "Prog1", "Prog2", "WWW", "MSDOS", "Coffee", "Direction",
-"CycleWindows", "Mail", "Bookmarks", "Computer", "Back", "Forward", "CloseCD", "EjectCD", "EjectCloseCD", "NextSong", "PlayPause",
-"PreviousSong", "StopCD", "Record", "Rewind", "Phone", "ISOKey", "Config", "HomePage", "Refresh", "Exit", "Move", "Edit", "ScrollUp",
-"ScrollDown", "KPLeftParenthesis", "KPRightParenthesis",
-"International1", "International2", "International3", "International4", "International5",
-"International6", "International7", "International8", "International9",
-"Language1", "Language2", "Language3", "Language4", "Language5", "Language6", "Language7", "Language8", "Language9",
-NULL,
-"PlayCD", "PauseCD", "Prog3", "Prog4", "Suspend", "Close",
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9",
-NULL, NULL, NULL, NULL, NULL, NULL,
-"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn",
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn",
-"BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6",
-NULL, NULL, NULL, "BtnDead",
-"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode",
-"BtnThumbL", "BtnThumbR", NULL,
-"ToolPen", "ToolRubber", "ToolBrush", "ToolPencil", "ToolAirbrush", "ToolFinger", "ToolMouse", "ToolLens", NULL, NULL,
-"Touch", "Stylus", "Stylus2" };
-
-char *absval[5] = { "Value", "Min ", "Max ", "Fuzz ", "Flat " };
-char *relatives[REL_MAX + 1] = { "X", "Y", "Z", NULL, NULL, NULL, "HWheel", "Dial", "Wheel" };
-char *absolutes[ABS_MAX + 1] = { "X", "Y", "Z", "Rx", "Ry", "Rz", "Throttle", "Rudder", "Wheel", "Gas", "Brake",
-NULL, NULL, NULL, NULL, NULL,
-"Hat0X", "Hat0Y", "Hat1X", "Hat1Y", "Hat2X", "Hat2Y", "Hat3X", "Hat 3Y", "Pressure", "Distance", "XTilt", "YTilt"};
-char *leds[LED_MAX + 1] = { "NumLock", "CapsLock", "ScrollLock", "Compose", "Kana", "Sleep", "Suspend", "Mute" };
-char *repeats[REP_MAX + 1] = { "Delay", "Period" };
-char *sounds[SND_MAX + 1] = { "Bell", "Click" };
-
-char **names[EV_MAX + 1] = { events, keys, relatives, absolutes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, leds, sounds, NULL, repeats, NULL, NULL, NULL };
-
-/*------------------------------------------------------------------------------
- */
-
-/*------------------------------------------------------------------------------
- * CLASS DEF
- */
-static t_class *rawevent_class;
-
-typedef struct _rawevent {
- t_object x_obj;
- t_int x_fd;
- t_symbol* x_devname;
- int read_ok;
- int started;
- struct input_event x_input_event;
- t_outlet *x_input_event_time_outlet;
- t_outlet *x_input_event_type_outlet;
- t_outlet *x_input_event_code_outlet;
- t_outlet *x_input_event_value_outlet;
-}t_rawevent;
-
-/*------------------------------------------------------------------------------
- * IMPLEMENTATION
- */
-
-//DONE
-static int rawevent_close(t_rawevent *x)
-{
- DEBUG(post("rawevent_close");)
-
- if (x->x_fd <0) return 0;
-
- close (x->x_fd);
-
- return 1;
-}
-
-//DONE
-static int rawevent_open(t_rawevent *x,t_symbol* s)
-{
- int eventType, eventCode, buttons, rel_axes, abs_axes, ff;
- unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
- char devicename[256] = "Unknown";
- DEBUG(post("rawevent_open");)
-
- rawevent_close(x);
-
- /* set obj device name to parameter
- * otherwise set to default
- */
- if (s != &s_)
- x->x_devname = s;
- else {
- post("You need to set a input device (i.e /dev/input/event0)");
- }
-
- /* open device */
- if (x->x_devname) {
- post("opening ...");
- /* open the rawevent device read-only, non-exclusive */
- x->x_fd = open (x->x_devname->s_name, O_RDONLY | O_NONBLOCK);
- if (x->x_fd >= 0 ) post("done");
- else post("failed");
- }
- else {
- return 1;
- }
-
- /* test if device open */
- if (x->x_fd >= 0)
- post("%s opened",x->x_devname->s_name);
- else {
- post("unable to open %s",x->x_devname->s_name);
- x->x_fd = -1;
- return 0;
- }
-
- /* read input_events from the RAWEVENT_DEVICE stream
- * It seems that is just there to flush the event input buffer?
- */
- while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1);
-
- /* get name of device */
- ioctl(x->x_fd, EVIOCGNAME(sizeof(devicename)), devicename);
- post ("configuring %s",devicename);
-
- /* get bitmask representing supported events (axes, buttons, etc.) */
- memset(bitmask, 0, sizeof(bitmask));
- ioctl(x->x_fd, EVIOCGBIT(0, EV_MAX), bitmask[0]);
- post("Supported events:");
-
- rel_axes = 0;
- abs_axes = 0;
- buttons = 0;
- ff = 0;
-
- /* cycle through all possible event types */
- for (eventType = 0; eventType < EV_MAX; eventType++) {
- if (test_bit(eventType, bitmask[0])) {
- post(" %s (type %d) ", events[eventType] ? events[eventType] : "?", eventType);
- // post("Event type %d",eventType);
-
- /* get bitmask representing supported button types */
- ioctl(x->x_fd, EVIOCGBIT(eventType, KEY_MAX), bitmask[eventType]);
-
- /* cycle through all possible event codes (axes, keys, etc.)
- * testing to see which are supported
- */
- for (eventCode = 0; eventCode < KEY_MAX; eventCode++)
- if (test_bit(eventCode, bitmask[eventType])) {
- post(" Event code %d (%s)", eventCode, names[eventType] ? (names[eventType][eventCode] ? names[eventType][eventCode] : "?") : "?");
-
- switch(eventType) {
- case EV_RST:
- break;
- case EV_KEY:
- buttons++;
- break;
- case EV_REL:
- rel_axes++;
- break;
- case EV_ABS:
- abs_axes++;
- break;
- case EV_MSC:
- break;
- case EV_LED:
- break;
- case EV_SND:
- break;
- case EV_REP:
- break;
- case EV_FF:
- ff++;
- break;
- }
- }
- }
- }
-
- post ("\nUsing %d relative axes, %d absolute axes, and %d buttons.", rel_axes, abs_axes, buttons);
- if (ff > 0) post ("Detected %d force feedback types",ff);
- post ("");
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
- post ("This object is under development! The interface could change at anytime!");
- post ("As I write cross-platform versions, the interface might have to change.");
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
-
- return 1;
-}
-
-
-
-static int rawevent_read(t_rawevent *x,int fd)
-{
- int readBytes;
- int axis_num = 0;
- t_float button_num = 0;
-
- if (x->x_fd < 0) return 0;
- if (x->read_ok) {
- readBytes = read(x->x_fd, &(x->x_input_event), sizeof(struct input_event));
- DEBUG(post("reading %d",readBytes);)
- if ( readBytes < 0 ) {
- post("rawevent: read failed");
- x->read_ok = 0;
- return 0;
- }
- }
- /* outlet_float (x->x_input_event_time_outlet, x->x_input_event.time); */
- outlet_float (x->x_input_event_type_outlet, x->x_input_event.type);
- outlet_float (x->x_input_event_code_outlet, x->x_input_event.code);
- outlet_float (x->x_input_event_value_outlet, (int)x->x_input_event.value);
-
- return 1;
-}
-
-
-
-/* Actions */
-
-static void rawevent_bang(t_rawevent* x)
-{
- DEBUG(post("rawevent_bang");)
-
-}
-
-static void rawevent_float(t_rawevent* x)
-{
- DEBUG(post("rawevent_float");)
-
-}
-
-// DONE
-void rawevent_start(t_rawevent* x)
-{
- DEBUG(post("rawevent_start");)
-
- if (x->x_fd >= 0 && !x->started) {
- sys_addpollfn(x->x_fd, (t_fdpollfn)rawevent_read, x);
- post("rawevent: start");
- x->started = 1;
- }
-}
-
-
-// DONE
-void rawevent_stop(t_rawevent* x)
-{
- DEBUG(post("rawevent_stop");)
-
- if (x->x_fd >= 0 && x->started) {
- sys_rmpollfn(x->x_fd);
- post("rawevent: stop");
- x->started = 0;
- }
-}
-
-/* Misc setup functions */
-
-
-static void rawevent_free(t_rawevent* x)
-{
- DEBUG(post("rawevent_free");)
-
- if (x->x_fd < 0) return;
-
- rawevent_stop(x);
-
- close (x->x_fd);
-}
-
-static void *rawevent_new(t_symbol *s)
-{
- int i;
- t_rawevent *x = (t_rawevent *)pd_new(rawevent_class);
-
- DEBUG(post("rawevent_new");)
-
- /* init vars */
- x->x_fd = -1;
- x->read_ok = 1;
- x->started = 0;
-
- /* create outlets for each axis */
- x->x_input_event_time_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_input_event_type_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_input_event_code_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_input_event_value_outlet = outlet_new(&x->x_obj, &s_float);
-
- if (s != &s_)
- x->x_devname = s;
-
- /* Open the device and save settings */
-
- if (!rawevent_open(x,s)) return x;
-
- return (x);
-}
-
-
-void rawevent_setup(void)
-{
- DEBUG(post("rawevent_setup");)
- rawevent_class = class_new(gensym("rawevent"),
- (t_newmethod)rawevent_new,
- (t_method)rawevent_free,
- sizeof(t_rawevent),0,A_DEFSYM,0);
-
- /* add inlet datatype methods */
- class_addfloat(rawevent_class,(t_method) rawevent_float);
- class_addbang(rawevent_class,(t_method) rawevent_bang);
-
- /* add inlet message methods */
- class_addmethod(rawevent_class, (t_method) rawevent_open,gensym("open"),A_DEFSYM);
- class_addmethod(rawevent_class,(t_method) rawevent_close,gensym("close"),0);
- class_addmethod(rawevent_class,(t_method) rawevent_start,gensym("start"),0);
- class_addmethod(rawevent_class,(t_method) rawevent_stop,gensym("stop"),0);
-
-}
-
diff --git a/rawevent.pd b/rawevent.pd
deleted file mode 100644
index 6903ec7..0000000
--- a/rawevent.pd
+++ /dev/null
@@ -1,14 +0,0 @@
-#N canvas 454 205 450 300 10;
-#X floatatom 244 176 5 0 0 3 code - -;
-#X floatatom 303 176 5 0 0 3 value - -;
-#X floatatom 185 176 4 0 0 3 type - -;
-#X floatatom 112 176 9 0 0 3 time - -;
-#X msg 176 53 start;
-#X msg 187 91 stop;
-#X obj 126 123 rawevent /dev/input/event0;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 3 0;
-#X connect 6 1 2 0;
-#X connect 6 2 0 0;
-#X connect 6 3 1 0;
diff --git a/rawjoystick.c b/rawjoystick.c
deleted file mode 100644
index 163cce8..0000000
--- a/rawjoystick.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/* Copyright 2003 Hans-Christoph Steiner <hans@eds.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-/*
- * $Id: rawjoystick.c,v 1.3 2003-04-22 21:46:22 eighthave Exp $
- */
-static char *version = "$Revision: 1.3 $";
-
-#include <m_imp.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-#include <SDL/SDL.h>
-
-#include <sys/stat.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <termios.h>
-
-/*#define DEBUG(x) */
-#define DEBUG(x) x
-
-#define RAWJOYSTICK_AXES 6
-#define RAWJOYSTICK_BUTTONS 9
-
-
-/*------------------------------------------------------------------------------
- * CLASS DEF
- */
-static t_class *rawjoystick_class;
-
-typedef struct _rawjoystick {
- t_object x_obj;
- SDL_Joystick *x_joystick;
- t_int x_devnum;
- int read_ok;
- int started;
- t_outlet *x_axis_out[RAWJOYSTICK_AXES];
- t_outlet *x_button_num_out;
- t_outlet *x_button_val_out;
- t_clock *x_clock;
- double x_delaytime;
- int x_buttons;
- int x_hats;
- int x_axes;
-} t_rawjoystick;
-
-/*------------------------------------------------------------------------------
- */
-
-static int rawjoystick_close(t_rawjoystick *x) {
- DEBUG(post("rawjoystick_CLOSE"));
-
- if ( SDL_JoystickOpened(x->x_devnum) ) {
- SDL_JoystickClose(x->x_joystick);
- return 1;
- }
- else {
- return 0;
- }
-}
-
-static int rawjoystick_open(t_rawjoystick *x) {
- rawjoystick_close(x);
-
- DEBUG(post("rawjoystick_OPEN"));
-
- /* open device */
- SDL_JoystickEventState(SDL_ENABLE);
- x->x_joystick = SDL_JoystickOpen(x->x_devnum);
-
- /* test if device open */
- /* get name of device */
- if ( SDL_JoystickOpened(x->x_devnum) ) {
- post ("Configuring %s",SDL_JoystickName(x->x_devnum));
- }
- else {
- return 0;
- }
-
- x->x_axes = SDL_JoystickNumAxes(x->x_joystick);
- x->x_hats = SDL_JoystickNumHats(x->x_joystick);
- x->x_buttons = SDL_JoystickNumButtons(x->x_joystick);
-
- post (" device has %i axes, %i hats, and %i buttons.\n",x->x_axes,x->x_hats,x->x_buttons);
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
- post ("This object is under development! The interface could change at anytime!");
- post ("As I write cross-platform versions, the interface might have to change.");
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
-
- return 1;
-}
-
-static int rawjoystick_read(t_rawjoystick *x,int fd) {
- SDL_Event event;
-
- DEBUG(post("rawjoystick_READ"));
-
- if ( ! SDL_JoystickOpened(x->x_devnum) ) {
- return 0;
- }
-
- post("Joystick read: %s",SDL_JoystickName(x->x_devnum));
-
- if ( SDL_PollEvent(&event) ) {
- post("SDL_Event.type: %i",event.type);
- post("SDL_JoyAxisEvent.value: %i",event.jaxis.value);
- post("SDL_JoyButtonEvent.value: %i",event.jbutton.state);
- switch (event.type) {
- case SDL_JOYAXISMOTION:
- outlet_float (x->x_axis_out[event.jaxis.axis], event.jaxis.value);
- break;
- case SDL_JOYHATMOTION:
- break;
- case SDL_JOYBUTTONDOWN:
- outlet_float (x->x_button_val_out, 1);
- outlet_float (x->x_button_num_out, event.jaxis.axis);
- break;
- case SDL_JOYBUTTONUP:
- outlet_float (x->x_button_val_out, 0);
- outlet_float (x->x_button_num_out, event.jaxis.axis);
- break;
- default:
- DEBUG(post("Unhandled event."));
- }
- }
-
- return 1;
-}
-
-/* Actions */
-
-static void rawjoystick_bang(t_rawjoystick* x) {
- DEBUG(post("rawjoystick_bang"));
-}
-
-static void rawjoystick_float(t_rawjoystick* x) {
- DEBUG(post("rawjoystick_float"));
-}
-
-// DONE
-void rawjoystick_start(t_rawjoystick* x)
-{
- DEBUG(post("rawjoystick_START"));
-
- if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( ! x->started ) ) {
- sys_addpollfn(x->x_devnum, (t_fdpollfn)rawjoystick_read, x);
- x->started = 1;
- }
-}
-
-
-// DONE
-void rawjoystick_stop(t_rawjoystick* x) {
- DEBUG(post("rawjoystick_STOP");)
-
- if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( x->started ) ) {
- sys_rmpollfn(x->x_devnum);
- x->started = 0;
- }
-}
-
-/* Misc setup functions */
-
-
-static void rawjoystick_free(t_rawjoystick* x) {
- DEBUG(post("rawjoystick_free"));
-
- rawjoystick_stop(x);
-
- if ( SDL_JoystickOpened(x->x_devnum))
- SDL_JoystickClose(x->x_joystick);
-
- SDL_Quit();
-}
-
-static void *rawjoystick_new(t_float argument) {
- int i,joystickNumber;
- t_rawjoystick *x = (t_rawjoystick *)pd_new(rawjoystick_class);
-
- DEBUG(post("rawjoystick_NEW"));
- post("rawHID objects, %s", version);
- post(" by Hans-Christoph Steiner <hans@eds.org>");
-
- /* init vars */
- x->x_devnum = 0;
- x->read_ok = 1;
- x->started = 0;
-
- /* INIT SDL using joystick layer */
- if ( SDL_Init( SDL_INIT_JOYSTICK ) == -1 ) {
- post("Could not initialize SDL: %s.\n", SDL_GetError());
- exit(-1);
- }
-
- post("%i joysticks were found:", SDL_NumJoysticks() );
-
- for( i=0; i < SDL_NumJoysticks(); i++ ) {
- post(" %s", SDL_JoystickName(i));
- }
-
- joystickNumber = (int)argument;
-
- if ( (joystickNumber >= 0) && (joystickNumber < SDL_NumJoysticks() ) )
- x->x_devnum = joystickNumber;
- else
- post("Joystick %i does not exist!",joystickNumber);
-
- /* create outlets for each axis */
- for (i = 0; i < RAWJOYSTICK_AXES; i++)
- x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
-
- /* create outlets for buttons */
- x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
- x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
-
- /* Open the device and save settings */
-
- if ( ! rawjoystick_open(x) ) return x;
-
- return (x);
-}
-
-
-void rawjoystick_setup(void)
-{
- DEBUG(post("rawjoystick_setup");)
- rawjoystick_class = class_new(gensym("rawjoystick"),
- (t_newmethod)rawjoystick_new,
- (t_method)rawjoystick_free,
- sizeof(t_rawjoystick),0,A_DEFSYM,0);
-
- /* add inlet datatype methods */
- class_addfloat(rawjoystick_class,(t_method) rawjoystick_float);
- class_addbang(rawjoystick_class,(t_method) rawjoystick_bang);
-
- /* add inlet message methods */
- class_addmethod(rawjoystick_class,(t_method) rawjoystick_open,gensym("open"),0);
- class_addmethod(rawjoystick_class,(t_method) rawjoystick_close,gensym("close"),0);
- class_addmethod(rawjoystick_class,(t_method) rawjoystick_start,gensym("start"),0);
- class_addmethod(rawjoystick_class,(t_method) rawjoystick_stop,gensym("stop"),0);
- class_addmethod(rawjoystick_class,(t_method) rawjoystick_read,gensym("read"),0);
-
-}
-
diff --git a/rawjoystick.pd b/rawjoystick.pd
deleted file mode 100644
index 5b9c71c..0000000
--- a/rawjoystick.pd
+++ /dev/null
@@ -1,98 +0,0 @@
-#N canvas 61 386 886 505 10;
-#X msg 192 64 start;
-#X msg 203 95 stop;
-#X floatatom 397 180 2 0 0 3 button# - -;
-#X floatatom 454 179 2 0 0 3 button_value - -;
-#X floatatom 143 180 5 0 0 3 y-axis - -;
-#X floatatom 95 180 5 0 0 3 x-axis - -;
-#X floatatom 242 181 3 0 0 3 hat-X - -;
-#X floatatom 288 181 3 0 0 3 hat-Y - -;
-#X floatatom 192 181 5 0 0 3 twist - -;
-#X floatatom 331 180 5 0 0 3 throttle - -;
-#X obj 192 123 rawjoystick /dev/input/event1;
-#X obj 299 309 select 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
-19 20 21;
-#X obj 297 354 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 313 355 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 333 354 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 351 354 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 370 353 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 389 354 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 409 353 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 734 354 bng 30 250 50 0 empty empty not_recognized 0 -6 0 8
--261689 -1 -1;
-#X obj 689 352 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 667 350 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 647 351 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 631 354 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 613 352 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 596 350 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 579 352 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 561 351 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 541 349 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 523 351 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 503 350 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 485 351 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 466 351 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 447 353 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 428 353 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 439 220 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X connect 0 0 10 0;
-#X connect 1 0 10 0;
-#X connect 2 0 11 0;
-#X connect 3 0 35 0;
-#X connect 10 0 5 0;
-#X connect 10 1 4 0;
-#X connect 10 2 8 0;
-#X connect 10 3 6 0;
-#X connect 10 4 7 0;
-#X connect 10 5 9 0;
-#X connect 10 6 2 0;
-#X connect 10 7 3 0;
-#X connect 11 0 12 0;
-#X connect 11 1 13 0;
-#X connect 11 2 14 0;
-#X connect 11 3 15 0;
-#X connect 11 4 16 0;
-#X connect 11 5 17 0;
-#X connect 11 6 18 0;
-#X connect 11 7 34 0;
-#X connect 11 8 33 0;
-#X connect 11 9 32 0;
-#X connect 11 10 31 0;
-#X connect 11 11 30 0;
-#X connect 11 12 29 0;
-#X connect 11 13 28 0;
-#X connect 11 14 27 0;
-#X connect 11 15 26 0;
-#X connect 11 16 25 0;
-#X connect 11 17 24 0;
-#X connect 11 18 23 0;
-#X connect 11 19 22 0;
-#X connect 11 20 21 0;
-#X connect 11 21 20 0;
-#X connect 11 22 19 0;
-#X connect 35 0 2 0;
diff --git a/rawmouse.c b/rawmouse.c
deleted file mode 100644
index 091465e..0000000
--- a/rawmouse.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/* (C) Guenter Geiger <geiger@epy.co.at> */
-
-
-#include <m_imp.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-#include <linux/input.h>
-
-#include <sys/stat.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <termios.h>
-
-#define DEBUG(x)
-/*#define DEBUG(x) x */
-
-
-#define RAWMOUSE_DEVICE "/dev/input/event0"
-
-// scaling factor for output
-#define DEF_SCALE 1
-// delay/refresh time in milliseconds
-#define DEF_DELTIME 5
-
-#define RAWMOUSE_AXES 3
-#define RAWMOUSE_BUTTONS 7
-
-/* from <linux/input.h>
-// button types
-#define BTN_LEFT 0x110
-#define BTN_RIGHT 0x111
-#define BTN_MIDDLE 0x112
-#define BTN_SIDE 0x113
-#define BTN_EXTRA 0x114
-#define BTN_FORWARD 0x115
-#define BTN_BACK 0x116
-
-// axes
-#define REL_X 0x00
-#define REL_Y 0x01
-#define REL_WHEEL 0x08
-*/
-
-
-/*------------------------------------------------------------------------------
- * from evtest.c from the ff-utils package
- */
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define OFF(x) ((x)%BITS_PER_LONG)
-#define BIT(x) (1UL<<OFF(x))
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
-
-
-char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL, "ForceFeedbackStatus"};
-char *keys[KEY_MAX + 1] = { "Reserved", "Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Minus", "Equal", "Backspace",
-"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "LeftBrace", "RightBrace", "Enter", "LeftControl", "A", "S", "D", "F", "G",
-"H", "J", "K", "L", "Semicolon", "Apostrophe", "Grave", "LeftShift", "BackSlash", "Z", "X", "C", "V", "B", "N", "M", "Comma", "Dot",
-"Slash", "RightShift", "KPAsterisk", "LeftAlt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
-"NumLock", "ScrollLock", "KP7", "KP8", "KP9", "KPMinus", "KP4", "KP5", "KP6", "KPPlus", "KP1", "KP2", "KP3", "KP0", "KPDot", "103rd",
-"F13", "102nd", "F11", "F12", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "KPEnter", "RightCtrl", "KPSlash", "SysRq",
-"RightAlt", "LineFeed", "Home", "Up", "PageUp", "Left", "Right", "End", "Down", "PageDown", "Insert", "Delete", "Macro", "Mute",
-"VolumeDown", "VolumeUp", "Power", "KPEqual", "KPPlusMinus", "Pause", "F21", "F22", "F23", "F24", "KPComma", "LeftMeta", "RightMeta",
-"Compose", "Stop", "Again", "Props", "Undo", "Front", "Copy", "Open", "Paste", "Find", "Cut", "Help", "Menu", "Calc", "Setup",
-"Sleep", "WakeUp", "File", "SendFile", "DeleteFile", "X-fer", "Prog1", "Prog2", "WWW", "MSDOS", "Coffee", "Direction",
-"CycleWindows", "Mail", "Bookmarks", "Computer", "Back", "Forward", "CloseCD", "EjectCD", "EjectCloseCD", "NextSong", "PlayPause",
-"PreviousSong", "StopCD", "Record", "Rewind", "Phone", "ISOKey", "Config", "HomePage", "Refresh", "Exit", "Move", "Edit", "ScrollUp",
-"ScrollDown", "KPLeftParenthesis", "KPRightParenthesis",
-"International1", "International2", "International3", "International4", "International5",
-"International6", "International7", "International8", "International9",
-"Language1", "Language2", "Language3", "Language4", "Language5", "Language6", "Language7", "Language8", "Language9",
-NULL,
-"PlayCD", "PauseCD", "Prog3", "Prog4", "Suspend", "Close",
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9",
-NULL, NULL, NULL, NULL, NULL, NULL,
-"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn",
-NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn",
-"BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6",
-NULL, NULL, NULL, "BtnDead",
-"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode",
-"BtnThumbL", "BtnThumbR", NULL,
-"ToolPen", "ToolRubber", "ToolBrush", "ToolPencil", "ToolAirbrush", "ToolFinger", "ToolMouse", "ToolLens", NULL, NULL,
-"Touch", "Stylus", "Stylus2" };
-
-char *absval[5] = { "Value", "Min ", "Max ", "Fuzz ", "Flat " };
-char *relatives[REL_MAX + 1] = { "X", "Y", "Z", NULL, NULL, NULL, "HWheel", "Dial", "Wheel" };
-char *absolutes[ABS_MAX + 1] = { "X", "Y", "Z", "Rx", "Ry", "Rz", "Throttle", "Rudder", "Wheel", "Gas", "Brake",
-NULL, NULL, NULL, NULL, NULL,
-"Hat0X", "Hat0Y", "Hat1X", "Hat1Y", "Hat2X", "Hat2Y", "Hat3X", "Hat 3Y", "Pressure", "Distance", "XTilt", "YTilt"};
-char *leds[LED_MAX + 1] = { "NumLock", "CapsLock", "ScrollLock", "Compose", "Kana", "Sleep", "Suspend", "Mute" };
-char *repeats[REP_MAX + 1] = { "Delay", "Period" };
-char *sounds[SND_MAX + 1] = { "Bell", "Click" };
-
-char **names[EV_MAX + 1] = { events, keys, relatives, absolutes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-NULL, NULL, leds, sounds, NULL, repeats, NULL, NULL, NULL };
-
-/*------------------------------------------------------------------------------
- */
-
-/*------------------------------------------------------------------------------
- * CLASS DEF
- */
-static t_class *rawmouse_class;
-
-typedef struct _rawmouse {
- t_object x_obj;
- t_int x_fd;
- t_symbol* x_devname;
- int read_ok;
- int started;
- struct input_event x_input_event;
- float x_scale;
- float x_translation;
- t_outlet *x_axis_out[RAWMOUSE_AXES];
- t_outlet *x_button_num_out;
- t_outlet *x_button_val_out;
- t_clock *x_clock;
- double x_delaytime;
- unsigned char x_buttons;
- unsigned char x_axes;
-}t_rawmouse;
-
-/*------------------------------------------------------------------------------
- * IMPLEMENTATION
- */
-
-//DONE
-static int rawmouse_close(t_rawmouse *x)
-{
- DEBUG(post("rawmouse_close");)
-
- if (x->x_fd <0) return 0;
-
- close (x->x_fd);
-
- return 1;
-}
-
-//DONE
-static int rawmouse_open(t_rawmouse *x,t_symbol* s)
-{
- int eventType, eventCode;
- unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
- char devicename[256] = "Unknown";
- DEBUG(post("rawmouse_open");)
-
- rawmouse_close(x);
-
- /* set obj device name to parameter
- * otherwise set to default
- */
- if (s != &s_)
- x->x_devname = s;
- else {
- post("You need to set a input device (i.e /dev/input/event0)");
- }
-
- /* open device */
- if (x->x_devname) {
- post("opening ...");
- /* open the rawmouse device read-only, non-exclusive */
- x->x_fd = open (x->x_devname->s_name, O_RDONLY | O_NONBLOCK);
- if (x->x_fd >= 0 ) post("done");
- else post("failed");
- }
- else {
- return 1;
- }
-
- /* test if device open */
- if (x->x_fd >= 0)
- post("%s opened",x->x_devname->s_name);
- else {
- post("unable to open %s",x->x_devname->s_name);
- x->x_fd = -1;
- return 0;
- }
-
- /* read input_events from the RAWMOUSE_DEVICE stream
- * It seems that is just there to flush the event input buffer?
- */
- while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1);
-
- /* get name of device */
- ioctl(x->x_fd, EVIOCGNAME(sizeof(devicename)), devicename);
- post ("configuring %s",devicename);
-
- /* get bitmask representing supported events (axes, buttons, etc.) */
- memset(bitmask, 0, sizeof(bitmask));
- ioctl(x->x_fd, EVIOCGBIT(0, EV_MAX), bitmask[0]);
- post("Supported events:");
-
- x->x_axes = 0;
- x->x_buttons = 0;
-
- /* cycle through all possible event types */
- for (eventType = 0; eventType < EV_MAX; eventType++) {
- if (test_bit(eventType, bitmask[0])) {
- post(" %s (type %d) ", events[eventType] ? events[eventType] : "?", eventType);
- // post("Event type %d",eventType);
-
- /* get bitmask representing supported button types */
- ioctl(x->x_fd, EVIOCGBIT(eventType, KEY_MAX), bitmask[eventType]);
-
- /* cycle through all possible event codes (axes, keys, etc.)
- * testing to see which are supported
- */
- for (eventCode = 0; eventCode < KEY_MAX; eventCode++)
- if (test_bit(eventCode, bitmask[eventType])) {
- post(" Event code %d (%s)", eventCode, names[eventType] ? (names[eventType][eventCode] ? names[eventType][eventCode] : "?") : "?");
-
- if ( eventType == EV_KEY )
- x->x_buttons++;
- else if ( eventType == EV_REL )
- x->x_axes++;
- }
- }
- }
-
- post ("\nUsing %d axes and %d buttons.", x->x_axes, x->x_buttons);
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
- post ("This object is under development! The interface could change at anytime!");
- post ("As I write cross-platform versions, the interface might have to change.");
- post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
-
- return 1;
-}
-
-
-
-static int rawmouse_read(t_rawmouse *x,int fd)
-{
- int readBytes;
- int axis_num = 0;
- t_float button_num = 0;
-
- if (x->x_fd < 0) return 0;
- if (x->read_ok) {
- readBytes = read(x->x_fd, &(x->x_input_event), sizeof(struct input_event));
- DEBUG(post("reading %d",readBytes);)
- if ( readBytes < 0 ) {
- post("rawmouse: read failed");
- x->read_ok = 0;
- return 0;
- }
- }
- if ( x->x_input_event.type == EV_KEY ) {
- /* key/button event type */
- switch ( x->x_input_event.code ) {
- case BTN_LEFT:
- button_num = 0;
- break;
- case BTN_RIGHT:
- button_num = 1;
- break;
- case BTN_MIDDLE:
- button_num = 2;
- break;
- case BTN_SIDE:
- button_num = 3;
- break;
- case BTN_EXTRA:
- button_num = 4;
- break;
- case BTN_FORWARD:
- button_num = 5;
- break;
- case BTN_BACK:
- button_num = 6;
- break;
- }
- outlet_float (x->x_button_val_out, x->x_input_event.value);
- outlet_float (x->x_button_num_out, button_num);
- }
- else if ( x->x_input_event.type == EV_REL ) {
- /* Relative Axes Event Type */
- switch ( x->x_input_event.code ) {
- case REL_X:
- axis_num = 0;
- break;
- case REL_Y:
- axis_num = 1;
- break;
- case REL_WHEEL:
- axis_num = 2;
- break;
- }
- outlet_float (x->x_axis_out[axis_num], (int)x->x_input_event.value);
- }
-
- return 1;
-}
-
-
-
-/* Actions */
-
-static void rawmouse_bang(t_rawmouse* x)
-{
- DEBUG(post("rawmouse_bang");)
-
-}
-
-static void rawmouse_float(t_rawmouse* x)
-{
- DEBUG(post("rawmouse_float");)
-
-}
-
-// DONE
-void rawmouse_start(t_rawmouse* x)
-{
- DEBUG(post("rawmouse_start");)
-
- if (x->x_fd >= 0 && !x->started) {
- sys_addpollfn(x->x_fd, (t_fdpollfn)rawmouse_read, x);
- post("rawmouse: start");
- x->started = 1;
- }
-}
-
-
-// DONE
-void rawmouse_stop(t_rawmouse* x)
-{
- DEBUG(post("rawmouse_stop");)
-
- if (x->x_fd >= 0 && x->started) {
- sys_rmpollfn(x->x_fd);
- post("rawmouse: stop");
- x->started = 0;
- }
-}
-
-/* Misc setup functions */
-
-
-static void rawmouse_free(t_rawmouse* x)
-{
- DEBUG(post("rawmouse_free");)
-
- if (x->x_fd < 0) return;
-
- rawmouse_stop(x);
-
- close (x->x_fd);
-}
-
-static void *rawmouse_new(t_symbol *s)
-{
- int i;
- t_rawmouse *x = (t_rawmouse *)pd_new(rawmouse_class);
-
- DEBUG(post("rawmouse_new");)
-
- /* init vars */
- x->x_fd = -1;
- x->read_ok = 1;
- x->started = 0;
-
- /* create outlets for each axis */
- for (i = 0; i < RAWMOUSE_AXES; i++)
- x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
-
- /* create outlets for buttons */
- x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
- x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
-
- if (s != &s_)
- x->x_devname = s;
-
- /* Open the device and save settings */
-
- if (!rawmouse_open(x,s)) return x;
-
- return (x);
-}
-
-
-void rawmouse_setup(void)
-{
- DEBUG(post("rawmouse_setup");)
- rawmouse_class = class_new(gensym("rawmouse"),
- (t_newmethod)rawmouse_new,
- (t_method)rawmouse_free,
- sizeof(t_rawmouse),0,A_DEFSYM,0);
-
- /* add inlet datatype methods */
- class_addfloat(rawmouse_class,(t_method) rawmouse_float);
- class_addbang(rawmouse_class,(t_method) rawmouse_bang);
-
- /* add inlet message methods */
- class_addmethod(rawmouse_class, (t_method) rawmouse_open,gensym("open"),A_DEFSYM);
- class_addmethod(rawmouse_class,(t_method) rawmouse_close,gensym("close"),0);
- class_addmethod(rawmouse_class,(t_method) rawmouse_start,gensym("start"),0);
- class_addmethod(rawmouse_class,(t_method) rawmouse_stop,gensym("stop"),0);
-
-}
-
diff --git a/rawmouse.pd b/rawmouse.pd
deleted file mode 100644
index d3e4303..0000000
--- a/rawmouse.pd
+++ /dev/null
@@ -1,16 +0,0 @@
-#N canvas 454 205 450 300 10;
-#X floatatom 258 160 5 0 0 3 button# - -;
-#X floatatom 321 162 5 0 0 3 button_value - -;
-#X floatatom 175 160 2 0 0 3 wheel - -;
-#X floatatom 99 161 4 0 0 3 y-axis - -;
-#X floatatom 24 162 4 0 0 3 x-axis - -;
-#X obj 75 110 rawmouse /dev/input/event0;
-#X msg 125 40 start;
-#X msg 136 78 stop;
-#X connect 5 0 4 0;
-#X connect 5 1 3 0;
-#X connect 5 2 2 0;
-#X connect 5 3 0 0;
-#X connect 5 4 1 0;
-#X connect 6 0 5 0;
-#X connect 7 0 5 0;