Changes in / [f991b6b:0a549cc] in mainline


Ignore:
Files:
5 added
20 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rf991b6b r0a549cc  
    2828
    2929RD_SRVS_ESSENTIAL += \
     30        $(USPACE_PATH)/srv/hw/char/i8042/i8042 \
    3031        $(USPACE_PATH)/srv/hw/irc/apic/apic \
    3132        $(USPACE_PATH)/srv/hw/irc/i8259/i8259
     
    3839        bus/pci/pciintel \
    3940        bus/isa \
    40         char/i8042 \
    4141        char/ns8250 \
    42         char/ps2mouse \
    43         char/xtkbd \
    4442        bus/usb/ehci\
    4543        bus/usb/ohci \
  • boot/arch/ia64/Makefile.inc

    rf991b6b r0a549cc  
    3737RD_SRVS_NON_ESSENTIAL +=
    3838
    39 RD_SRVS_ESSENTIAL +=
     39RD_SRVS_ESSENTIAL += \
     40        $(USPACE_PATH)/srv/hw/char/i8042/i8042
    4041
    4142SOURCES = \
  • uspace/Makefile

    rf991b6b r0a549cc  
    9393        srv/hid/fb \
    9494        srv/hid/input \
     95        srv/hw/char/i8042 \
    9596        srv/hw/char/s3c24xx_uart \
    9697        srv/net/il/arp \
     
    104105        drv/infrastructure/root \
    105106        drv/infrastructure/rootvirt \
    106         drv/char/i8042 \
    107         drv/char/ps2mouse \
    108         drv/char/xtkbd \
    109107        drv/test/test1 \
    110108        drv/test/test2 \
  • uspace/app/init/init.c

    rf991b6b r0a549cc  
    302302        spawn("/srv/obio");
    303303        srv_start("/srv/cuda_adb");
     304        srv_start("/srv/i8042");
    304305        srv_start("/srv/s3c24ser");
    305306        srv_start("/srv/s3c24ts");
  • uspace/drv/bus/isa/isa.c

    rf991b6b r0a549cc  
    5252#include <dirent.h>
    5353#include <fcntl.h>
    54 #include <ipc/irc.h>
    55 #include <ipc/services.h>
    56 #include <sysinfo.h>
    57 #include <ns.h>
    5854#include <sys/stat.h>
    5955#include <ipc/irc.h>
     
    113109        sysarg_t apic;
    114110        sysarg_t i8259;
    115 
     111       
    116112        async_sess_t *irc_sess = NULL;
    117 
     113       
    118114        if (((sysinfo_get_value("apic", &apic) == EOK) && (apic))
    119115            || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) {
     
    121117                    SERVICE_IRC, 0, 0);
    122118        }
    123 
     119       
    124120        if (!irc_sess)
    125121                return false;
    126 
     122       
    127123        assert(isa_fun);
    128124        const hw_resource_list_t *res = &isa_fun->hw_resources;
     
    131127                if (res->resources[i].type == INTERRUPT) {
    132128                        const int irq = res->resources[i].res.interrupt.irq;
    133 
     129                       
    134130                        async_exch_t *exch = async_exchange_begin(irc_sess);
    135131                        const int rc =
    136132                            async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq);
    137133                        async_exchange_end(exch);
    138 
     134                       
    139135                        if (rc != EOK) {
    140136                                async_hangup(irc_sess);
     
    143139                }
    144140        }
    145 
     141       
    146142        async_hangup(irc_sess);
    147143        return true;
     
    401397
    402398        val = skip_spaces(val);
    403         irq = (int)strtol(val, &end, 10);
     399        irq = (int)strtol(val, &end, 0x10);
    404400
    405401        if (val != end)
  • uspace/drv/bus/isa/isa.dev

    rf991b6b r0a549cc  
    99        io_range 2f8 8
    1010
    11 i8042:
    12         match 100 isa/i8042
     11keyboard:
     12        match 100 isa/keyboard
    1313        irq 1
    14         irq 12
    15         io_range 060 5
    16        
     14        io_range 060 10
    1715
    1816ne2k:
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    rf991b6b r0a549cc  
    5252#include "../usbhid.h"
    5353
     54/** Number of simulated arrow-key presses for singel wheel step. */
     55#define ARROWS_PER_SINGLE_WHEEL 3
     56
    5457#define NAME "mouse"
    5558
     
    6669
    6770const char *HID_MOUSE_FUN_NAME = "mouse";
     71const char *HID_MOUSE_WHEEL_FUN_NAME = "mouse-wheel";
    6872const char *HID_MOUSE_CATEGORY = "mouse";
     73const char *HID_MOUSE_WHEEL_CATEGORY = "keyboard";
    6974
    7075/** Default idle rate for mouses. */
     
    121126
    122127        usb_log_debug("%s: fun->name: %s\n", __FUNCTION__, fun->name);
    123         usb_log_debug("%s: mouse_sess: %p\n",
    124             __FUNCTION__, mouse_dev->mouse_sess);
     128        usb_log_debug("%s: mouse_sess: %p, wheel_sess: %p\n",
     129            __FUNCTION__, mouse_dev->mouse_sess, mouse_dev->wheel_sess);
     130
     131        async_sess_t **sess_ptr = (fun == mouse_dev->mouse_fun) ?
     132            &mouse_dev->mouse_sess : &mouse_dev->wheel_sess;
    125133
    126134        async_sess_t *sess =
    127135            async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
    128136        if (sess != NULL) {
    129                 if (mouse_dev->mouse_sess == NULL) {
    130                         mouse_dev->mouse_sess = sess;
     137                if (*sess_ptr == NULL) {
     138                        *sess_ptr = sess;
    131139                        usb_log_debug("Console session to %s set ok (%p).\n",
    132140                            fun->name, sess);
     
    136144                            fun->name);
    137145                        async_answer_0(icallid, ELIMIT);
    138                         async_hangup(sess);
    139146                }
    140147        } else {
     
    143150        }
    144151}
    145 /*----------------------------------------------------------------------------*/
     152
     153/*----------------------------------------------------------------------------*/
     154
     155static void usb_mouse_send_wheel(const usb_mouse_t *mouse_dev, int wheel)
     156{
     157        unsigned int key = (wheel > 0) ? KC_UP : KC_DOWN;
     158
     159        if (mouse_dev->wheel_sess == NULL) {
     160                usb_log_warning(
     161                    "Connection to console not ready, wheel roll discarded.\n");
     162                return;
     163        }
     164
     165        const unsigned count =
     166            ((wheel < 0) ? -wheel : wheel) * ARROWS_PER_SINGLE_WHEEL;
     167        for (unsigned i = 0; i < count; i++) {
     168                /* Send arrow press and release. */
     169                usb_log_debug2("Sending key %d to the console\n", key);
     170               
     171                async_exch_t *exch = async_exchange_begin(mouse_dev->wheel_sess);
     172               
     173                async_msg_4(exch, KBDEV_EVENT, KEY_PRESS, key, 0, 0);
     174                async_msg_4(exch, KBDEV_EVENT, KEY_RELEASE, key, 0, 0);
     175               
     176                async_exchange_end(exch);
     177        }
     178}
     179
     180/*----------------------------------------------------------------------------*/
     181
    146182static int get_mouse_axis_move_value(uint8_t rid, usb_hid_report_t *report,
    147183    int32_t usage)
     
    167203        return result;
    168204}
    169 /*----------------------------------------------------------------------------*/
     205
    170206static bool usb_mouse_process_report(usb_hid_dev_t *hid_dev,
    171207    usb_mouse_t *mouse_dev)
     
    185221            &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
    186222
    187         if (shift_x || shift_y || wheel) {
     223        if ((shift_x != 0) || (shift_y != 0)) {
    188224                async_exch_t *exch =
    189225                    async_exchange_begin(mouse_dev->mouse_sess);
    190226                if (exch != NULL) {
    191                         async_msg_3(exch, MOUSEEV_MOVE_EVENT,
    192                             shift_x, shift_y, wheel);
     227                        async_req_2_0(exch, MOUSEEV_MOVE_EVENT, shift_x, shift_y);
    193228                        async_exchange_end(exch);
    194229                }
    195230        }
     231
     232        if (wheel != 0)
     233                usb_mouse_send_wheel(mouse_dev, wheel);
    196234
    197235        /* Buttons */
     
    303341        mouse->mouse_fun = fun;
    304342
     343        /*
     344         * Special function for acting as keyboard (wheel)
     345         */
     346        usb_log_debug("Creating DDF function %s...\n",
     347                      HID_MOUSE_WHEEL_FUN_NAME);
     348        fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,
     349            HID_MOUSE_WHEEL_FUN_NAME);
     350        if (fun == NULL) {
     351                usb_log_error("Could not create DDF function node `%s'.\n",
     352                    HID_MOUSE_WHEEL_FUN_NAME);
     353                FUN_UNBIND_DESTROY(mouse->mouse_fun);
     354                mouse->mouse_fun = NULL;
     355                return ENOMEM;
     356        }
     357
     358        /*
     359         * Store the initialized HID device and HID ops
     360         * to the DDF function.
     361         */
     362        fun->ops = &mouse->ops;
     363        fun->driver_data = mouse;
     364
     365        rc = ddf_fun_bind(fun);
     366        if (rc != EOK) {
     367                usb_log_error("Could not bind DDF function `%s': %s.\n",
     368                    fun->name, str_error(rc));
     369                FUN_UNBIND_DESTROY(mouse->mouse_fun);
     370                mouse->mouse_fun = NULL;
     371
     372                fun->driver_data = NULL;
     373                ddf_fun_destroy(fun);
     374                return rc;
     375        }
     376
     377        usb_log_debug("Adding DDF function to category %s...\n",
     378            HID_MOUSE_WHEEL_CATEGORY);
     379        rc = ddf_fun_add_to_category(fun, HID_MOUSE_WHEEL_CATEGORY);
     380        if (rc != EOK) {
     381                usb_log_error(
     382                    "Could not add DDF function to category %s: %s.\n",
     383                    HID_MOUSE_WHEEL_CATEGORY, str_error(rc));
     384
     385                FUN_UNBIND_DESTROY(mouse->mouse_fun);
     386                mouse->mouse_fun = NULL;
     387                FUN_UNBIND_DESTROY(fun);
     388                return rc;
     389        }
     390        mouse->wheel_fun = fun;
     391
    305392        return EOK;
    306393}
    307 /*----------------------------------------------------------------------------*/
     394
     395/*----------------------------------------------------------------------------*/
     396
    308397/** Get highest index of a button mentioned in given report.
    309398 *
     
    427516        }
    428517
     518        if (mouse_dev->wheel_sess != NULL) {
     519                const int ret = async_hangup(mouse_dev->wheel_sess);
     520                if (ret != EOK)
     521                        usb_log_warning("Failed to hang up wheel session: "
     522                            "%p, %s.\n", mouse_dev->wheel_sess, str_error(ret));
     523        }
     524
    429525        FUN_UNBIND_DESTROY(mouse_dev->mouse_fun);
     526        FUN_UNBIND_DESTROY(mouse_dev->wheel_fun);
    430527
    431528        free(mouse_dev->buttons);
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.h

    rf991b6b r0a549cc  
    4848        /** IPC session to console (consumer). */
    4949        async_sess_t *mouse_sess;
     50        async_sess_t *wheel_sess;
    5051
    5152        /* Mouse buttons statuses. */
     
    5657        /* DDF mouse function */
    5758        ddf_fun_t *mouse_fun;
     59        /* DDF mouse function */
     60        ddf_fun_t *wheel_fun;
    5861} usb_mouse_t;
    5962
  • uspace/srv/hid/input/Makefile

    rf991b6b r0a549cc  
    4343        port/adb_mouse.c \
    4444        port/chardev.c \
     45        port/chardev_mouse.c \
    4546        port/gxemul.c \
    4647        port/msim.c \
     
    5152        proto/adb.c \
    5253        proto/mousedev.c \
     54        proto/ps2.c \
    5355        ctl/apple.c \
    5456        ctl/gxe_fb.c \
  • uspace/srv/hid/input/generic/input.c

    rf991b6b r0a549cc  
    172172
    173173/** Mouse pointer has moved. */
    174 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy, int dz)
     174void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy)
    175175{
    176176        async_exch_t *exch = async_exchange_begin(client_sess);
    177         if (dx || dy)
    178                 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy);
    179         if (dz) {
    180                 // TODO: Implement proper wheel support
    181                 keycode_t code = dz > 0 ? KC_UP : KC_DOWN;
    182                 for (int i = 0; i < 3; ++i) {
    183                         async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0);
    184                 }
    185                 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0);
    186         }
     177        async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy);
    187178        async_exchange_end(exch);
    188179}
     
    406397         * them automatically.
    407398         */
     399#if defined(UARCH_amd64)
     400        kbd_add_dev(&chardev_port, &pc_ctl);
     401#endif
    408402#if defined(UARCH_arm32) && defined(MACHINE_gta02)
    409403        kbd_add_dev(&chardev_port, &stty_ctl);
     
    417411#if defined(UARCH_arm32) && defined(MACHINE_integratorcp)
    418412        kbd_add_dev(&pl050_port, &pc_ctl);
     413#endif
     414#if defined(UARCH_ia32)
     415        kbd_add_dev(&chardev_port, &pc_ctl);
     416#endif
     417#if defined(MACHINE_i460GX)
     418        kbd_add_dev(&chardev_port, &pc_ctl);
    419419#endif
    420420#if defined(MACHINE_ski)
     
    450450         * them automatically.
    451451         */
     452#if defined(UARCH_amd64)
     453        mouse_add_dev(&chardev_mouse_port, &ps2_proto);
     454#endif
     455#if defined(UARCH_ia32)
     456        mouse_add_dev(&chardev_mouse_port, &ps2_proto);
     457#endif
     458#if defined(MACHINE_i460GX)
     459        mouse_add_dev(&chardev_mouse_port, &ps2_proto);
     460#endif
    452461#if defined(UARCH_ppc32)
    453462        mouse_add_dev(&adb_mouse_port, &adb_proto);
  • uspace/srv/hid/input/include/mouse.h

    rf991b6b r0a549cc  
    6262
    6363extern void mouse_push_data(mouse_dev_t *, sysarg_t);
    64 extern void mouse_push_event_move(mouse_dev_t *, int, int, int);
     64extern void mouse_push_event_move(mouse_dev_t *, int, int);
    6565extern void mouse_push_event_button(mouse_dev_t *, int, int);
    6666
  • uspace/srv/hid/input/include/mouse_proto.h

    rf991b6b r0a549cc  
    4848
    4949extern mouse_proto_ops_t adb_proto;
     50extern mouse_proto_ops_t ps2_proto;
    5051extern mouse_proto_ops_t mousedev_proto;
    5152
  • uspace/srv/hid/input/port/chardev.c

    rf991b6b r0a549cc  
    6363/** List of devices to try connecting to. */
    6464static const char *in_devs[] = {
     65        "char/ps2a",
    6566        "char/s3c24ser"
    6667};
  • uspace/srv/hid/input/proto/adb.c

    rf991b6b r0a549cc  
    8282       
    8383        if (dx != 0 || dy != 0)
    84                 mouse_push_event_move(mouse_dev, dx, dy, 0);
     84                mouse_push_event_move(mouse_dev, dx, dy);
    8585}
    8686
  • uspace/srv/hid/input/proto/mousedev.c

    rf991b6b r0a549cc  
    9191                switch (IPC_GET_IMETHOD(call)) {
    9292                case MOUSEEV_MOVE_EVENT:
    93                         mouse_push_event_move(mousedev->mouse_dev,
    94                             IPC_GET_ARG1(call), IPC_GET_ARG2(call),
    95                             IPC_GET_ARG3(call));
     93                        mouse_push_event_move(mousedev->mouse_dev, IPC_GET_ARG1(call),
     94                            IPC_GET_ARG2(call));
    9695                        retval = EOK;
    9796                        break;
    9897                case MOUSEEV_BUTTON_EVENT:
    99                         mouse_push_event_button(mousedev->mouse_dev,
    100                             IPC_GET_ARG1(call), IPC_GET_ARG2(call));
     98                        mouse_push_event_button(mousedev->mouse_dev, IPC_GET_ARG1(call),
     99                            IPC_GET_ARG2(call));
    101100                        retval = EOK;
    102101                        break;
Note: See TracChangeset for help on using the changeset viewer.