fixed logging, a bit of worker
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8879 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,7 +36,8 @@
|
|||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#define LOG(text) fputs(text, sLogFile); fflush(sLogFile)
|
inline void LOG(const char *fmt, ...) { char buf[1024]; va_list ap; va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); \
|
||||||
|
fputs(buf, KeyboardInputDevice::sLogFile); fflush(KeyboardInputDevice::sLogFile); }
|
||||||
#else
|
#else
|
||||||
#define LOG(text)
|
#define LOG(text)
|
||||||
#endif
|
#endif
|
||||||
@@ -137,10 +138,7 @@ KeyboardInputDevice::Stop(const char *name, void *cookie)
|
|||||||
{
|
{
|
||||||
keyboard_device *device = (keyboard_device *)cookie;
|
keyboard_device *device = (keyboard_device *)cookie;
|
||||||
|
|
||||||
char log[128];
|
LOG("Stop(%s)\n", name);
|
||||||
snprintf(log, 128, "Stop(%s)\n", name);
|
|
||||||
|
|
||||||
LOG(log);
|
|
||||||
|
|
||||||
device->active = false;
|
device->active = false;
|
||||||
if (device->device_watcher >= 0) {
|
if (device->device_watcher >= 0) {
|
||||||
@@ -156,10 +154,7 @@ status_t
|
|||||||
KeyboardInputDevice::Control(const char *name, void *cookie,
|
KeyboardInputDevice::Control(const char *name, void *cookie,
|
||||||
uint32 command, BMessage *message)
|
uint32 command, BMessage *message)
|
||||||
{
|
{
|
||||||
char log[128];
|
LOG("Control(%s, code: %lu)\n", name, command);
|
||||||
snprintf(log, 128, "Control(%s, code: %lu)\n", name, command);
|
|
||||||
|
|
||||||
LOG(log);
|
|
||||||
|
|
||||||
if (command == B_NODE_MONITOR)
|
if (command == B_NODE_MONITOR)
|
||||||
HandleMonitor(message);
|
HandleMonitor(message);
|
||||||
@@ -269,6 +264,13 @@ int32
|
|||||||
KeyboardInputDevice::DeviceWatcher(void *arg)
|
KeyboardInputDevice::DeviceWatcher(void *arg)
|
||||||
{
|
{
|
||||||
keyboard_device *dev = (keyboard_device *)arg;
|
keyboard_device *dev = (keyboard_device *)arg;
|
||||||
|
uint8 buffer[12];
|
||||||
|
|
||||||
|
while (dev->active) {
|
||||||
|
if (ioctl(dev->fd, kGetNextKey, &buffer) < B_OK)
|
||||||
|
continue;
|
||||||
|
LOG("kGetNextKey : %lx%lx%lx\n", (uint32*)buffer, (uint32*)buffer+1, (uint32*)buffer+2);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t Control(const char *name, void *cookie,
|
virtual status_t Control(const char *name, void *cookie,
|
||||||
uint32 command, BMessage *message);
|
uint32 command, BMessage *message);
|
||||||
|
|
||||||
|
static FILE *sLogFile;
|
||||||
private:
|
private:
|
||||||
status_t HandleMonitor(BMessage *message);
|
status_t HandleMonitor(BMessage *message);
|
||||||
status_t InitFromSettings(void *cookie, uint32 opcode = 0);
|
status_t InitFromSettings(void *cookie, uint32 opcode = 0);
|
||||||
@@ -59,9 +61,7 @@ private:
|
|||||||
static int32 DeviceWatcher(void *arg);
|
static int32 DeviceWatcher(void *arg);
|
||||||
static char *GetShortName(const char *longName);
|
static char *GetShortName(const char *longName);
|
||||||
|
|
||||||
BList fDevices;
|
BList fDevices;
|
||||||
|
|
||||||
static FILE *sLogFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" BInputServerDevice *instantiate_input_device();
|
extern "C" BInputServerDevice *instantiate_input_device();
|
||||||
|
|||||||
Reference in New Issue
Block a user