summaryrefslogtreecommitdiffstats
path: root/kernel/arch/m68k/include/asm/atarikb.h
blob: 68f3622bf591934b380b74715ee964ca5b0ce06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
** atarikb.h -- This header contains the prototypes of functions of
**              the intelligent keyboard of the Atari needed by the
**              mouse and joystick drivers.
**
** Copyright 1994 by Robert de Vries
**
** This file is subject to the terms and conditions of the GNU General Public
** License.  See the file COPYING in the main directory of this archive
** for more details.
**
** Created: 20 Feb 1994 by Robert de Vries
*/

#ifndef _LINUX_ATARIKB_H
#define _LINUX_ATARIKB_H

void ikbd_write(const char *, int);
void ikbd_mouse_button_action(int mode);
void ikbd_mouse_rel_pos(void);
void ikbd_mouse_abs_pos(int xmax, int ymax);
void ikbd_mouse_kbd_mode(int dx, int dy);
void ikbd_mouse_thresh(int x, int y);
void ikbd_mouse_scale(int x, int y);
void ikbd_mouse_pos_get(int *x, int *y);
void ikbd_mouse_pos_set(int x, int y);
void ikbd_mouse_y0_bot(void);
void ikbd_mouse_y0_top(void);
void ikbd_mouse_disable(void);
void ikbd_joystick_event_on(void);
void ikbd_joystick_event_off(void);
void ikbd_joystick_get_state(void);
void ikbd_joystick_disable(void);

/* Hook for MIDI serial driver */
extern void (*atari_MIDI_interrupt_hook) (void);
/* Hook for keyboard inputdev  driver */
extern void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
/* Hook for mouse inputdev  driver */
extern void (*atari_input_mouse_interrupt_hook) (char *);

int atari_keyb_init(void);

#endif /* _LINUX_ATARIKB_H */
an class="p">, 'name': 1, 'state': 2, 'operating_system': 3, 'version': 4} RO = {'name': 0, 'conflicts': 1} CWD = os.getcwd() LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) formatter = logging.Formatter('%(message)s') out_handler = logging.StreamHandler(sys.stdout) out_handler.setFormatter(formatter) LOG.addHandler(out_handler) LOGFILE = 'autodeploy.log' if os.path.isfile(LOGFILE): os.remove(LOGFILE) out_handler = logging.FileHandler(LOGFILE, mode='w') out_handler.setFormatter(formatter) LOG.addHandler(out_handler) os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) def exec_cmd(cmd, check=True): nul_f = open(os.devnull, 'w') process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=nul_f, shell=True) nul_f.close() response = process.communicate()[0].strip() return_code = process.returncode if check: if return_code > 0: print "Failed command: " + str(cmd) print "Command returned response: " + str(response) print "Command return code: " + str(return_code) raise Exception(response) else: print "Command: " + str(cmd) print str(response) return response return response, return_code def run_proc(cmd): process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) return process def parse(printout): parsed_list = [] lines = printout.splitlines() for l in lines[2:]: parsed = [e.strip() for e in l.split('|')] parsed_list.append(parsed) return parsed_list def clean(lines): parsed_list = [] parsed = [] for l in lines.strip().splitlines(): parsed = [] cluttered = [e.strip() for e in l.split(' ')] for p in cluttered: if p: parsed.append(p) parsed_list.append(parsed) return parsed if len(parsed_list) == 1 else parsed_list def err(message): LOG.error('%s\n' % message) sys.exit(1) def warn(message): LOG.warning('%s\n' % message) def check_file_exists(file_path): if not os.path.dirname(file_path): file_path = '%s/%s' % (CWD, file_path) if not os.path.isfile(file_path): err('ERROR: File %s not found\n' % file_path) def check_dir_exists(dir_path): if not os.path.dirname(dir_path): dir_path = '%s/%s' % (CWD, dir_path) if not os.path.isdir(dir_path): err('ERROR: Directory %s not found\n' % dir_path) def create_dir_if_not_exists(dir_path): if not os.path.isdir(dir_path): log('Creating directory %s' % dir_path) os.makedirs(dir_path) def delete(f): if os.path.isfile(f): log('Deleting file %s' % f) os.remove(f) elif os.path.isdir(f): log('Deleting directory %s' % f) shutil.rmtree(f) def commafy(comma_separated_list): l = [c.strip() for c in comma_separated_list.split(',')] return ','.join(l) def check_if_root(): r = exec_cmd('whoami') if r != 'root': err('You need be root to run this application') def log(message): LOG.debug('%s\n' % message) class ArgParser(argparse.ArgumentParser): def error(self, message): sys.stderr.write('ERROR: %s\n' % message) self.print_help() sys.exit(2) def backup(path): src = path dst = path + '_orig' delete(dst) try: shutil.copytree(src, dst) except OSError as e: if e.errno == errno.ENOTDIR: shutil.copy(src, dst) else: raise