Changeset da68871a in mainline for uspace/srv


Ignore:
Timestamp:
2012-08-08T08:46:22Z (14 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30c0826
Parents:
bc216a0 (diff), 1d01cca (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:

Merged changes from mainline.

Location:
uspace/srv
Files:
4 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    rbc216a0 rda68871a  
    419419       
    420420        /* Check that function with same name is not there already. */
    421         if (find_fun_node_in_device(tree, pdev, fun_name) != NULL) {
     421        fun_node_t *tfun = find_fun_node_in_device(tree, pdev, fun_name);
     422        if (tfun) {
     423                fun_del_ref(tfun);      /* drop the new unwanted reference */
    422424                fibril_rwlock_write_unlock(&tree->rwlock);
    423425                dev_del_ref(pdev);
  • uspace/srv/hid/console/console.c

    rbc216a0 rda68871a  
    7676} console_state_t;
    7777
     78#define UTF8_CHAR_BUFFER_SIZE (STR_BOUNDS(1) + 1)
     79
    7880typedef struct {
    7981        atomic_t refcnt;           /**< Connection reference count */
    8082        prodcons_t input_pc;       /**< Incoming keyboard events */
     83        char char_remains[UTF8_CHAR_BUFFER_SIZE]; /**< Not yet sent bytes of last char event. */
     84        size_t char_remains_len;   /**< Number of not yet sent bytes. */
    8185       
    8286        fibril_mutex_t mtx;        /**< Lock protecting mutable fields */
     
    613617       
    614618        size_t pos = 0;
     619       
     620        /*
     621         * Read input from keyboard and copy it to the buffer.
     622         * We need to handle situation when wchar is split by 2 following
     623         * reads.
     624         */
    615625        while (pos < size) {
    616                 link_t *link = prodcons_consume(&cons->input_pc);
    617                 kbd_event_t *event = list_get_instance(link, kbd_event_t, link);
    618                
    619                 if (event->type == KEY_PRESS) {
    620                         buf[pos] = event->c;
     626                /* Copy to the buffer remaining characters. */
     627                while ((pos < size) && (cons->char_remains_len > 0)) {
     628                        buf[pos] = cons->char_remains[0];
    621629                        pos++;
    622                 }
    623                
    624                 free(event);
     630                       
     631                        /* Unshift the array. */
     632                        for (size_t i = 1; i < cons->char_remains_len; i++)
     633                                cons->char_remains[i - 1] = cons->char_remains[i];
     634                       
     635                        cons->char_remains_len--;
     636                }
     637               
     638                /* Still not enough? Then get another key from the queue. */
     639                if (pos < size) {
     640                        link_t *link = prodcons_consume(&cons->input_pc);
     641                        kbd_event_t *event = list_get_instance(link, kbd_event_t, link);
     642                       
     643                        /* Accept key presses of printable chars only. */
     644                        if ((event->type == KEY_PRESS) && (event->c != 0)) {
     645                                wchar_t tmp[2] = { event->c, 0 };
     646                                wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp);
     647                                cons->char_remains_len = str_size(cons->char_remains);
     648                        }
     649                       
     650                        free(event);
     651                }
    625652        }
    626653       
     
    930957                fibril_mutex_initialize(&consoles[i].mtx);
    931958                prodcons_initialize(&consoles[i].input_pc);
     959                consoles[i].char_remains_len = 0;
    932960               
    933961                if (graphics_state == GRAPHICS_FULL) {
  • uspace/srv/hid/input/port/ns16550.c

    rbc216a0 rda68871a  
    8484        },
    8585        {
    86                 .cmd = CMD_BTEST,
     86                .cmd = CMD_AND,
    8787                .value = LSR_DATA_READY,
    8888                .srcarg = 1,
  • uspace/srv/hid/input/port/pl050.c

    rbc216a0 rda68871a  
    8080        },
    8181        {
    82                 .cmd = CMD_BTEST,
     82                .cmd = CMD_AND,
    8383                .value = PL050_STAT_RXFULL,
    8484                .srcarg = 1,
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.c

    rbc216a0 rda68871a  
    116116        {
    117117                .cmd = CMD_PIO_READ_8,
    118                 .addr = NULL,   /* will be patched in run-time */
     118                .addr = NULL,
    119119                .dstarg = 1
    120120        },
    121121        {
    122                 .cmd = CMD_BTEST,
     122                .cmd = CMD_AND,
    123123                .value = SR_INT,
    124124                .srcarg = 1,
  • uspace/srv/loader/Makefile

    rbc216a0 rda68871a  
    4444GENERIC_SOURCES = \
    4545        main.c \
    46         interp.s
     46        interp.S
    4747
    4848SOURCES = \
  • uspace/srv/net/tcp/sock.c

    rbc216a0 rda68871a  
    779779        }
    780780
     781        /* Grab recv_buffer_lock because of CV wait in tcp_sock_recv_fibril() */
     782        fibril_mutex_lock(&socket->recv_buffer_lock);
     783        socket->sock_core = NULL;
     784        fibril_mutex_unlock(&socket->recv_buffer_lock);
     785
    781786        rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock,
    782787            tcp_free_sock_data);
     
    839844        log_msg(LVL_DEBUG, "tcp_sock_recv_fibril()");
    840845
     846        fibril_mutex_lock(&sock->recv_buffer_lock);
     847
    841848        while (true) {
    842849                log_msg(LVL_DEBUG, "call tcp_uc_receive()");
    843                 fibril_mutex_lock(&sock->recv_buffer_lock);
    844                 while (sock->recv_buffer_used != 0)
     850                while (sock->recv_buffer_used != 0 && sock->sock_core != NULL)
    845851                        fibril_condvar_wait(&sock->recv_buffer_cv,
    846852                            &sock->recv_buffer_lock);
     
    852858                        sock->recv_error = trc;
    853859                        fibril_condvar_broadcast(&sock->recv_buffer_cv);
    854                         fibril_mutex_unlock(&sock->recv_buffer_lock);
    855                         tcp_sock_notify_data(sock->sock_core);
     860                        if (sock->sock_core != NULL)
     861                                tcp_sock_notify_data(sock->sock_core);
    856862                        break;
    857863                }
     
    861867                sock->recv_buffer_used = data_len;
    862868                fibril_condvar_broadcast(&sock->recv_buffer_cv);
    863                 fibril_mutex_unlock(&sock->recv_buffer_lock);
    864                 tcp_sock_notify_data(sock->sock_core);
    865         }
     869                if (sock->sock_core != NULL)
     870                        tcp_sock_notify_data(sock->sock_core);
     871        }
     872
     873        fibril_mutex_unlock(&sock->recv_buffer_lock);
    866874
    867875        tcp_uc_delete(sock->conn);
Note: See TracChangeset for help on using the changeset viewer.