Changeset 4c53333 in mainline for uspace/srv/hid/input/input.c


Ignore:
Timestamp:
2013-07-11T08:21:10Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64e63ce1
Parents:
80445cf (diff), c8bb1633 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/input.c

    r80445cf r4c53333  
    3838
    3939#include <adt/list.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141#include <fibril_synch.h>
    4242#include <ipc/services.h>
     
    5454#include <io/keycode.h>
    5555#include <loc.h>
    56 #include <input.h>
    57 #include <kbd.h>
    58 #include <kbd_port.h>
    59 #include <kbd_ctl.h>
    60 #include <mouse_proto.h>
    61 #include <layout.h>
    62 #include <mouse.h>
    63 
    64 #define NUM_LAYOUTS  3
     56#include "layout.h"
     57#include "kbd.h"
     58#include "kbd_port.h"
     59#include "kbd_ctl.h"
     60#include "mouse.h"
     61#include "mouse_proto.h"
     62#include "input.h"
     63
     64#define NUM_LAYOUTS  4
    6565
    6666static layout_ops_t *layout[NUM_LAYOUTS] = {
    6767        &us_qwerty_ops,
    6868        &us_dvorak_ops,
    69         &cz_ops
     69        &cz_ops,
     70        &ar_ops
    7071};
    7172
     
    163164        }
    164165       
     166        if (type == KEY_PRESS && (kdev->mods & KM_LCTRL) &&
     167            key == KC_F4) {
     168                layout_destroy(kdev->active_layout);
     169                kdev->active_layout = layout_create(layout[3]);
     170                return;
     171        }
     172       
    165173        ev.type = type;
    166174        ev.key = key;
     
    189197        }
    190198        async_exchange_end(exch);
     199}
     200
     201/** Mouse pointer has moved in absolute mode. */
     202void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y,
     203    unsigned int max_x, unsigned int max_y)
     204{
     205        if (max_x && max_y) {
     206                async_exch_t *exch = async_exchange_begin(client_sess);
     207                async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y);
     208                async_exchange_end(exch);
     209        }
    191210}
    192211
     
    412431        kbd_add_dev(&chardev_port, &stty_ctl);
    413432#endif
    414 #if defined(UARCH_arm32) && defined(MACHINE_testarm) && defined(CONFIG_FB)
    415         kbd_add_dev(&gxemul_port, &gxe_fb_ctl);
    416 #endif
    417 #if defined(UARCH_arm32) && defined(MACHINE_testarm) && !defined(CONFIG_FB)
    418         kbd_add_dev(&gxemul_port, &stty_ctl);
    419 #endif
    420433#if defined(UARCH_arm32) && defined(MACHINE_integratorcp)
    421434        kbd_add_dev(&pl050_port, &pc_ctl);
     
    426439#if defined(MACHINE_msim)
    427440        kbd_add_dev(&msim_port, &stty_ctl);
    428 #endif
    429 #if (defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul)) && defined(CONFIG_FB)
    430         kbd_add_dev(&gxemul_port, &gxe_fb_ctl);
    431 #endif
    432 #if defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul) && !defined(CONFIG_FB)
    433         kbd_add_dev(&gxemul_port, &stty_ctl);
    434441#endif
    435442#if defined(UARCH_ppc32)
     
    635642}
    636643
     644static void usage(char *name)
     645{
     646        printf("Usage: %s <service_name>\n", name);
     647}
     648
    637649int main(int argc, char **argv)
    638650{
     651        if (argc < 2) {
     652                usage(argv[0]);
     653                return 1;
     654        }
     655       
    639656        printf("%s: HelenOS input service\n", NAME);
    640657       
     
    662679        async_set_client_connection(client_connection);
    663680        int rc = loc_server_register(NAME);
    664         if (rc < 0) {
    665                 printf("%s: Unable to register server (%d)\n", NAME, rc);
    666                 return -1;
    667         }
    668        
    669         char kbd[LOC_NAME_MAXLEN + 1];
    670         snprintf(kbd, LOC_NAME_MAXLEN, "%s/%s", NAMESPACE, NAME);
     681        if (rc != EOK) {
     682                printf("%s: Unable to register server\n", NAME);
     683                return rc;
     684        }
    671685       
    672686        service_id_t service_id;
    673         if (loc_service_register(kbd, &service_id) != EOK) {
    674                 printf("%s: Unable to register service %s\n", NAME, kbd);
    675                 return -1;
     687        rc = loc_service_register(argv[1], &service_id);
     688        if (rc != EOK) {
     689                printf("%s: Unable to register service %s\n", NAME, argv[1]);
     690                return rc;
    676691        }
    677692       
     
    680695       
    681696        printf("%s: Accepting connections\n", NAME);
     697        task_retval(0);
    682698        async_manager();
    683699       
Note: See TracChangeset for help on using the changeset viewer.