Changeset ae49252 in mainline for uspace


Ignore:
Timestamp:
2012-07-18T21:45:07Z (13 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5f4cf872
Parents:
349e510d (diff), 7030bc9 (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

Location:
uspace
Files:
14 added
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    r349e510d rae49252  
    8686        srv/vfs \
    8787        srv/bd/ata_bd \
     88        srv/bd/sata_bd \
    8889        srv/bd/file_bd \
    8990        srv/bd/gxe_bd \
     
    106107        drv/infrastructure/root \
    107108        drv/infrastructure/rootvirt \
     109        drv/block/ahci \
    108110        drv/char/i8042 \
    109111        drv/char/ps2mouse \
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r349e510d rae49252  
    6262static sysarg_t console_rows = 0;
    6363static bool should_quit = false;
     64static bool dash_represents_stdin = false;
    6465
    6566static console_ctrl_t *console = NULL;
     
    7374        { "more", no_argument, 0, 'm' },
    7475        { "hex", no_argument, 0, 'x' },
     76        { "stdin", no_argument, 0, 's' },
    7577        { 0, 0, 0, 0 }
    7678};
     
    9395                "  -m, --more       Pause after each screen full\n"
    9496                "  -x, --hex        Print bytes as hex values\n"
     97                "  -s  --stdin      Treat `-' in file list as standard input\n"
    9598                "Currently, %s is under development, some options don't work.\n",
    9699                cmdname, cmdname);
     
    172175        off64_t file_size = 0, length = 0;
    173176
    174         fd = open(fname, O_RDONLY);
     177        bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
     178       
     179        if (reading_stdin) {
     180                fd = fileno(stdin);
     181                /* Allow storing the whole UTF-8 character. */
     182                blen = STR_BOUNDS(1);
     183        } else
     184                fd = open(fname, O_RDONLY);
     185       
    175186        if (fd < 0) {
    176187                printf("Unable to open %s\n", fname);
     
    207218
    208219        do {
    209                 bytes = read(fd, buff + copied_bytes, (
    210                         (length != CAT_FULL_FILE && length - (off64_t)count <= (off64_t)(blen - copied_bytes)) ?
    211                         (size_t)(length - count) :
    212                         (blen - copied_bytes) ) );
     220                size_t bytes_to_read;
     221                if (reading_stdin) {
     222                        bytes_to_read = 1;
     223                } else {
     224                        if ((length != CAT_FULL_FILE) &&
     225                            (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
     226                                bytes_to_read = (size_t) (length - count);
     227                        } else {
     228                                bytes_to_read = blen - copied_bytes;
     229                        }
     230                }
     231               
     232                bytes = read(fd, buff + copied_bytes, bytes_to_read);
    213233                bytes += copied_bytes;
    214234                copied_bytes = 0;
     
    242262                        reads++;
    243263                }
     264               
     265                if (reading_stdin)
     266                        fflush(stdout);
    244267        } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
    245268
     
    284307
    285308        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    286                 c = getopt_long(argc, argv, "xhvmH:t:b:", long_options, &opt_ind);
     309                c = getopt_long(argc, argv, "xhvmH:t:b:s", long_options, &opt_ind);
    287310                switch (c) {
    288311                case 'h':
     
    318341                        hex = true;
    319342                        break;
     343                case 's':
     344                        dash_represents_stdin = true;
     345                        break;
    320346                }
    321347        }
  • uspace/drv/bus/isa/isa.c

    r349e510d rae49252  
    201201
    202202        isa_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(isa_fun_t));
    203         if (fun == NULL)
     203        if (fun == NULL) {
     204                ddf_fun_destroy(fnode);
    204205                return NULL;
     206        }
    205207
    206208        fibril_mutex_initialize(&fun->mutex);
     
    552554
    553555        isa_fun_t *fun = isa_fun_create(isa, fun_name);
     556        free(fun_name);
    554557        if (fun == NULL) {
    555                 free(fun_name);
    556558                return NULL;
    557559        }
  • uspace/drv/nic/ne2k/dp8390.c

    r349e510d rae49252  
    201201        /* Check if the DP8390 is really there */
    202202        uint8_t val = pio_read_8(ne2k->port + DP_CR);
    203         if ((val & (CR_STP | CR_DM_ABORT)) != (CR_STP | CR_DM_ABORT))
     203        if ((val & (CR_STP | CR_TXP | CR_DM_ABORT)) != (CR_STP | CR_DM_ABORT))
    204204                return EXDEV;
    205205       
  • uspace/lib/c/Makefile

    r349e510d rae49252  
    7171        generic/device/nic.c \
    7272        generic/device/pci.c \
     73        generic/device/ahci.c \
    7374        generic/elf/elf_load.c \
    7475        generic/event.c \
  • uspace/lib/c/include/ipc/dev_iface.h

    r349e510d rae49252  
    5151        /** Interface provided by USB HID devices. */
    5252        USBHID_DEV_IFACE,
     53        /** Interface provided by AHCI devices. */
     54        AHCI_DEV_IFACE,
    5355
    5456        DEV_IFACE_MAX
  • uspace/lib/drv/Makefile

    r349e510d rae49252  
    4444        generic/remote_pci.c \
    4545        generic/remote_usbhc.c \
    46         generic/remote_usbhid.c
     46        generic/remote_usbhid.c \
     47        generic/remote_ahci.c
    4748
    4849include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/drv/generic/dev_iface.c

    r349e510d rae49252  
    4646#include "remote_usbhid.h"
    4747#include "remote_pci.h"
     48#include "remote_ahci.h"
    4849
    4950static iface_dipatch_table_t remote_ifaces = {
     
    5556                &remote_usb_iface,
    5657                &remote_usbhc_iface,
    57                 &remote_usbhid_iface
     58                &remote_usbhid_iface,
     59                &remote_ahci_iface
    5860        }
    5961};
  • uspace/srv/devman/main.c

    r349e510d rae49252  
    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

    r349e510d rae49252  
    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) {
Note: See TracChangeset for help on using the changeset viewer.