/* ** JOYSTICK.H ** ** Joystick support functions ** ** Public domain demo by Bob Stout */ typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #define BOOL(x) (!(!(x))) #define SUCCESS 0 struct joystick { LOGICAL switch_0; LOGICAL switch_1; LOGICAL switch_2; LOGICAL switch_3; int pos_Ax; int pos_Ay; int pos_Bx; int pos_By; }; LOGICAL read_joystick(void); /* ** JOYSTICK.C ** ** Joystick support functions ** ** Public domain demo by Bob Stout */ #include #include "joystick.h" struct joystick JoyStick; /* ** read_joystick() ** ** returns SUCCESS or ERROR ** ** fills in global JoyStick structure */ LOGICAL read_joystick(void) { union REGS regs; regs.h.ah = 0x84; /* Read the switches */ regs.x.dx = 0; int86(0x15, ®s, ®s); if (regs.x.cflag) return ERROR; JoyStick.switch_0 = BOOL(regs.h.al & 0x10); JoyStick.switch_1 = BOOL(regs.h.al & 0x20); JoyStick.switch_2 = BOOL(regs.h.al & 0x40); JoyStick.switch_3 = BOOL(regs.h.al & 0x80); regs.h.ah = 0x84; /* Read positions */ regs.x.dx = 1; int86(0x15, ®s, ®s); if (regs.x.cflag) return ERROR; JoyStick.pos_Ax = regs.x.ax; JoyStick.pos_Ay = regs.x.bx; JoyStick.pos_Bx = regs.x.cx; JoyStick.pos_By = regs.x.dx; return SUCCESS; } .git/refs/?h=packet-loop-back&id=28b89118539da03f4b188763e1b2fd1aec0f580a'>refslogtreecommitdiff
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2016-08-04 11:18:49 +0300
committerSagi Grimberg <sagi@grimberg.me>2016-08-04 17:45:10 +0300
commit28b89118539da03f4b188763e1b2fd1aec0f580a (patch)
tree2c004bc3fe811df5a1abf39771c82c9ef518c18c
parent40e64e07213201710a51e270595d6e6c028f9502 (diff)
nvmet: Fix controller serial number inconsistency
The host is allowed to issue identify as many times as it wants, we need to stay consistent when reporting the serial number for a given controller. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de>