Changes in / [bf45993:824208bf] in mainline


Ignore:
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    rbf45993 r824208bf  
    22*.map
    33*.prev
    4 *.ag.probe.[cs]
    54Makefile.depend
    65Makefile.common
     
    296295uspace/srv/klog/klog
    297296uspace/dist/srv/klog
    298 kernel/arch/sparc64/include/arch/context_struct.h
    299 kernel/arch/sparc64/include/arch/istate_struct.h
    300 kernel/arch/amd64/include/arch/context_struct.h
    301 kernel/arch/amd64/include/arch/istate_struct.h
    302 kernel/arch/ia32/include/arch/context_struct.h
    303 kernel/arch/ia32/include/arch/istate_struct.h
    304 kernel/arch/ppc32/include/arch/context_struct.h
    305 kernel/arch/ppc32/include/arch/fpu_context_struct.h
    306 kernel/arch/ppc32/include/arch/istate_struct.h
    307 kernel/arch/arm32/include/arch/context_struct.h
    308 kernel/arch/arm32/include/arch/istate_struct.h
    309 kernel/arch/mips32/include/arch/context_struct.h
    310 kernel/arch/mips32/include/arch/fpu_context_struct.h
    311 kernel/arch/mips32/include/arch/istate_struct.h
    312 kernel/arch/ia64/include/arch/context_struct.h
    313 kernel/arch/ia64/include/arch/istate_struct.h
    314 uspace/lib/c/arch/sparc64/include/libarch/fibril_context.h
    315 uspace/lib/c/arch/sparc64/include/libarch/istate_struct.h
    316 uspace/lib/c/arch/amd64/include/libarch/fibril_context.h
    317 uspace/lib/c/arch/amd64/include/libarch/istate_struct.h
    318 uspace/lib/c/arch/ia32/include/libarch/fibril_context.h
    319 uspace/lib/c/arch/ia32/include/libarch/istate_struct.h
    320 uspace/lib/c/arch/ppc32/include/libarch/fibril_context.h
    321 uspace/lib/c/arch/ppc32/include/libarch/istate_struct.h
    322 uspace/lib/c/arch/arm32/include/libarch/fibril_context.h
    323 uspace/lib/c/arch/arm32/include/libarch/istate_struct.h
    324 uspace/lib/c/arch/mips32eb/include/libarch/fibril_context.h
    325 uspace/lib/c/arch/mips32eb/include/libarch/istate_struct.h
    326 uspace/lib/c/arch/mips32/include/libarch/fibril_context.h
    327 uspace/lib/c/arch/mips32/include/libarch/istate_struct.h
    328 uspace/lib/c/arch/ia64/include/libarch/fibril_context.h
    329 uspace/lib/c/arch/ia64/include/libarch/istate_struct.h
  • contrib/qfs/qfs.sh

    rbf45993 r824208bf  
    1 #!/bin/bash
    2 
     1#!/usr/bin/bash
    32#
    4 # Copyright (c) 2014 Jakub Jermar
     3# Copyright (c) 2014 Jakub Jermar 
    54# All rights reserved.
    65#
     
    3130VERSION=2.1.1
    3231BASENAME=qemu-${VERSION}
    33 BASENAME_MASTER=qemu-master
    3432TARBALL=${BASENAME}.tar.bz2
    3533SOURCEDIR=${BASENAME}
    3634URL=http://wiki.qemu-project.org/download/${TARBALL}
    37 REPO=git://git.qemu.org/qemu.git
    3835MD5="78b1b51bfa2eee424e1bfdf3b66daa64"
    3936
    40 if [ "$1" == "--master" ]; then
    41         git clone ${REPO} ${BASENAME_MASTER}
    42         cd ${BASENAME_MASTER}
    43 else
    44         if [ ! -f ${TARBALL} ]; then
    45                 wget ${URL}
    46         fi
    47        
    48         if [ "`md5sum ${TARBALL} | cut -f 1 -d " "`" != ${MD5} ]; then
    49                 echo Wrong MD5 checksum
    50                 exit
    51         fi
    52        
    53         tar xvfj ${TARBALL}
    54         cd ${SOURCEDIR}
     37if [ ! -f ${TARBALL} ];
     38then
     39        wget ${URL}
    5540fi
    5641
     42if [ `md5sum ${TARBALL} | cut -f 1 -d " "` != ${MD5} ];
     43then
     44        echo Wrong MD5 checksum
     45        exit
     46fi
     47
     48tar xvfj ${TARBALL}
     49
     50cd ${SOURCEDIR}
     51
    5752./configure --target-list=i386-softmmu,x86_64-softmmu,arm-softmmu,ppc-softmmu,sparc-softmmu,sparc64-softmmu,mips-softmmu,mipsel-softmmu --audio-drv-list=pa
     53
    5854make -j 4
     55
    5956sudo make install
     57
  • uspace/drv/bus/usb/usbhid/kbd/conv.c

    rbf45993 r824208bf  
    4545 */
    4646static int scanmap_simple[255] = {
     47
     48//      [0x29] = KC_BACKTICK,
     49
     50//      [0x02] = KC_1,
     51//      [0x03] = KC_2,
    4752        [0x04] = KC_A,
    4853        [0x05] = KC_B,
     
    8994        [0x2c] = KC_SPACE,
    9095
    91         [0x2d] = KC_MINUS,
     96        [0x2d] = KC_MINUS,  // same as DASH? (- or _)
    9297        [0x2e] = KC_EQUALS,
    9398        [0x2f] = KC_LBRACKET,
    9499        [0x30] = KC_RBRACKET,
    95100        [0x31] = KC_BACKSLASH,
    96         [0x32] = KC_HASH,
     101        //[0x32] = KC_, // TODO: HASH??? maybe same as 0x31 - backslash
     102        [0x32] = KC_BACKSLASH,
    97103        [0x33] = KC_SEMICOLON,
    98         [0x34] = KC_QUOTE,
    99         [0x35] = KC_BACKTICK,
     104        [0x34] = KC_QUOTE,  // same as APOSTROPHE? (')
     105        [0x35] = KC_BACKTICK,  // same as GRAVE ACCENT?? (`)
    100106        [0x36] = KC_COMMA,
    101107        [0x37] = KC_PERIOD,
     
    131137        [0x52] = KC_UP,
    132138
     139        //[0x64] = // some funny key
     140
     141        [0xe0] = KC_LCTRL,
     142        [0xe1] = KC_LSHIFT,
     143        [0xe2] = KC_LALT,
     144        //[0xe3] = KC_L // TODO: left GUI
     145        [0xe4] = KC_RCTRL,
     146        [0xe5] = KC_RSHIFT,
     147        [0xe6] = KC_RALT,
     148        //[0xe7] = KC_R // TODO: right GUI
     149
    133150        [0x53] = KC_NUM_LOCK,
    134151        [0x54] = KC_NSLASH,
     
    147164        [0x61] = KC_N9,
    148165        [0x62] = KC_N0,
    149         [0x63] = KC_NPERIOD,
     166        [0x63] = KC_NPERIOD
    150167
    151         [0x64] = KC_BACKSLASH,
    152 
    153         [0x9a] = KC_SYSREQ,
    154 
    155         [0xe0] = KC_LCTRL,
    156         [0xe1] = KC_LSHIFT,
    157         [0xe2] = KC_LALT,
    158         [0xe4] = KC_RCTRL,
    159         [0xe5] = KC_RSHIFT,
    160         [0xe6] = KC_RALT,
    161168};
    162169
     
    166173 *
    167174 * @param scancode USB HID key code (from HID Usage Tables).
    168  *
     175 * 
    169176 * @retval HelenOS key code corresponding to the given USB HID key code.
    170177 */
  • uspace/drv/char/xtkbd/main.c

    rbf45993 r824208bf  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvkbd
    3029 * @{
     
    6160/** Initialize global driver structures (NONE).
    6261 *
    63  * Driver debug level is set here.
    64  *
    6562 * @param[in] argc Nmber of arguments in argv vector (ignored).
    6663 * @param[in] argv Cmdline argument vector (ignored).
    67  *
    6864 * @return Error code.
    6965 *
     66 * Driver debug level is set here.
    7067 */
    7168int main(int argc, char *argv[])
     
    7976 *
    8077 * @param[in] device DDF instance of the device to initialize.
    81  *
    8278 * @return Error code.
    83  *
    8479 */
    8580static int xt_kbd_add(ddf_dev_t *device)
     
    107102        return EOK;
    108103}
    109 
    110104/**
    111105 * @}
  • uspace/drv/char/xtkbd/xtkbd.c

    rbf45993 r824208bf  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvkbd
    3029 * @{
    3130 */
    3231/** @file
    33  * @brief XT keyboard driver
     32 * @brief XT keyboard driver;
    3433 */
    3534
     
    4140#include <ipc/kbdev.h>
    4241#include <abi/ipc/methods.h>
     42
    4343#include "xtkbd.h"
    4444
    4545/** Scancode set 1 table. */
    46 static const unsigned int scanmap_simple[] = {
     46static const int scanmap_simple[] = {
     47
    4748        [0x29] = KC_BACKTICK,
    48        
     49
    4950        [0x02] = KC_1,
    5051        [0x03] = KC_2,
     
    5758        [0x0a] = KC_9,
    5859        [0x0b] = KC_0,
    59        
     60
    6061        [0x0c] = KC_MINUS,
    6162        [0x0d] = KC_EQUALS,
    6263        [0x0e] = KC_BACKSPACE,
    63        
     64
    6465        [0x0f] = KC_TAB,
    65        
     66
    6667        [0x10] = KC_Q,
    6768        [0x11] = KC_W,
     
    7475        [0x18] = KC_O,
    7576        [0x19] = KC_P,
    76        
     77
    7778        [0x1a] = KC_LBRACKET,
    7879        [0x1b] = KC_RBRACKET,
    79        
     80
    8081        [0x3a] = KC_CAPS_LOCK,
    81        
     82
    8283        [0x1e] = KC_A,
    8384        [0x1f] = KC_S,
     
    8990        [0x25] = KC_K,
    9091        [0x26] = KC_L,
    91        
     92
    9293        [0x27] = KC_SEMICOLON,
    9394        [0x28] = KC_QUOTE,
    9495        [0x2b] = KC_BACKSLASH,
    95        
     96
    9697        [0x2a] = KC_LSHIFT,
    97        
     98
    9899        [0x2c] = KC_Z,
    99100        [0x2d] = KC_X,
     
    103104        [0x31] = KC_N,
    104105        [0x32] = KC_M,
    105        
     106
    106107        [0x33] = KC_COMMA,
    107108        [0x34] = KC_PERIOD,
    108109        [0x35] = KC_SLASH,
    109        
     110
    110111        [0x36] = KC_RSHIFT,
    111        
     112
    112113        [0x1d] = KC_LCTRL,
    113114        [0x38] = KC_LALT,
    114115        [0x39] = KC_SPACE,
    115        
     116
    116117        [0x01] = KC_ESCAPE,
    117        
     118
    118119        [0x3b] = KC_F1,
    119120        [0x3c] = KC_F2,
     
    123124        [0x40] = KC_F6,
    124125        [0x41] = KC_F7,
    125        
     126
    126127        [0x42] = KC_F8,
    127128        [0x43] = KC_F9,
    128129        [0x44] = KC_F10,
    129        
     130
    130131        [0x57] = KC_F11,
    131132        [0x58] = KC_F12,
    132        
     133
    133134        [0x46] = KC_SCROLL_LOCK,
    134        
     135
    135136        [0x1c] = KC_ENTER,
    136        
     137
    137138        [0x45] = KC_NUM_LOCK,
    138139        [0x37] = KC_NTIMES,
     
    152153};
    153154
    154 #define KBD_ACK  0xfa
    155 #define KBD_RESEND  0xfe
    156 #define KBD_SCANCODE_SET_EXTENDED  0xe0
    157 #define KBD_SCANCODE_SET_EXTENDED_SPECIAL  0xe1
    158 
     155#define KBD_ACK   0xfa
     156#define KBD_RESEND   0xfe
     157#define KBD_SCANCODE_SET_EXTENDED   0xe0
    159158/** Scancode set 1 extended codes table */
    160 static const unsigned int scanmap_e0[] = {
     159static const int scanmap_e0[] = {
    161160        [0x38] = KC_RALT,
    162161        [0x1d] = KC_RCTRL,
    163        
    164         [0x37] = KC_SYSREQ,
    165        
     162
     163        [0x37] = KC_PRTSCR,
     164
    166165        [0x52] = KC_INSERT,
    167166        [0x47] = KC_HOME,
    168167        [0x49] = KC_PAGE_UP,
    169        
     168
    170169        [0x53] = KC_DELETE,
    171170        [0x4f] = KC_END,
    172171        [0x51] = KC_PAGE_DOWN,
    173        
     172
    174173        [0x48] = KC_UP,
    175174        [0x4b] = KC_LEFT,
    176175        [0x50] = KC_DOWN,
    177176        [0x4d] = KC_RIGHT,
    178        
     177
    179178        [0x35] = KC_NSLASH,
    180179        [0x1c] = KC_NENTER
    181180};
    182181
    183 #define KBD_CMD_SET_LEDS  0xed
    184 
     182#define KBD_CMD_SET_LEDS 0xed
    185183enum led_indicators {
    186         LI_SCROLL = 0x01,
    187         LI_NUM    = 0x02,
    188         LI_CAPS   = 0x04
     184        LI_SCROLL       = 0x01,
     185        LI_NUM          = 0x02,
     186        LI_CAPS         = 0x04,
    189187};
    190188
    191 static void push_event(async_sess_t *sess, kbd_event_type_t type,
    192     unsigned int key)
     189static int polling(void *);
     190static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
     191
     192/** Keyboard function ops. */
     193static ddf_dev_ops_t kbd_ops = {
     194        .default_handler = default_connection_handler
     195};
     196
     197/** Initialize keyboard driver structure.
     198 * @param kbd Keyboard driver structure to initialize.
     199 * @param dev DDF device structure.
     200 *
     201 * Connects to parent, creates keyboard function, starts polling fibril.
     202 */
     203int xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev)
    193204{
    194         async_exch_t *exch = async_exchange_begin(sess);
    195         async_msg_4(exch, KBDEV_EVENT, type, key, 0, 0);
    196         async_exchange_end(exch);
     205        assert(kbd);
     206        assert(dev);
     207        kbd->client_sess = NULL;
     208        kbd->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE);
     209        if (!kbd->parent_sess) {
     210                ddf_msg(LVL_ERROR, "Failed creating parent session.");
     211                return EIO;
     212        }
     213
     214        kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd");
     215        if (!kbd->kbd_fun) {
     216                ddf_msg(LVL_ERROR, "Failed creating function 'kbd'.");
     217                return ENOMEM;
     218        }
     219        ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
     220
     221        int ret = ddf_fun_bind(kbd->kbd_fun);
     222        if (ret != EOK) {
     223                ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");
     224                ddf_fun_destroy(kbd->kbd_fun);
     225                return EEXIST;
     226        }
     227
     228        ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard");
     229        if (ret != EOK) {
     230                ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category "
     231                    "'keyboard'.");
     232                ddf_fun_unbind(kbd->kbd_fun);
     233                ddf_fun_destroy(kbd->kbd_fun);
     234                return ENOMEM;
     235        }
     236
     237        kbd->polling_fibril = fibril_create(polling, kbd);
     238        if (!kbd->polling_fibril) {
     239                ddf_msg(LVL_ERROR, "Failed creating polling fibril.");
     240                ddf_fun_unbind(kbd->kbd_fun);
     241                ddf_fun_destroy(kbd->kbd_fun);
     242                return ENOMEM;
     243        }
     244
     245        fibril_add_ready(kbd->polling_fibril);
     246        return EOK;
    197247}
    198248
    199249/** Get data and parse scancodes.
    200  *
    201250 * @param arg Pointer to xt_kbd_t structure.
    202  *
    203251 * @return EIO on error.
    204  *
    205  */
    206 static int polling(void *arg)
     252 */
     253int polling(void *arg)
    207254{
     255        assert(arg);
    208256        const xt_kbd_t *kbd = arg;
    209        
    210         assert(kbd);
     257
    211258        assert(kbd->parent_sess);
    212        
    213259        async_exch_t *parent_exch = async_exchange_begin(kbd->parent_sess);
    214        
    215         while (true) {
     260        while (1) {
    216261                if (!parent_exch)
    217262                        parent_exch = async_exchange_begin(kbd->parent_sess);
    218                
    219                 const unsigned int *map = scanmap_simple;
    220                 size_t map_size = sizeof(scanmap_simple) / sizeof(unsigned int);
    221                
     263
     264                const int *map = scanmap_simple;
     265                size_t map_size = sizeof(scanmap_simple) / sizeof(int);
     266
    222267                uint8_t code = 0;
    223268                ssize_t size = chardev_read(parent_exch, &code, 1);
    224269                if (size != 1)
    225270                        return EIO;
    226                
    227                 /* Ignore AT command reply */
    228                 if ((code == KBD_ACK) || (code == KBD_RESEND))
     271
     272                /** Ignore AT command reply */
     273                if (code == KBD_ACK || code == KBD_RESEND) {
    229274                        continue;
    230                
    231                 /* Extended set */
     275                }
     276
    232277                if (code == KBD_SCANCODE_SET_EXTENDED) {
    233278                        map = scanmap_e0;
    234                         map_size = sizeof(scanmap_e0) / sizeof(unsigned int);
    235                        
     279                        map_size = sizeof(scanmap_e0) / sizeof(int);
    236280                        size = chardev_read(parent_exch, &code, 1);
    237281                        if (size != 1)
    238282                                return EIO;
    239                        
    240                         /* Handle really special keys */
    241                        
    242                         if (code == 0x2a) {  /* Print Screen */
    243                                 size = chardev_read(parent_exch, &code, 1);
    244                                 if (size != 1)
    245                                         return EIO;
    246                                
    247                                 if (code != 0xe0)
    248                                         continue;
    249                                
    250                                 size = chardev_read(parent_exch, &code, 1);
    251                                 if (size != 1)
    252                                         return EIO;
    253                                
    254                                 if (code == 0x37)
    255                                         push_event(kbd->client_sess, KEY_PRESS, KC_PRTSCR);
    256                                
    257                                 continue;
    258                         }
    259                        
    260                         if (code == 0x46) {  /* Break */
    261                                 size = chardev_read(parent_exch, &code, 1);
    262                                 if (size != 1)
    263                                         return EIO;
    264                                
    265                                 if (code != 0xe0)
    266                                         continue;
    267                                
    268                                 size = chardev_read(parent_exch, &code, 1);
    269                                 if (size != 1)
    270                                         return EIO;
    271                                
    272                                 if (code == 0xc6)
    273                                         push_event(kbd->client_sess, KEY_PRESS, KC_BREAK);
    274                                
    275                                 continue;
    276                         }
    277                 }
    278                
    279                 /* Extended special set */
    280                 if (code == KBD_SCANCODE_SET_EXTENDED_SPECIAL) {
    281                         size = chardev_read(parent_exch, &code, 1);
    282                         if (size != 1)
    283                                 return EIO;
    284                        
    285                         if (code != 0x1d)
    286                                 continue;
    287                        
    288                         size = chardev_read(parent_exch, &code, 1);
    289                         if (size != 1)
    290                                 return EIO;
    291                        
    292                         if (code != 0x45)
    293                                 continue;
    294                        
    295                         size = chardev_read(parent_exch, &code, 1);
    296                         if (size != 1)
    297                                 return EIO;
    298                        
    299                         if (code != 0xe1)
    300                                 continue;
    301                        
    302                         size = chardev_read(parent_exch, &code, 1);
    303                         if (size != 1)
    304                                 return EIO;
    305                        
    306                         if (code != 0x9d)
    307                                 continue;
    308                        
    309                         size = chardev_read(parent_exch, &code, 1);
    310                         if (size != 1)
    311                                 return EIO;
    312                        
    313                         if (code == 0xc5)
    314                                 push_event(kbd->client_sess, KEY_PRESS, KC_PAUSE);
    315                        
    316                         continue;
    317                 }
    318                
     283
     284                        // TODO handle print screen
     285                }
     286
    319287                /* Bit 7 indicates press/release */
    320288                const kbd_event_type_t type =
    321289                    (code & 0x80) ? KEY_RELEASE : KEY_PRESS;
    322290                code &= ~0x80;
    323                
    324                 const unsigned int key = (code < map_size) ? map[code] : 0;
    325                
    326                 if (key != 0)
    327                         push_event(kbd->client_sess, type, key);
    328                 else
     291
     292                const unsigned key = (code < map_size) ? map[code] : 0;
     293                if (key != 0) {
     294                        async_exch_t *exch =
     295                            async_exchange_begin(kbd->client_sess);
     296                        if (!exch) {
     297                                ddf_msg(LVL_ERROR,
     298                                    "Failed creating exchange.");
     299                                continue;
     300                        }
     301                        async_msg_4(exch, KBDEV_EVENT, type, key, 0, 0);
     302                        async_exchange_end(exch);
     303                } else {
    329304                        ddf_msg(LVL_WARN, "Unknown scancode: %hhx", code);
     305                }
    330306        }
    331307}
     
    333309/** Default handler for IPC methods not handled by DDF.
    334310 *
    335  * @param fun     Device function handling the call.
     311 * @param fun Device function handling the call.
    336312 * @param icallid Call id.
    337  * @param icall   Call data.
    338  *
    339  */
    340 static void default_connection_handler(ddf_fun_t *fun,
     313 * @param icall Call data.
     314 */
     315void default_connection_handler(ddf_fun_t *fun,
    341316    ipc_callid_t icallid, ipc_call_t *icall)
    342317{
     
    346321        switch (method) {
    347322        case KBDEV_SET_IND: {
    348                 /*
    349                  * XT keyboards do not support setting mods,
    350                  * assume AT keyboard with Scan Code Set 1.
    351                  */
     323                /* XT keyboards do not support setting mods,
     324                 * assume AT keyboard with Scan Code Set 1 */
    352325                const unsigned mods = IPC_GET_ARG1(*icall);
    353326                const uint8_t status = 0 |
     
    356329                    ((mods & KM_SCROLL_LOCK) ? LI_SCROLL : 0);
    357330                uint8_t cmds[] = { KBD_CMD_SET_LEDS, status };
    358                
    359331                async_exch_t *exch = async_exchange_begin(kbd->parent_sess);
    360332                const ssize_t size = chardev_write(exch, cmds, sizeof(cmds));
    361333                async_exchange_end(exch);
    362                
    363334                async_answer_0(icallid, size < 0 ? size : EOK);
    364335                break;
    365336        }
    366         /*
    367          * This might be ugly but async_callback_receive_start makes no
    368          * difference for incorrect call and malloc failure.
    369          */
     337        /* This might be ugly but async_callback_receive_start makes no
     338         * difference for incorrect call and malloc failure. */
    370339        case IPC_M_CONNECT_TO_ME: {
    371340                async_sess_t *sess =
    372341                    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
    373                
    374342                /* Probably ENOMEM error, try again. */
    375343                if (sess == NULL) {
     
    379347                        break;
    380348                }
    381                
    382349                if (kbd->client_sess == NULL) {
    383350                        kbd->client_sess = sess;
     
    388355                        async_answer_0(icallid, ELIMIT);
    389356                }
    390                
    391357                break;
    392358        }
    393359        default:
    394                 ddf_msg(LVL_ERROR, "Unknown method: %d.", (int)method);
    395                 async_answer_0(icallid, EINVAL);
    396                 break;
     360                        ddf_msg(LVL_ERROR, "Unknown method: %d.", (int)method);
     361                        async_answer_0(icallid, EINVAL);
     362                        break;
    397363        }
    398364}
    399 
    400 /** Keyboard function ops. */
    401 static ddf_dev_ops_t kbd_ops = {
    402         .default_handler = default_connection_handler
    403 };
    404 
    405 /** Initialize keyboard driver structure.
    406  *
    407  * @param kbd Keyboard driver structure to initialize.
    408  * @param dev DDF device structure.
    409  *
    410  * Connects to parent, creates keyboard function, starts polling fibril.
    411  *
    412  */
    413 int xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev)
    414 {
    415         assert(kbd);
    416         assert(dev);
    417        
    418         kbd->client_sess = NULL;
    419         kbd->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE);
    420        
    421         if (!kbd->parent_sess) {
    422                 ddf_msg(LVL_ERROR, "Failed creating parent session.");
    423                 return EIO;
    424         }
    425        
    426         kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd");
    427         if (!kbd->kbd_fun) {
    428                 ddf_msg(LVL_ERROR, "Failed creating function 'kbd'.");
    429                 return ENOMEM;
    430         }
    431        
    432         ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
    433        
    434         int ret = ddf_fun_bind(kbd->kbd_fun);
    435         if (ret != EOK) {
    436                 ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");
    437                 ddf_fun_destroy(kbd->kbd_fun);
    438                 return EEXIST;
    439         }
    440        
    441         ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard");
    442         if (ret != EOK) {
    443                 ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category "
    444                     "'keyboard'.");
    445                 ddf_fun_unbind(kbd->kbd_fun);
    446                 ddf_fun_destroy(kbd->kbd_fun);
    447                 return ENOMEM;
    448         }
    449        
    450         kbd->polling_fibril = fibril_create(polling, kbd);
    451         if (!kbd->polling_fibril) {
    452                 ddf_msg(LVL_ERROR, "Failed creating polling fibril.");
    453                 ddf_fun_unbind(kbd->kbd_fun);
    454                 ddf_fun_destroy(kbd->kbd_fun);
    455                 return ENOMEM;
    456         }
    457        
    458         fibril_add_ready(kbd->polling_fibril);
    459         return EOK;
    460 }
  • uspace/drv/char/xtkbd/xtkbd.h

    rbf45993 r824208bf  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup drvkbd
    3029 * @{
     
    4847} xt_kbd_t;
    4948
    50 extern int xt_kbd_init(xt_kbd_t *, ddf_dev_t *);
     49int xt_kbd_init(xt_kbd_t *, ddf_dev_t *);
    5150
    5251#endif
    53 
    5452/**
    5553 * @}
  • uspace/lib/c/include/io/keycode.h

    rbf45993 r824208bf  
    107107        KC_QUOTE,
    108108        KC_BACKSLASH,
    109         KC_HASH,
    110109
    111110        KC_ENTER,
     
    155154
    156155        KC_PRTSCR,
    157         KC_SYSREQ,
    158156        KC_SCROLL_LOCK,
    159157        KC_PAUSE,
    160         KC_BREAK,
    161158
    162159        /* Cursor keys block */
  • uspace/srv/hid/compositor/compositor.c

    rbf45993 r824208bf  
    18201820        bool viewport_change = (mods & KM_ALT) && (
    18211821            key == KC_O || key == KC_P);
    1822         bool kconsole_switch = (key == KC_PAUSE) || (key == KC_BREAK);
     1822        bool kconsole_switch = (mods & KM_ALT) && (key == KC_M);
    18231823        bool filter_switch = (mods & KM_ALT) && (key == KC_Y);
    18241824
  • uspace/srv/hid/input/ctl/apple.c

    rbf45993 r824208bf  
    5252};
    5353
    54 #define KBD_KEY_RELEASE  0x80
    55 
    56 static unsigned int scanmap[] = {
     54#define KBD_KEY_RELEASE         0x80
     55
     56static kbd_dev_t *kbd_dev;
     57
     58static int scanmap[];
     59
     60static int apple_ctl_init(kbd_dev_t *kdev)
     61{
     62        kbd_dev = kdev;
     63        return 0;
     64}
     65
     66static void apple_ctl_parse(sysarg_t scancode)
     67{
     68        kbd_event_type_t type;
     69        unsigned int key;
     70
     71        if (scancode >= 0x100)
     72                return;
     73
     74        if (scancode & KBD_KEY_RELEASE) {
     75                scancode &= ~KBD_KEY_RELEASE;
     76                type = KEY_RELEASE;
     77        } else {
     78                type = KEY_PRESS;
     79        }
     80
     81        key = scanmap[scancode];
     82        if (key != 0)
     83                kbd_push_event(kbd_dev, type, key);
     84}
     85
     86static void apple_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
     87{
     88        (void) mods;
     89}
     90
     91static int scanmap[] = {
    5792        [0x00] = KC_A,
    5893        [0x01] = KC_S,
     
    160195        [0x67] = KC_F11,
    161196        [0x68] = 0,
    162         [0x69] = KC_SYSREQ,
     197        [0x69] = 0,
    163198        [0x6a] = 0,
    164199        [0x6b] = KC_SCROLL_LOCK,
     
    168203        [0x6f] = KC_F12,
    169204        [0x70] = 0,
    170         [0x71] = KC_PAUSE,
     205        [0x71] = 0,
    171206        [0x72] = KC_INSERT,
    172207        [0x73] = KC_HOME,
     
    185220};
    186221
    187 static kbd_dev_t *kbd_dev;
    188 
    189 static int apple_ctl_init(kbd_dev_t *kdev)
    190 {
    191         kbd_dev = kdev;
    192         return 0;
    193 }
    194 
    195 static void apple_ctl_parse(sysarg_t scancode)
    196 {
    197         kbd_event_type_t type;
    198        
    199         if (scancode & KBD_KEY_RELEASE) {
    200                 scancode &= ~KBD_KEY_RELEASE;
    201                 type = KEY_RELEASE;
    202         } else
    203                 type = KEY_PRESS;
    204        
    205         if (scancode >= sizeof(scanmap) / sizeof(unsigned int))
    206                 return;
    207        
    208         unsigned int key = scanmap[scancode];
    209         if (key != 0)
    210                 kbd_push_event(kbd_dev, type, key);
    211 }
    212 
    213 static void apple_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
    214 {
    215         (void) mods;
    216 }
    217 
    218222/** @}
    219223 */
  • uspace/srv/hid/input/ctl/stty.c

    rbf45993 r824208bf  
    212212        0,      KC_F12,         0x1b, 0x5b, 0x32, 0x34, 0x7e, GSP_END,
    213213
    214         0,      KC_PRTSCR,      0x1b, 0x5b, 0x32, 0x35, 0x7e, GSP_END,
    215         0,      KC_PAUSE,       0x1b, 0x5b, 0x32, 0x38, 0x7e, GSP_END,
    216 
    217214        0,      KC_INSERT,      0x1b, 0x5b, 0x32, 0x7e, GSP_END,
    218215        0,      KC_HOME,        0x1b, 0x5b, 0x48, GSP_END,
  • uspace/srv/hid/input/ctl/sun.c

    rbf45993 r824208bf  
    118118        [0x14] = KC_UP,
    119119        [0x15] = KC_PAUSE,
    120         [0x16] = KC_PRTSCR,
     120        [0x16] = 0,
    121121        [0x17] = KC_SCROLL_LOCK,
    122122        [0x18] = KC_LEFT,
  • uspace/srv/hid/input/input.c

    rbf45993 r824208bf  
    9090static client_t *active_client = NULL;
    9191
    92 /** Kernel override */
    93 static bool active = true;
    94 
    9592/** List of keyboard devices */
    9693static list_t kbd_devs;
     
    298295
    299296/** Arbitrate client actiovation */
    300 static void client_arbitration(void)
     297static void client_arbitration(client_t *req)
    301298{
    302299        /* Mutual exclusion of active clients */
    303300        list_foreach(clients, link, client_t, client)
    304                 client->active = ((active) && (client == active_client));
     301                client->active = (client == req);
    305302       
    306303        /* Notify clients about the arbitration */
     
    350347                        case INPUT_ACTIVATE:
    351348                                active_client = client;
    352                                 client_arbitration();
     349                                client_arbitration(client);
    353350                                async_answer_0(callid, EOK);
    354351                                break;
     
    365362        if (IPC_GET_ARG1(*call)) {
    366363                /* Kernel console activated */
    367                 active = false;
     364                client_arbitration(NULL);
    368365        } else {
    369366                /* Kernel console deactivated */
    370                 active = true;
    371         }
    372        
    373         client_arbitration();
     367                client_arbitration(active_client);
     368        }
    374369}
    375370
  • uspace/srv/net/tcp/ucall.c

    rbf45993 r824208bf  
    7676        nconn = tcp_conn_new(lsock, fsock);
    7777        tcp_conn_add(nconn);
    78         tcp_conn_lock(nconn);
    7978
    8079        if (acpass == ap_active) {
     
    8483
    8584        if (oflags == tcp_open_nonblock) {
    86                 tcp_conn_unlock(nconn);
    8785                log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open -> %p", nconn);
    8886                *conn = nconn;
     
    9290        /* Wait for connection to be established or reset */
    9391        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Wait for connection.");
     92        tcp_conn_lock(nconn);
    9493        while (nconn->cstate == st_listen ||
    9594            nconn->cstate == st_syn_sent ||
Note: See TracChangeset for help on using the changeset viewer.