Message ID | 536fb79a-5753-4143-a5a6-7a189ef5137e@ONE.local |
---|---|
State | New |
Headers | show |
Hi, This series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally. Subject: [Qemu-devel] (no subject) Type: series Message-id: 536fb79a-5753-4143-a5a6-7a189ef5137e@ONE.local === TEST SCRIPT BEGIN === #!/bin/bash set -e git submodule update --init dtc # Let docker tests dump environment info export SHOW_ENV=1 export J=8 time make docker-test-quick@centos6 time make docker-test-mingw@fedora time make docker-test-build@min-glib === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/536fb79a-5753-4143-a5a6-7a189ef5137e@ONE.local -> patchew/536fb79a-5753-4143-a5a6-7a189ef5137e@ONE.local Switched to a new branch 'test' 32d5d78 (no subject) === OUTPUT BEGIN === Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into '/var/tmp/patchew-tester-tmp-1zdsj2xe/src/dtc'... Submodule path 'dtc': checked out '558cd81bdd432769b59bff01240c44f82cfb1a9d' BUILD centos6 make[1]: Entering directory '/var/tmp/patchew-tester-tmp-1zdsj2xe/src' ARCHIVE qemu.tgz ARCHIVE dtc.tgz COPY RUNNER RUN test-quick in qemu:centos6 Packages installed: SDL-devel-1.2.14-7.el6_7.1.x86_64 ccache-3.1.6-2.el6.x86_64 epel-release-6-8.noarch gcc-4.4.7-17.el6.x86_64 git-1.7.1-4.el6_7.1.x86_64 glib2-devel-2.28.8-5.el6.x86_64 libfdt-devel-1.4.0-1.el6.x86_64 make-3.81-23.el6.x86_64 package g++ is not installed pixman-devel-0.32.8-1.el6.x86_64 tar-1.23-15.el6_8.x86_64 zlib-devel-1.2.3-29.el6.x86_64 Environment variables: PACKAGES=libfdt-devel ccache tar git make gcc g++ zlib-devel glib2-devel SDL-devel pixman-devel epel-release HOSTNAME=d9b60ec0a426 TERM=xterm MAKEFLAGS= -j8 HISTSIZE=1000 J=8 USER=root CCACHE_DIR=/var/tmp/ccache EXTRA_CONFIGURE_OPTS= V= SHOW_ENV=1 MAIL=/var/spool/mail/root PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ LANG=en_US.UTF-8 TARGET_LIST= HISTCONTROL=ignoredups SHLVL=1 HOME=/root TEST_DIR=/tmp/qemu-test LOGNAME=root LESSOPEN=||/usr/bin/lesspipe.sh %s FEATURES= dtc DEBUG= G_BROKEN_FILENAMES=1 CCACHE_HASHDIR= _=/usr/bin/env Configure options: --enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install No C++ compiler available; disabling C++ specific optional code Install prefix /var/tmp/qemu-build/install BIOS directory /var/tmp/qemu-build/install/share/qemu binary directory /var/tmp/qemu-build/install/bin library directory /var/tmp/qemu-build/install/lib module directory /var/tmp/qemu-build/install/lib/qemu libexec directory /var/tmp/qemu-build/install/libexec include directory /var/tmp/qemu-build/install/include config directory /var/tmp/qemu-build/install/etc local state directory /var/tmp/qemu-build/install/var Manual directory /var/tmp/qemu-build/install/share/man ELF interp prefix /usr/gnemul/qemu-%M Source path /tmp/qemu-test/src C compiler cc Host C compiler cc C++ compiler Objective-C compiler cc ARFLAGS rv CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g QEMU_CFLAGS -I/usr/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g make make install install python python -B smbd /usr/sbin/smbd module support no host CPU x86_64 host big endian no target list x86_64-softmmu aarch64-softmmu tcg debug enabled no gprof enabled no sparse enabled no strip binaries yes profiler no static build no pixman system SDL support yes (1.2.14) GTK support no GTK GL support no VTE support no TLS priority NORMAL GNUTLS support no GNUTLS rnd no libgcrypt no libgcrypt kdf no nettle no nettle kdf no libtasn1 no curses support no virgl support no curl support no mingw32 support no Audio drivers oss Block whitelist (rw) Block whitelist (ro) VirtFS support no VNC support yes VNC SASL support no VNC JPEG support no VNC PNG support no xen support no brlapi support no bluez support no Documentation no PIE yes vde support no netmap support no Linux AIO support no ATTR/XATTR support yes Install blobs yes KVM support yes HAX support no RDMA support no TCG interpreter no fdt support yes preadv support yes fdatasync yes madvise yes posix_madvise yes libcap-ng support no vhost-net support yes vhost-scsi support yes vhost-vsock support yes Trace backends log spice support no rbd support no xfsctl support no smartcard support no libusb no usb net redir no OpenGL support no OpenGL dmabufs no libiscsi support no libnfs support no build guest agent yes QGA VSS support no QGA w32 disk info no QGA MSI support no seccomp support no coroutine backend ucontext coroutine pool yes debug stack usage no GlusterFS support no gcov gcov gcov enabled no TPM support yes libssh2 support no TPM passthrough yes QOM debugging yes lzo support no snappy support no bzip2 support no NUMA host support no tcmalloc support no jemalloc support no avx2 optimization no replication support yes VxHS block device no mkdir -p dtc/libfdt mkdir -p dtc/tests GEN aarch64-softmmu/config-devices.mak.tmp GEN x86_64-softmmu/config-devices.mak.tmp GEN qemu-options.def GEN config-host.h GEN qapi-visit.h GEN qmp-commands.h GEN qapi-types.h GEN qapi-event.h GEN x86_64-softmmu/config-devices.mak GEN qmp-marshal.c GEN aarch64-softmmu/config-devices.mak GEN qapi-types.c GEN qapi-visit.c GEN qapi-event.c GEN qmp-introspect.h GEN qmp-introspect.c GEN trace/generated-tcg-tracers.h GEN trace/generated-helpers-wrappers.h GEN trace/generated-helpers.h GEN trace/generated-helpers.c GEN module_block.h GEN tests/test-qapi-types.h GEN tests/test-qapi-visit.h GEN tests/test-qapi-event.h GEN tests/test-qmp-commands.h GEN tests/test-qmp-introspect.h GEN trace-root.h GEN util/trace.h GEN crypto/trace.h GEN io/trace.h GEN migration/trace.h GEN block/trace.h GEN backends/trace.h GEN hw/block/trace.h GEN hw/block/dataplane/trace.h GEN hw/char/trace.h GEN hw/intc/trace.h GEN hw/net/trace.h GEN hw/virtio/trace.h GEN hw/audio/trace.h GEN hw/misc/trace.h GEN hw/usb/trace.h GEN hw/scsi/trace.h GEN hw/nvram/trace.h GEN hw/display/trace.h GEN hw/input/trace.h GEN hw/timer/trace.h GEN hw/dma/trace.h GEN hw/sparc/trace.h GEN hw/sd/trace.h GEN hw/isa/trace.h GEN hw/mem/trace.h GEN hw/i386/trace.h GEN hw/i386/xen/trace.h GEN hw/9pfs/trace.h GEN hw/ppc/trace.h GEN hw/pci/trace.h GEN hw/s390x/trace.h GEN hw/vfio/trace.h GEN hw/acpi/trace.h GEN hw/arm/trace.h GEN hw/alpha/trace.h GEN hw/xen/trace.h GEN ui/trace.h GEN audio/trace.h GEN net/trace.h GEN target/arm/trace.h GEN target/i386/trace.h GEN target/mips/trace.h GEN target/sparc/trace.h GEN target/s390x/trace.h GEN target/ppc/trace.h GEN qom/trace.h GEN linux-user/trace.h GEN qapi/trace.h GEN trace-root.c GEN util/trace.c GEN crypto/trace.c GEN io/trace.c GEN migration/trace.c GEN block/trace.c GEN backends/trace.c GEN hw/block/trace.c GEN hw/block/dataplane/trace.c GEN hw/char/trace.c GEN hw/intc/trace.c GEN hw/net/trace.c GEN hw/virtio/trace.c GEN hw/audio/trace.c GEN hw/misc/trace.c GEN hw/usb/trace.c GEN hw/scsi/trace.c GEN hw/nvram/trace.c GEN hw/display/trace.c GEN hw/input/trace.c GEN hw/timer/trace.c GEN hw/dma/trace.c GEN hw/sparc/trace.c GEN hw/sd/trace.c GEN hw/isa/trace.c GEN hw/mem/trace.c GEN hw/i386/trace.c GEN hw/i386/xen/trace.c GEN hw/9pfs/trace.c GEN hw/ppc/trace.c GEN hw/pci/trace.c GEN hw/s390x/trace.c GEN hw/vfio/trace.c GEN hw/acpi/trace.c GEN hw/arm/trace.c GEN hw/alpha/trace.c GEN hw/xen/trace.c GEN ui/trace.c GEN audio/trace.c GEN net/trace.c GEN target/arm/trace.c GEN target/i386/trace.c GEN target/mips/trace.c GEN target/sparc/trace.c GEN target/s390x/trace.c GEN target/ppc/trace.c GEN qom/trace.c GEN linux-user/trace.c GEN qapi/trace.c GEN config-all-devices.mak DEP /tmp/qemu-test/src/dtc/tests/dumptrees.c DEP /tmp/qemu-test/src/dtc/tests/trees.S DEP /tmp/qemu-test/src/dtc/tests/testutils.c DEP /tmp/qemu-test/src/dtc/tests/value-labels.c DEP /tmp/qemu-test/src/dtc/tests/asm_tree_dump.c DEP /tmp/qemu-test/src/dtc/tests/truncated_property.c DEP /tmp/qemu-test/src/dtc/tests/overlay_bad_fixup.c DEP /tmp/qemu-test/src/dtc/tests/check_path.c DEP /tmp/qemu-test/src/dtc/tests/subnode_iterate.c DEP /tmp/qemu-test/src/dtc/tests/overlay.c DEP /tmp/qemu-test/src/dtc/tests/property_iterate.c DEP /tmp/qemu-test/src/dtc/tests/integer-expressions.c DEP /tmp/qemu-test/src/dtc/tests/utilfdt_test.c DEP /tmp/qemu-test/src/dtc/tests/path_offset_aliases.c DEP /tmp/qemu-test/src/dtc/tests/add_subnode_with_nops.c DEP /tmp/qemu-test/src/dtc/tests/dtb_reverse.c DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_unordered.c DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_ordered.c DEP /tmp/qemu-test/src/dtc/tests/extra-terminating-null.c DEP /tmp/qemu-test/src/dtc/tests/incbin.c DEP /tmp/qemu-test/src/dtc/tests/boot-cpuid.c DEP /tmp/qemu-test/src/dtc/tests/phandle_format.c DEP /tmp/qemu-test/src/dtc/tests/path-references.c DEP /tmp/qemu-test/src/dtc/tests/references.c DEP /tmp/qemu-test/src/dtc/tests/string_escapes.c DEP /tmp/qemu-test/src/dtc/tests/propname_escapes.c DEP /tmp/qemu-test/src/dtc/tests/appendprop2.c DEP /tmp/qemu-test/src/dtc/tests/appendprop1.c DEP /tmp/qemu-test/src/dtc/tests/del_node.c DEP /tmp/qemu-test/src/dtc/tests/del_property.c DEP /tmp/qemu-test/src/dtc/tests/set_name.c DEP /tmp/qemu-test/src/dtc/tests/setprop.c DEP /tmp/qemu-test/src/dtc/tests/open_pack.c DEP /tmp/qemu-test/src/dtc/tests/rw_tree1.c DEP /tmp/qemu-test/src/dtc/tests/nopulate.c DEP /tmp/qemu-test/src/dtc/tests/mangle-layout.c DEP /tmp/qemu-test/src/dtc/tests/move_and_save.c DEP /tmp/qemu-test/src/dtc/tests/sw_tree1.c DEP /tmp/qemu-test/src/dtc/tests/nop_node.c DEP /tmp/qemu-test/src/dtc/tests/nop_property.c DEP /tmp/qemu-test/src/dtc/tests/setprop_inplace.c DEP /tmp/qemu-test/src/dtc/tests/stringlist.c DEP /tmp/qemu-test/src/dtc/tests/notfound.c DEP /tmp/qemu-test/src/dtc/tests/addr_size_cells.c DEP /tmp/qemu-test/src/dtc/tests/sized_cells.c DEP /tmp/qemu-test/src/dtc/tests/char_literal.c DEP /tmp/qemu-test/src/dtc/tests/get_alias.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_compatible.c DEP /tmp/qemu-test/src/dtc/tests/node_check_compatible.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_phandle.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_prop_value.c DEP /tmp/qemu-test/src/dtc/tests/parent_offset.c DEP /tmp/qemu-test/src/dtc/tests/get_path.c DEP /tmp/qemu-test/src/dtc/tests/supernode_atdepth_offset.c DEP /tmp/qemu-test/src/dtc/tests/get_phandle.c DEP /tmp/qemu-test/src/dtc/tests/getprop.c DEP /tmp/qemu-test/src/dtc/tests/get_name.c DEP /tmp/qemu-test/src/dtc/tests/path_offset.c DEP /tmp/qemu-test/src/dtc/tests/subnode_offset.c DEP /tmp/qemu-test/src/dtc/tests/find_property.c DEP /tmp/qemu-test/src/dtc/tests/root_node.c DEP /tmp/qemu-test/src/dtc/tests/get_mem_rsv.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_overlay.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_empty_tree.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_addresses.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_strerror.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_rw.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_sw.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_wip.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_ro.c DEP /tmp/qemu-test/src/dtc/util.c DEP /tmp/qemu-test/src/dtc/fdtput.c DEP /tmp/qemu-test/src/dtc/fdtget.c DEP /tmp/qemu-test/src/dtc/fdtdump.c DEP /tmp/qemu-test/src/dtc/srcpos.c LEX convert-dtsv0-lexer.lex.c make[1]: flex: Command not found LEX dtc-lexer.lex.c make[1]: flex: Command not found BISON dtc-parser.tab.c DEP /tmp/qemu-test/src/dtc/treesource.c make[1]: bison: Command not found DEP /tmp/qemu-test/src/dtc/livetree.c DEP /tmp/qemu-test/src/dtc/fstree.c DEP /tmp/qemu-test/src/dtc/flattree.c DEP /tmp/qemu-test/src/dtc/dtc.c DEP /tmp/qemu-test/src/dtc/data.c DEP /tmp/qemu-test/src/dtc/checks.c CHK version_gen.h BISON dtc-parser.tab.c UPD version_gen.h LEX dtc-lexer.lex.c LEX convert-dtsv0-lexer.lex.c make[1]: bison: Command not found make[1]: flex: Command not found make[1]: flex: Command not found DEP /tmp/qemu-test/src/dtc/util.c LEX convert-dtsv0-lexer.lex.c LEX dtc-lexer.lex.c make[1]: flex: Command not found make[1]: BISON dtc-parser.tab.c flex: Command not found make[1]: bison: Command not found CC libfdt/fdt.o CC libfdt/fdt_ro.o CC libfdt/fdt_rw.o CC libfdt/fdt_sw.o CC libfdt/fdt_strerror.o CC libfdt/fdt_wip.o CC libfdt/fdt_empty_tree.o CC libfdt/fdt_addresses.o CC libfdt/fdt_overlay.o AR libfdt/libfdt.a ar: creating libfdt/libfdt.a a - libfdt/fdt.o a - libfdt/fdt_ro.o a - libfdt/fdt_wip.o a - libfdt/fdt_sw.o a - libfdt/fdt_rw.o a - libfdt/fdt_strerror.o a - libfdt/fdt_empty_tree.o a - libfdt/fdt_addresses.o a - libfdt/fdt_overlay.o BISON dtc-parser.tab.c LEX dtc-lexer.lex.c make[1]: bison: Command not found make[1]: flex: Command not found LEX convert-dtsv0-lexer.lex.c make[1]: flex: Command not found CC tests/qemu-iotests/socket_scm_helper.o GEN qga/qapi-generated/qga-qapi-types.h GEN qga/qapi-generated/qga-qapi-visit.c GEN qga/qapi-generated/qga-qmp-commands.h GEN qga/qapi-generated/qga-qapi-visit.h GEN qga/qapi-generated/qga-qapi-types.c GEN qga/qapi-generated/qga-qmp-marshal.c CC qmp-introspect.o CC qapi-types.o CC qapi-visit.o CC qapi-event.o CC qapi/qapi-visit-core.o CC qapi/qapi-dealloc-visitor.o CC qapi/qobject-input-visitor.o CC qapi/qobject-output-visitor.o CC qapi/qmp-registry.o CC qapi/qmp-dispatch.o CC qapi/string-input-visitor.o CC qapi/string-output-visitor.o CC qapi/opts-visitor.o CC qapi/qapi-clone-visitor.o CC qapi/qapi-util.o CC qapi/qmp-event.o CC qobject/qnull.o CC qobject/qint.o CC qobject/qstring.o CC qobject/qdict.o CC qobject/qfloat.o CC qobject/qlist.o CC qobject/qbool.o CC qobject/qjson.o CC qobject/qobject.o CC qobject/json-lexer.o CC qobject/json-streamer.o CC qobject/json-parser.o CC trace/control.o CC trace/qmp.o CC util/osdep.o CC util/cutils.o CC util/unicode.o CC util/qemu-timer-common.o CC util/bufferiszero.o CC util/lockcnt.o CC util/aiocb.o CC util/async.o CC util/thread-pool.o CC util/qemu-timer.o CC util/main-loop.o CC util/iohandler.o CC util/aio-posix.o CC util/compatfd.o CC util/event_notifier-posix.o CC util/mmap-alloc.o CC util/oslib-posix.o CC util/qemu-thread-posix.o CC util/qemu-openpty.o CC util/memfd.o CC util/envlist.o CC util/path.o CC util/module.o CC util/host-utils.o CC util/bitmap.o CC util/bitops.o CC util/hbitmap.o CC util/fifo8.o CC util/acl.o CC util/error.o CC util/qemu-error.o CC util/id.o CC util/iov.o CC util/qemu-config.o CC util/qemu-sockets.o CC util/notify.o CC util/uri.o CC util/qemu-option.o CC util/qemu-progress.o CC util/hexdump.o CC util/crc32c.o CC util/keyval.o CC util/uuid.o CC util/throttle.o CC util/getauxval.o CC util/rcu.o CC util/readline.o CC util/qemu-coroutine.o CC util/qemu-coroutine-lock.o CC util/qemu-coroutine-io.o CC util/qemu-coroutine-sleep.o CC util/coroutine-ucontext.o CC util/buffer.o CC util/base64.o CC util/timed-average.o CC util/log.o CC util/qdist.o CC util/qht.o CC util/range.o CC util/systemd.o CC trace-root.o CC util/PanelEmu.o CC crypto/trace.o CC util/trace.o CC io/trace.o CC migration/trace.o CC block/trace.o CC backends/trace.o CC hw/block/trace.o CC hw/block/dataplane/trace.o CC hw/char/trace.o CC hw/intc/trace.o CC hw/net/trace.o CC hw/virtio/trace.o CC hw/audio/trace.o CC hw/misc/trace.o CC hw/usb/trace.o CC hw/display/trace.o CC hw/nvram/trace.o CC hw/scsi/trace.o CC hw/timer/trace.o CC hw/input/trace.o CC hw/dma/trace.o CC hw/sparc/trace.o CC hw/sd/trace.o CC hw/isa/trace.o CC hw/mem/trace.o CC hw/i386/trace.o CC hw/i386/xen/trace.o CC hw/9pfs/trace.o CC hw/ppc/trace.o CC hw/pci/trace.o CC hw/s390x/trace.o CC hw/vfio/trace.o CC hw/arm/trace.o CC hw/acpi/trace.o CC hw/alpha/trace.o CC hw/xen/trace.o CC ui/trace.o CC audio/trace.o CC net/trace.o CC target/arm/trace.o CC target/i386/trace.o CC target/mips/trace.o CC target/sparc/trace.o CC target/s390x/trace.o CC target/ppc/trace.o /tmp/qemu-test/src/util/PanelEmu.c: In function ‘panel_read’: /tmp/qemu-test/src/util/PanelEmu.c:189: error: ‘for’ loop initial declarations are only allowed in C99 mode /tmp/qemu-test/src/util/PanelEmu.c:189: note: use option -std=c99 or -std=gnu99 to compile your code /tmp/qemu-test/src/util/PanelEmu.c:222: error: ‘for’ loop initial declarations are only allowed in C99 mode make: *** [util/PanelEmu.o] Error 1 make: *** Waiting for unfinished jobs.... CC qom/trace.o tests/docker/Makefile.include:118: recipe for target 'docker-run' failed make[1]: *** [docker-run] Error 2 make[1]: Leaving directory '/var/tmp/patchew-tester-tmp-1zdsj2xe/src' tests/docker/Makefile.include:149: recipe for target 'docker-run-test-quick@centos6' failed make: *** [docker-run-test-quick@centos6] Error 2 === OUTPUT END === Test command exited with code: 2 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org
Hi, This series seems to have some coding style problems. See output below for more information: Subject: [Qemu-devel] (no subject) Type: series Message-id: 536fb79a-5753-4143-a5a6-7a189ef5137e@ONE.local === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 git config --local diff.renamelimit 0 git config --local diff.renames True commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test' 32d5d78 (no subject) === OUTPUT BEGIN === Checking PATCH 1/1: (no subject)... ERROR: space prohibited before that '++' (ctx:WxB) #34: FILE: hw/gpio/bcm2835_gpio.c:58: + for (i = 0; i < 10; i ++) { ^ ERROR: space prohibited between function name and open parenthesis '(' #37: FILE: hw/gpio/bcm2835_gpio.c:60: + if (index < sizeof (s->fsel)) { ERROR: space prohibited before that '++' (ctx:WxB) #46: FILE: hw/gpio/bcm2835_gpio.c:70: + for (i = 0; i < 10; i ++) { ^ ERROR: space prohibited between function name and open parenthesis '(' #49: FILE: hw/gpio/bcm2835_gpio.c:72: + if (index < sizeof (s->fsel)) { ERROR: space prohibited after that '~' (ctx:WxW) #100: FILE: hw/gpio/bcm2835_gpio.c:115: + uint32_t changes = val & ~ *lev; ^ ERROR: space prohibited before that '++' (ctx:WxB) #105: FILE: hw/gpio/bcm2835_gpio.c:119: + for (i = 0; i < count; i ++) { ^ ERROR: space prohibited before that '++' (ctx:WxB) #121: FILE: hw/gpio/bcm2835_gpio.c:136: + for (i = 0; i < count; i ++) { ^ ERROR: space prohibited after that '~' (ctx:WxW) #129: FILE: hw/gpio/bcm2835_gpio.c:143: + *lev &= ~ val; ^ ERROR: switch and case should be at the same indent #141: FILE: hw/gpio/bcm2835_gpio.c:152: switch (offset) { + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: [...] + case GPSET0: + case GPSET1: [...] + case GPCLR0: + case GPCLR1: [...] + case GPLEV0: [...] + case GPLEV1: [...] + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + case GPPUD: + case GPPUDCLK0: + case GPPUDCLK1: [...] + default: ERROR: space prohibited after that '-' (ctx:WxW) #200: FILE: hw/gpio/bcm2835_gpio.c:169: + if (s->panel.socket != - 1) { ^ ERROR: space prohibited after that '-' (ctx:WxW) #208: FILE: hw/gpio/bcm2835_gpio.c:177: + if (s->panel.socket != - 1) { ^ ERROR: switch and case should be at the same indent #252: FILE: hw/gpio/bcm2835_gpio.c:219: switch (offset) { + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: [...] + case GPSET0: [...] + case GPSET1: [...] + case GPCLR0: [...] + case GPCLR1: [...] + case GPLEV0: + case GPLEV1: [...] + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + case GPPUD: + case GPPUDCLK0: + case GPPUDCLK1: [...] + default: ERROR: space prohibited after that '-' (ctx:WxW) #308: FILE: hw/gpio/bcm2835_gpio.c:230: + if (s->panel.socket != - 1) { ^ WARNING: line over 80 characters #310: FILE: hw/gpio/bcm2835_gpio.c:232: + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel ERROR: do not use C99 // comments #310: FILE: hw/gpio/bcm2835_gpio.c:232: + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel ERROR: space prohibited after that '-' (ctx:WxW) #315: FILE: hw/gpio/bcm2835_gpio.c:237: + if (s->panel.socket != - 1) { ^ WARNING: line over 80 characters #318: FILE: hw/gpio/bcm2835_gpio.c:240: + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel ERROR: do not use C99 // comments #318: FILE: hw/gpio/bcm2835_gpio.c:240: + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel ERROR: space prohibited after that '-' (ctx:WxW) #323: FILE: hw/gpio/bcm2835_gpio.c:245: + if (s->panel.socket != - 1) { ^ WARNING: line over 80 characters #325: FILE: hw/gpio/bcm2835_gpio.c:247: + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel ERROR: do not use C99 // comments #325: FILE: hw/gpio/bcm2835_gpio.c:247: + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel ERROR: space prohibited after that '-' (ctx:WxW) #330: FILE: hw/gpio/bcm2835_gpio.c:252: + if (s->panel.socket != - 1) { ^ WARNING: line over 80 characters #333: FILE: hw/gpio/bcm2835_gpio.c:255: + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel ERROR: do not use C99 // comments #333: FILE: hw/gpio/bcm2835_gpio.c:255: + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel ERROR: space prohibited before that '++' (ctx:WxB) #376: FILE: hw/gpio/bcm2835_gpio.c:296: + for (i = 0; i < 6; i ++) { ^ WARNING: line over 80 characters #389: FILE: hw/gpio/bcm2835_gpio.c:312: + .endianness = DEVICE_NATIVE_ENDIAN, WARNING: line over 80 characters #405: FILE: hw/gpio/bcm2835_gpio.c:319: + .fields = (VMStateField[]) ERROR: space prohibited between function name and open parenthesis '(' #420: FILE: hw/gpio/bcm2835_gpio.c:335: + qbus_create_inplace(&s->sdbus, sizeof (s->sdbus), ERROR: do not use C99 // comments #431: FILE: hw/gpio/bcm2835_gpio.c:345: + sendpincount(&s->panel, 54); //PI Has 54 Pins WARNING: line over 80 characters #432: FILE: hw/gpio/bcm2835_gpio.c:346: + sendenabledmap(&s->panel, 0x003FFFFFFFFFFFFC); //Pins 0 & 1 are I2C so disable ERROR: do not use C99 // comments #432: FILE: hw/gpio/bcm2835_gpio.c:346: + sendenabledmap(&s->panel, 0x003FFFFFFFFFFFFC); //Pins 0 & 1 are I2C so disable ERROR: line over 90 characters #433: FILE: hw/gpio/bcm2835_gpio.c:347: + sendinputmap(&s->panel, 0x0000000000000000); //There are no dedicated input pins I know off ERROR: do not use C99 // comments #433: FILE: hw/gpio/bcm2835_gpio.c:347: + sendinputmap(&s->panel, 0x0000000000000000); //There are no dedicated input pins I know off WARNING: line over 80 characters #434: FILE: hw/gpio/bcm2835_gpio.c:348: + sendoutputmap(&s->panel, 0x0000800000000000); //Pin 53 is dedicated output LED ERROR: do not use C99 // comments #434: FILE: hw/gpio/bcm2835_gpio.c:348: + sendoutputmap(&s->panel, 0x0000800000000000); //Pin 53 is dedicated output LED WARNING: line over 80 characters #436: FILE: hw/gpio/bcm2835_gpio.c:350: + printf("Couldn't connect to a GPIO panel\n"); //John Bradley dummy GPIO Panel ERROR: do not use C99 // comments #436: FILE: hw/gpio/bcm2835_gpio.c:350: + printf("Couldn't connect to a GPIO panel\n"); //John Bradley dummy GPIO Panel ERROR: space prohibited after that '&' (ctx:WxW) #466: FILE: hw/gpio/bcm2835_gpio.c:381: + dc->vmsd = & vmstate_bcm2835_gpio; ^ ERROR: space prohibited after that '&' (ctx:WxW) #467: FILE: hw/gpio/bcm2835_gpio.c:382: + dc->realize = & bcm2835_gpio_realize; ^ ERROR: space prohibited after that '&' (ctx:WxW) #468: FILE: hw/gpio/bcm2835_gpio.c:383: + dc->reset = & bcm2835_gpio_reset; ^ WARNING: line over 80 characters #479: FILE: hw/gpio/bcm2835_gpio.c:389: + .instance_size = sizeof (BCM2835GpioState), ERROR: space prohibited between function name and open parenthesis '(' #479: FILE: hw/gpio/bcm2835_gpio.c:389: + .instance_size = sizeof (BCM2835GpioState), WARNING: line over 80 characters #481: FILE: hw/gpio/bcm2835_gpio.c:391: + .class_init = bcm2835_gpio_class_init, WARNING: architecture specific defines should be avoided #530: FILE: include/qemu/PanelEmu.h:17: +#ifdef __cplusplus ERROR: do not use C99 // comments #539: FILE: include/qemu/PanelEmu.h:26: +#define DEFAULT_PORT 0xb1ff //45567 ERROR: code indent should never use tabs #547: FILE: include/qemu/PanelEmu.h:34: +^I unless something changed */$ ERROR: do not use C99 // comments #548: FILE: include/qemu/PanelEmu.h:35: + int ProtocolInUse; //What version of the protocol are we using. ERROR: "foo* bar" should be "foo *bar" #551: FILE: include/qemu/PanelEmu.h:38: + bool panel_open(panel_connection_t* h); ERROR: "foo* bar" should be "foo *bar" #553: FILE: include/qemu/PanelEmu.h:40: + bool panel_read(panel_connection_t* h, uint64_t *pinS); ERROR: "foo* bar" should be "foo *bar" #554: FILE: include/qemu/PanelEmu.h:41: + void senddatatopanel(panel_connection_t* h, uint64_t pinS, bool Value); ERROR: "foo* bar" should be "foo *bar" #555: FILE: include/qemu/PanelEmu.h:42: + void panel_send_read_command(panel_connection_t* h); ERROR: "foo* bar" should be "foo *bar" #556: FILE: include/qemu/PanelEmu.h:43: + void sendpincount(panel_connection_t* h, int Num); ERROR: "foo* bar" should be "foo *bar" #557: FILE: include/qemu/PanelEmu.h:44: + void sendenabledmap(panel_connection_t* h, uint64_t pins); ERROR: "foo* bar" should be "foo *bar" #558: FILE: include/qemu/PanelEmu.h:45: + void sendinputmap(panel_connection_t* h, uint64_t pins); ERROR: "foo* bar" should be "foo *bar" #559: FILE: include/qemu/PanelEmu.h:46: + void sendoutputmap(panel_connection_t* h, uint64_t pins); WARNING: architecture specific defines should be avoided #562: FILE: include/qemu/PanelEmu.h:49: +#ifdef __cplusplus WARNING: architecture specific defines should be avoided #596: FILE: util/PanelEmu.c:13: +#ifdef __MINGW32__ ERROR: open brace '{' following enum go on the same line #608: FILE: util/PanelEmu.c:25: +typedef enum +{ ERROR: do not use C99 // comments #625: FILE: util/PanelEmu.c:42: +#define PACKETLEN 0 //Includes Packet Length ERROR: open brace '{' following struct go on the same line #629: FILE: util/PanelEmu.c:46: +typedef struct +{ ERROR: "foo* bar" should be "foo *bar" #635: FILE: util/PanelEmu.c:52: +static void panel_send_protocol_command(panel_connection_t* h) ERROR: "foo* bar" should be "foo *bar" #647: FILE: util/PanelEmu.c:64: +void panel_send_read_command(panel_connection_t* h) ERROR: "foo* bar" should be "foo *bar" #658: FILE: util/PanelEmu.c:75: +void senddatatopanel(panel_connection_t* h, uint64_t pin, bool val) ERROR: spaces required around that '-' (ctx:VxV) #662: FILE: util/PanelEmu.c:79: + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[6 + 1]-(char *) &Pkt.Data[0]; ^ ERROR: spaces required around that '&' (ctx:VxV) #665: FILE: util/PanelEmu.c:82: + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); ^ ERROR: spaces required around that '&' (ctx:VxV) #667: FILE: util/PanelEmu.c:84: + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); ^ ERROR: "foo* bar" should be "foo *bar" #673: FILE: util/PanelEmu.c:90: +void sendpincount(panel_connection_t* h, int val) ERROR: spaces required around that '-' (ctx:VxV) #677: FILE: util/PanelEmu.c:94: + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[2 + 1]-(char *) &Pkt.Data[0]; ^ ERROR: "foo* bar" should be "foo *bar" #684: FILE: util/PanelEmu.c:101: +void sendenabledmap(panel_connection_t* h, uint64_t pin) ERROR: spaces required around that '-' (ctx:VxV) #688: FILE: util/PanelEmu.c:105: + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; ^ ERROR: spaces required around that '&' (ctx:VxV) #691: FILE: util/PanelEmu.c:108: + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); ^ ERROR: spaces required around that '&' (ctx:VxV) #693: FILE: util/PanelEmu.c:110: + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); ^ ERROR: "foo* bar" should be "foo *bar" #698: FILE: util/PanelEmu.c:115: +void sendinputmap(panel_connection_t* h, uint64_t pin) ERROR: spaces required around that '-' (ctx:VxV) #702: FILE: util/PanelEmu.c:119: + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; ^ ERROR: spaces required around that '&' (ctx:VxV) #705: FILE: util/PanelEmu.c:122: + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); ^ ERROR: spaces required around that '&' (ctx:VxV) #707: FILE: util/PanelEmu.c:124: + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); ^ ERROR: "foo* bar" should be "foo *bar" #712: FILE: util/PanelEmu.c:129: +void sendoutputmap(panel_connection_t* h, uint64_t pin) ERROR: spaces required around that '-' (ctx:VxV) #716: FILE: util/PanelEmu.c:133: + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; ^ ERROR: spaces required around that '&' (ctx:VxV) #719: FILE: util/PanelEmu.c:136: + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); ^ ERROR: spaces required around that '&' (ctx:VxV) #721: FILE: util/PanelEmu.c:138: + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); ^ ERROR: space prohibited after that '-' (ctx:WxW) #728: FILE: util/PanelEmu.c:145: + if (send(h->socket, (char *) Pkt, Pkt->Data[PACKETLEN], 0) == - 1) { ^ WARNING: architecture specific defines should be avoided #730: FILE: util/PanelEmu.c:147: +#ifdef __MINGW32__ ERROR: space prohibited after that '-' (ctx:WxW) #735: FILE: util/PanelEmu.c:152: + h->socket = - 1; /* act like we never connected */ ^ ERROR: "foo* bar" should be "foo *bar" #740: FILE: util/PanelEmu.c:157: +bool panel_read(panel_connection_t* h, uint64_t* Data) ERROR: space prohibited between function name and open parenthesis '(' #746: FILE: util/PanelEmu.c:163: + CommandPacket *PktPtr = (CommandPacket *) malloc(sizeof (CommandPacket)); ERROR: space prohibited after that '-' (ctx:WxW) #758: FILE: util/PanelEmu.c:175: + if (h->socket != - 1) { ^ ERROR: do not use C99 // comments #762: FILE: util/PanelEmu.c:179: +// printf(PANEL_NAME "panel_read\n"); ERROR: spaces required around that '&&' (ctx:VxO) #765: FILE: util/PanelEmu.c:182: + while (NoError&&! NoData) { ^ ERROR: space prohibited after that '!' (ctx:OxW) #765: FILE: util/PanelEmu.c:182: + while (NoError&&! NoData) { ^ ERROR: line over 90 characters #770: FILE: util/PanelEmu.c:187: + if ((LengthInBuffer = recv(h->socket, (char *) &Pkt[ReadStart], sizeof (*Pkt) - ReadStart, 0)) > 0) { ERROR: space prohibited between function name and open parenthesis '(' #770: FILE: util/PanelEmu.c:187: + if ((LengthInBuffer = recv(h->socket, (char *) &Pkt[ReadStart], sizeof (*Pkt) - ReadStart, 0)) > 0) { ERROR: do not use assignment in if condition #770: FILE: util/PanelEmu.c:187: + if ((LengthInBuffer = recv(h->socket, (char *) &Pkt[ReadStart], sizeof (*Pkt) - ReadStart, 0)) > 0) { ERROR: space prohibited before that '++' (ctx:WxB) #772: FILE: util/PanelEmu.c:189: + for (int i = 0; LengthInBuffer > 0; i ++) { ^ ERROR: that open brace { should be on the previous line #774: FILE: util/PanelEmu.c:191: + switch (Pkt->Data[i + PACKETTYPE]) + { WARNING: line over 80 characters #778: FILE: util/PanelEmu.c:195: + *Data |= ((uint64_t) Pkt->Data[i + 3]) << 16; WARNING: line over 80 characters #779: FILE: util/PanelEmu.c:196: + *Data |= ((uint64_t) Pkt->Data[i + 4]) << 32; WARNING: line over 80 characters #780: FILE: util/PanelEmu.c:197: + *Data |= ((uint64_t) Pkt->Data[i + 5]) << 48; WARNING: line over 80 characters #786: FILE: util/PanelEmu.c:203: + h->ProtocolInUse = (int) Pkt->Data[i + 2]; ERROR: that open brace { should be on the previous line #787: FILE: util/PanelEmu.c:204: + if(h->ProtocolInUse!=-1) + { ERROR: spaces required around that '!=' (ctx:VxO) #787: FILE: util/PanelEmu.c:204: + if(h->ProtocolInUse!=-1) ^ ERROR: space required before that '-' (ctx:OxV) #787: FILE: util/PanelEmu.c:204: + if(h->ProtocolInUse!=-1) ^ ERROR: space required before the open parenthesis '(' #787: FILE: util/PanelEmu.c:204: + if(h->ProtocolInUse!=-1) ERROR: line over 90 characters #789: FILE: util/PanelEmu.c:206: + printf(PANEL_NAME "Protocol %d in used\n",h->ProtocolInUse); ERROR: space required after that ',' (ctx:VxV) #789: FILE: util/PanelEmu.c:206: + printf(PANEL_NAME "Protocol %d in used\n",h->ProtocolInUse); ^ ERROR: that open brace { should be on the previous line #791: FILE: util/PanelEmu.c:208: + else + { ERROR: else should follow close brace '}' #791: FILE: util/PanelEmu.c:208: + } + else ERROR: trailing whitespace #793: FILE: util/PanelEmu.c:210: + printf(PANEL_NAME "No Common Protocol\n"); $ ERROR: line over 90 characters #793: FILE: util/PanelEmu.c:210: + printf(PANEL_NAME "No Common Protocol\n"); WARNING: line over 80 characters #798: FILE: util/PanelEmu.c:215: + printf(PANEL_NAME "Invalid data received\n"); ERROR: line over 90 characters #802: FILE: util/PanelEmu.c:219: + i += Pkt->Data[PACKETLEN]; // Pkt=(CommandPacket *)&(Pkt->Data[Pkt->Data[PACKETLEN]]); ERROR: code indent should never use tabs #802: FILE: util/PanelEmu.c:219: + i += Pkt->Data[PACKETLEN]; //^I^I^I^I^I^I^I^IPkt=(CommandPacket *)&(Pkt->Data[Pkt->Data[PACKETLEN]]);$ ERROR: do not use C99 // comments #802: FILE: util/PanelEmu.c:219: + i += Pkt->Data[PACKETLEN]; // Pkt=(CommandPacket *)&(Pkt->Data[Pkt->Data[PACKETLEN]]); ERROR: space prohibited before that '++' (ctx:WxB) #805: FILE: util/PanelEmu.c:222: + for (int j = 0; j < LengthInBuffer; j ++) { ^ WARNING: architecture specific defines should be avoided #826: FILE: util/PanelEmu.c:243: +#ifdef __MINGW32__ ERROR: space prohibited after that '-' (ctx:WxW) #831: FILE: util/PanelEmu.c:248: + h->socket = - 1; /* act like we never connected */ ^ ERROR: "foo* bar" should be "foo *bar" #843: FILE: util/PanelEmu.c:260: +bool panel_open(panel_connection_t* h) ERROR: trailing whitespace #846: FILE: util/PanelEmu.c:263: +#ifdef __MINGW32__ $ WARNING: architecture specific defines should be avoided #846: FILE: util/PanelEmu.c:263: +#ifdef __MINGW32__ ERROR: trailing whitespace #849: FILE: util/PanelEmu.c:266: + struct sockaddr_in remote; $ ERROR: trailing whitespace #851: FILE: util/PanelEmu.c:268: + $ ERROR: trailing whitespace #854: FILE: util/PanelEmu.c:271: +#ifdef __MINGW32__ $ WARNING: architecture specific defines should be avoided #854: FILE: util/PanelEmu.c:271: +#ifdef __MINGW32__ ERROR: trailing whitespace #857: FILE: util/PanelEmu.c:274: + printf("NOT __MINGW32__\n"); $ ERROR: trailing whitespace #858: FILE: util/PanelEmu.c:275: +#endif $ ERROR: trailing whitespace #859: FILE: util/PanelEmu.c:276: + $ ERROR: spaces required around that '=' (ctx:VxO) #860: FILE: util/PanelEmu.c:277: + h->socket=-1; ^ ERROR: space required before that '-' (ctx:OxV) #860: FILE: util/PanelEmu.c:277: + h->socket=-1; ^ ERROR: spaces required around that '=' (ctx:VxO) #861: FILE: util/PanelEmu.c:278: + h->ProtocolInUse=-1; ^ ERROR: space required before that '-' (ctx:OxV) #861: FILE: util/PanelEmu.c:278: + h->ProtocolInUse=-1; ^ ERROR: trailing whitespace #862: FILE: util/PanelEmu.c:279: + $ WARNING: architecture specific defines should be avoided #863: FILE: util/PanelEmu.c:280: +#ifdef __MINGW32__ ERROR: braces {} are necessary for all arms of this statement #865: FILE: util/PanelEmu.c:282: + if (WSAStartup(MAKEWORD(1, 1), &wsadata) == SOCKET_ERROR) { [...] + else [...] ERROR: else should follow close brace '}' #868: FILE: util/PanelEmu.c:285: + } + else ERROR: space prohibited after that '-' (ctx:WxW) #871: FILE: util/PanelEmu.c:288: + if ((h->socket = socket(AF_INET, SOCK_STREAM, 0)) != - 1) { ^ ERROR: do not use assignment in if condition #871: FILE: util/PanelEmu.c:288: + if ((h->socket = socket(AF_INET, SOCK_STREAM, 0)) != - 1) { WARNING: architecture specific defines should be avoided #872: FILE: util/PanelEmu.c:289: +#ifdef __MINGW32__ ERROR: trailing whitespace #876: FILE: util/PanelEmu.c:293: + remote.sin_addr.s_addr = inet_addr("127.0.0.1"); $ ERROR: use memset() instead of bzero() #878: FILE: util/PanelEmu.c:295: + bzero((char *)&remote, sizeof(remote)); ERROR: line over 90 characters #883: FILE: util/PanelEmu.c:300: + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { ERROR: space prohibited between function name and open parenthesis '(' #883: FILE: util/PanelEmu.c:300: + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { ERROR: spaces required around that '=' (ctx:VxV) #883: FILE: util/PanelEmu.c:300: + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { ^ ERROR: space prohibited after that '-' (ctx:WxW) #883: FILE: util/PanelEmu.c:300: + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { ^ ERROR: do not use assignment in if condition #883: FILE: util/PanelEmu.c:300: + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { WARNING: architecture specific defines should be avoided #884: FILE: util/PanelEmu.c:301: +#ifdef __MINGW32__ WARNING: line over 80 characters #886: FILE: util/PanelEmu.c:303: + setsockopt(h->socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof ( value)); ERROR: space prohibited between function name and open parenthesis '(' #886: FILE: util/PanelEmu.c:303: + setsockopt(h->socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof ( value)); ERROR: space prohibited after that open parenthesis '(' #886: FILE: util/PanelEmu.c:303: + setsockopt(h->socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof ( value)); ERROR: space required after that ',' (ctx:VxV) #894: FILE: util/PanelEmu.c:311: + printf(PANEL_NAME "Connected OK %d\n",rv); ^ ERROR: trailing whitespace #897: FILE: util/PanelEmu.c:314: + $ ERROR: spaces required around that '=' (ctx:VxV) #898: FILE: util/PanelEmu.c:315: + returnval=true; ^ ERROR: space required after that ',' (ctx:VxV) #900: FILE: util/PanelEmu.c:317: + printf(PANEL_NAME "connection Failes %d\n",rv); ^ WARNING: architecture specific defines should be avoided #901: FILE: util/PanelEmu.c:318: +#ifdef __MINGW32__ ERROR: space prohibited after that '-' (ctx:WxW) #906: FILE: util/PanelEmu.c:323: + h->socket = - 1; ^ total: 125 errors, 28 warnings, 857 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org
diff --git a/hw/gpio/bcm2835_gpio.c b/hw/gpio/bcm2835_gpio.c index acc2e3cf9e..14bd059861 100644 --- a/hw/gpio/bcm2835_gpio.c +++ b/hw/gpio/bcm2835_gpio.c @@ -19,6 +19,8 @@ #include "hw/sd/sd.h" #include "hw/gpio/bcm2835_gpio.h" + + #define GPFSEL0 0x00 #define GPFSEL1 0x04 #define GPFSEL2 0x08 @@ -53,9 +55,9 @@ static uint32_t gpfsel_get(BCM2835GpioState *s, uint8_t reg) { int i; uint32_t value = 0; - for (i = 0; i < 10; i++) { + for (i = 0; i < 10; i ++) { uint32_t index = 10 * reg + i; - if (index < sizeof(s->fsel)) { + if (index < sizeof (s->fsel)) { value |= (s->fsel[index] & 0x7) << (3 * i); } } @@ -65,9 +67,9 @@ static uint32_t gpfsel_get(BCM2835GpioState *s, uint8_t reg) static void gpfsel_set(BCM2835GpioState *s, uint8_t reg, uint32_t value) { int i; - for (i = 0; i < 10; i++) { + for (i = 0; i < 10; i ++) { uint32_t index = 10 * reg + i; - if (index < sizeof(s->fsel)) { + if (index < sizeof (s->fsel)) { int fsel = (value >> (3 * i)) & 0x7; s->fsel[index] = fsel; } @@ -75,24 +77,24 @@ static void gpfsel_set(BCM2835GpioState *s, uint8_t reg, uint32_t value) /* SD controller selection (48-53) */ if (s->sd_fsel != 0 - && (s->fsel[48] == 0) /* SD_CLK_R */ - && (s->fsel[49] == 0) /* SD_CMD_R */ - && (s->fsel[50] == 0) /* SD_DATA0_R */ - && (s->fsel[51] == 0) /* SD_DATA1_R */ - && (s->fsel[52] == 0) /* SD_DATA2_R */ - && (s->fsel[53] == 0) /* SD_DATA3_R */ - ) { + && (s->fsel[48] == 0) /* SD_CLK_R */ + && (s->fsel[49] == 0) /* SD_CMD_R */ + && (s->fsel[50] == 0) /* SD_DATA0_R */ + && (s->fsel[51] == 0) /* SD_DATA1_R */ + && (s->fsel[52] == 0) /* SD_DATA2_R */ + && (s->fsel[53] == 0) /* SD_DATA3_R */ + ) { /* SDHCI controller selected */ sdbus_reparent_card(s->sdbus_sdhost, s->sdbus_sdhci); s->sd_fsel = 0; } else if (s->sd_fsel != 4 - && (s->fsel[48] == 4) /* SD_CLK_R */ - && (s->fsel[49] == 4) /* SD_CMD_R */ - && (s->fsel[50] == 4) /* SD_DATA0_R */ - && (s->fsel[51] == 4) /* SD_DATA1_R */ - && (s->fsel[52] == 4) /* SD_DATA2_R */ - && (s->fsel[53] == 4) /* SD_DATA3_R */ - ) { + && (s->fsel[48] == 4) /* SD_CLK_R */ + && (s->fsel[49] == 4) /* SD_CMD_R */ + && (s->fsel[50] == 4) /* SD_DATA0_R */ + && (s->fsel[51] == 4) /* SD_DATA1_R */ + && (s->fsel[52] == 4) /* SD_DATA2_R */ + && (s->fsel[53] == 4) /* SD_DATA3_R */ + ) { /* SDHost controller selected */ sdbus_reparent_card(s->sdbus_sdhci, s->sdbus_sdhost); s->sd_fsel = 4; @@ -108,13 +110,13 @@ static int gpfsel_is_out(BCM2835GpioState *s, int index) } static void gpset(BCM2835GpioState *s, - uint32_t val, uint8_t start, uint8_t count, uint32_t *lev) + uint32_t val, uint8_t start, uint8_t count, uint32_t *lev) { - uint32_t changes = val & ~*lev; + uint32_t changes = val & ~ *lev; uint32_t cur = 1; int i; - for (i = 0; i < count; i++) { + for (i = 0; i < count; i ++) { if ((changes & cur) && (gpfsel_is_out(s, start + i))) { qemu_set_irq(s->out[start + i], 1); } @@ -125,132 +127,165 @@ static void gpset(BCM2835GpioState *s, } static void gpclr(BCM2835GpioState *s, - uint32_t val, uint8_t start, uint8_t count, uint32_t *lev) + uint32_t val, uint8_t start, uint8_t count, uint32_t *lev) { uint32_t changes = val & *lev; uint32_t cur = 1; int i; - for (i = 0; i < count; i++) { + for (i = 0; i < count; i ++) { if ((changes & cur) && (gpfsel_is_out(s, start + i))) { qemu_set_irq(s->out[start + i], 0); } cur <<= 1; } - *lev &= ~val; + *lev &= ~ val; } -static uint64_t bcm2835_gpio_read(void *opaque, hwaddr offset, - unsigned size) +static uint64_t bcm2835_gpio_read(void *opaque, hwaddr offset, unsigned size) { - BCM2835GpioState *s = (BCM2835GpioState *)opaque; + BCM2835GpioState *s = (BCM2835GpioState *) opaque; + + uint64_t Data; switch (offset) { - case GPFSEL0: - case GPFSEL1: - case GPFSEL2: - case GPFSEL3: - case GPFSEL4: - case GPFSEL5: - return gpfsel_get(s, offset / 4); - case GPSET0: - case GPSET1: - /* Write Only */ - return 0; - case GPCLR0: - case GPCLR1: - /* Write Only */ - return 0; - case GPLEV0: - return s->lev0; - case GPLEV1: - return s->lev1; - case GPEDS0: - case GPEDS1: - case GPREN0: - case GPREN1: - case GPFEN0: - case GPFEN1: - case GPHEN0: - case GPHEN1: - case GPLEN0: - case GPLEN1: - case GPAREN0: - case GPAREN1: - case GPAFEN0: - case GPAFEN1: - case GPPUD: - case GPPUDCLK0: - case GPPUDCLK1: - /* Not implemented */ - return 0; - default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", - __func__, offset); - break; + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: + return gpfsel_get(s, offset / 4); + case GPSET0: + case GPSET1: + /* Write Only */ + return 0; + case GPCLR0: + case GPCLR1: + /* Write Only */ + return 0; + case GPLEV0: + if (s->panel.socket != - 1) { + if (panel_read(&s->panel, &Data)) { + s->lev0 = (uint32_t) Data; + s->lev1 = (uint32_t) (Data >> 32); + } + } + return s->lev0; + case GPLEV1: + if (s->panel.socket != - 1) { + if (panel_read(&s->panel, &Data)) { + s->lev0 = (uint32_t) Data; + s->lev1 = (uint32_t) (Data >> 32); + } + } + return s->lev1; + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + case GPPUD: + case GPPUDCLK0: + case GPPUDCLK1: + /* Not implemented */ + return 0; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + __func__, offset); + break; } return 0; } static void bcm2835_gpio_write(void *opaque, hwaddr offset, - uint64_t value, unsigned size) + uint64_t value, unsigned size) { - BCM2835GpioState *s = (BCM2835GpioState *)opaque; + BCM2835GpioState *s = (BCM2835GpioState *) opaque; + uint64_t Data; + switch (offset) { - case GPFSEL0: - case GPFSEL1: - case GPFSEL2: - case GPFSEL3: - case GPFSEL4: - case GPFSEL5: - gpfsel_set(s, offset / 4, value); - break; - case GPSET0: - gpset(s, value, 0, 32, &s->lev0); - break; - case GPSET1: - gpset(s, value, 32, 22, &s->lev1); - break; - case GPCLR0: - gpclr(s, value, 0, 32, &s->lev0); - break; - case GPCLR1: - gpclr(s, value, 32, 22, &s->lev1); - break; - case GPLEV0: - case GPLEV1: - /* Read Only */ - break; - case GPEDS0: - case GPEDS1: - case GPREN0: - case GPREN1: - case GPFEN0: - case GPFEN1: - case GPHEN0: - case GPHEN1: - case GPLEN0: - case GPLEN1: - case GPAREN0: - case GPAREN1: - case GPAFEN0: - case GPAFEN1: - case GPPUD: - case GPPUDCLK0: - case GPPUDCLK1: - /* Not implemented */ - break; - default: - goto err_out; + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: + gpfsel_set(s, offset / 4, value); + break; + case GPSET0: + gpset(s, value, 0, 32, &s->lev0); + if (s->panel.socket != - 1) { + Data = value; + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel + } + break; + case GPSET1: + gpset(s, value, 32, 22, &s->lev1); + if (s->panel.socket != - 1) { + Data = value; + Data <<= 32; + senddatatopanel(&s->panel, Data, true); //John Bradley dummy GPIO Panel + } + break; + case GPCLR0: + gpclr(s, value, 0, 32, &s->lev0); + if (s->panel.socket != - 1) { + Data = value; + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel + } + break; + case GPCLR1: + gpclr(s, value, 32, 22, &s->lev1); + if (s->panel.socket != - 1) { + Data = value; + Data <<= 32; + senddatatopanel(&s->panel, Data, false); //John Bradley dummy GPIO Panel + } + break; + case GPLEV0: + case GPLEV1: + /* Read Only */ + break; + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + case GPPUD: + case GPPUDCLK0: + case GPPUDCLK1: + /* Not implemented */ + break; + default: + goto err_out; } return; err_out: qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", - __func__, offset); + __func__, offset); } static void bcm2835_gpio_reset(DeviceState *dev) @@ -258,7 +293,7 @@ static void bcm2835_gpio_reset(DeviceState *dev) BCM2835GpioState *s = BCM2835_GPIO(dev); int i; - for (i = 0; i < 6; i++) { + for (i = 0; i < 6; i ++) { gpfsel_set(s, i, 0); } @@ -272,21 +307,22 @@ static void bcm2835_gpio_reset(DeviceState *dev) } static const MemoryRegionOps bcm2835_gpio_ops = { - .read = bcm2835_gpio_read, - .write = bcm2835_gpio_write, - .endianness = DEVICE_NATIVE_ENDIAN, + .read = bcm2835_gpio_read, + .write = bcm2835_gpio_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static const VMStateDescription vmstate_bcm2835_gpio = { - .name = "bcm2835_gpio", - .version_id = 1, - .minimum_version_id = 1, - .fields = (VMStateField[]) { - VMSTATE_UINT8_ARRAY(fsel, BCM2835GpioState, 54), - VMSTATE_UINT32(lev0, BCM2835GpioState), - VMSTATE_UINT32(lev1, BCM2835GpioState), - VMSTATE_UINT8(sd_fsel, BCM2835GpioState), - VMSTATE_END_OF_LIST() + .name = "bcm2835_gpio", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) + { + VMSTATE_UINT8_ARRAY(fsel, BCM2835GpioState, 54), + VMSTATE_UINT32(lev0, BCM2835GpioState), + VMSTATE_UINT32(lev1, BCM2835GpioState), + VMSTATE_UINT8(sd_fsel, BCM2835GpioState), + VMSTATE_END_OF_LIST() } }; @@ -296,13 +332,23 @@ static void bcm2835_gpio_init(Object *obj) DeviceState *dev = DEVICE(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - qbus_create_inplace(&s->sdbus, sizeof(s->sdbus), + qbus_create_inplace(&s->sdbus, sizeof (s->sdbus), TYPE_SD_BUS, DEVICE(s), "sd-bus"); memory_region_init_io(&s->iomem, obj, - &bcm2835_gpio_ops, s, "bcm2835_gpio", 0x1000); + &bcm2835_gpio_ops, s, "bcm2835_gpio", 0x1000); sysbus_init_mmio(sbd, &s->iomem); qdev_init_gpio_out(dev, s->out, 54); + + /* Get access to the GPIO panel, program will quit on fail */ + if (panel_open(&s->panel)) { + sendpincount(&s->panel, 54); //PI Has 54 Pins + sendenabledmap(&s->panel, 0x003FFFFFFFFFFFFC); //Pins 0 & 1 are I2C so disable + sendinputmap(&s->panel, 0x0000000000000000); //There are no dedicated input pins I know off + sendoutputmap(&s->panel, 0x0000800000000000); //Pin 53 is dedicated output LED + } else { + printf("Couldn't connect to a GPIO panel\n"); //John Bradley dummy GPIO Panel + } } static void bcm2835_gpio_realize(DeviceState *dev, Error **errp) @@ -314,7 +360,7 @@ static void bcm2835_gpio_realize(DeviceState *dev, Error **errp) obj = object_property_get_link(OBJECT(dev), "sdbus-sdhci", &err); if (obj == NULL) { error_setg(errp, "%s: required sdhci link not found: %s", - __func__, error_get_pretty(err)); + __func__, error_get_pretty(err)); return; } s->sdbus_sdhci = SD_BUS(obj); @@ -322,7 +368,7 @@ static void bcm2835_gpio_realize(DeviceState *dev, Error **errp) obj = object_property_get_link(OBJECT(dev), "sdbus-sdhost", &err); if (obj == NULL) { error_setg(errp, "%s: required sdhost link not found: %s", - __func__, error_get_pretty(err)); + __func__, error_get_pretty(err)); return; } s->sdbus_sdhost = SD_BUS(obj); @@ -332,17 +378,17 @@ static void bcm2835_gpio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - dc->vmsd = &vmstate_bcm2835_gpio; - dc->realize = &bcm2835_gpio_realize; - dc->reset = &bcm2835_gpio_reset; + dc->vmsd = & vmstate_bcm2835_gpio; + dc->realize = & bcm2835_gpio_realize; + dc->reset = & bcm2835_gpio_reset; } static const TypeInfo bcm2835_gpio_info = { - .name = TYPE_BCM2835_GPIO, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(BCM2835GpioState), - .instance_init = bcm2835_gpio_init, - .class_init = bcm2835_gpio_class_init, + .name = TYPE_BCM2835_GPIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof (BCM2835GpioState), + .instance_init = bcm2835_gpio_init, + .class_init = bcm2835_gpio_class_init, }; static void bcm2835_gpio_register_types(void) diff --git a/include/hw/gpio/bcm2835_gpio.h b/include/hw/gpio/bcm2835_gpio.h index 9f8e0c720c..73cfda6a6b 100644 --- a/include/hw/gpio/bcm2835_gpio.h +++ b/include/hw/gpio/bcm2835_gpio.h @@ -16,6 +16,8 @@ #include "hw/sd/sd.h" +#include "qemu/PanelEmu.h" + typedef struct BCM2835GpioState { SysBusDevice parent_obj; @@ -30,6 +32,9 @@ typedef struct BCM2835GpioState { uint32_t lev0, lev1; uint8_t sd_fsel; qemu_irq out[54]; + + panel_connection_t panel; + } BCM2835GpioState; #define TYPE_BCM2835_GPIO "bcm2835_gpio" diff --git a/include/qemu/PanelEmu.h b/include/qemu/PanelEmu.h new file mode 100644 index 0000000000..eb9bf053d0 --- /dev/null +++ b/include/qemu/PanelEmu.h @@ -0,0 +1,54 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: PanelEmu.h + * Author: John Bradley + * + * Created on 22 April 2017, 22:26 + */ + +#ifndef PANELEMU_H +#define PANELEMU_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#define DRIVER_NAME "RDC-GPIO: " +#define PANEL_NAME "GPIO panel: " + + +#define DEFAULT_PORT 0xb1ff //45567 + +#define PANEL_PINS 54 + + typedef struct panel_connection { + int socket; /* socket we'll connect to the panel with */ + fd_set fds; /* list of descriptors (only the above socket */ + char last[PANEL_PINS / 8]; /* we don't want to send updates to the panel + unless something changed */ + int ProtocolInUse; //What version of the protocol are we using. + } panel_connection_t; + + bool panel_open(panel_connection_t* h); + + bool panel_read(panel_connection_t* h, uint64_t *pinS); + void senddatatopanel(panel_connection_t* h, uint64_t pinS, bool Value); + void panel_send_read_command(panel_connection_t* h); + void sendpincount(panel_connection_t* h, int Num); + void sendenabledmap(panel_connection_t* h, uint64_t pins); + void sendinputmap(panel_connection_t* h, uint64_t pins); + void sendoutputmap(panel_connection_t* h, uint64_t pins); + + +#ifdef __cplusplus +} +#endif + +#endif /* PANELEMU_H */ + diff --git a/util/Makefile.objs b/util/Makefile.objs index c6205ebf86..8316ed79ba 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -43,3 +43,4 @@ util-obj-y += qdist.o util-obj-y += qht.o util-obj-y += range.o util-obj-y += systemd.o +util-obj-y += PanelEmu.o \ No newline at end of file diff --git a/util/PanelEmu.c b/util/PanelEmu.c new file mode 100644 index 0000000000..d428dd7b53 --- /dev/null +++ b/util/PanelEmu.c @@ -0,0 +1,329 @@ +/* + * Emulation for Rasp PI GPIO via Server connected to via Socket + * + */ +#include "qemu/osdep.h" + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <errno.h> +#include <string.h> +#include <sys/types.h> +#ifdef __MINGW32__ +#include <winsock2.h> +#else +#include <sys/socket.h> +#include <arpa/inet.h> +#include <netinet/in.h> +#endif + + +#include "qemu/PanelEmu.h" + +typedef enum +{ + PROTOCOLDESCFROMQEMU = 0, + PROTOCOLDESCFROMPANEL = 1, + PINSTOPANEL = 2, + READREQ = 3, + PINCOUNT = 4, + ENABLEMAP = 5, + INPUTMAP = 6, + OUTPUTMAP = 7, + PINSTOQEMU = 8 +} PacketType; + +#define MINPROTOCOL 0 +#define MAXPROTOCOL 0 + +#define MAXPACKET 255 + +#define PACKETLEN 0 //Includes Packet Length +#define PACKETTYPE 1 + +typedef struct +{ + unsigned short int Data[MAXPACKET]; +} CommandPacket; + +static void panel_command(panel_connection_t *h, CommandPacket *Pkt); + +static void panel_send_protocol_command(panel_connection_t* h) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = 8; + Pkt.Data[PACKETTYPE] = PROTOCOLDESCFROMQEMU; + Pkt.Data[2] = MINPROTOCOL; + Pkt.Data[3] = MAXPROTOCOL; + + panel_command(h, &Pkt); +} + +void panel_send_read_command(panel_connection_t* h) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = 4; + Pkt.Data[PACKETTYPE] = READREQ; + + panel_command(h, &Pkt); +} + +/* Set a pin to a specified value */ +void senddatatopanel(panel_connection_t* h, uint64_t pin, bool val) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[6 + 1]-(char *) &Pkt.Data[0]; + Pkt.Data[PACKETTYPE] = PINSTOPANEL; + Pkt.Data[2] = (unsigned short int) (pin & 0xFFFF); + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); + Pkt.Data[4] = (unsigned short int) (pin >> 32 & 0xFFFF); + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); + Pkt.Data[6] = val; + + panel_command(h, &Pkt); +} + +void sendpincount(panel_connection_t* h, int val) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[2 + 1]-(char *) &Pkt.Data[0]; + Pkt.Data[PACKETTYPE] = PINCOUNT; + Pkt.Data[2] = val; + + panel_command(h, &Pkt); +} + +void sendenabledmap(panel_connection_t* h, uint64_t pin) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; + Pkt.Data[PACKETTYPE] = ENABLEMAP; + Pkt.Data[2] = (unsigned short int) (pin & 0xFFFF); + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); + Pkt.Data[4] = (unsigned short int) (pin >> 32 & 0xFFFF); + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); + + panel_command(h, &Pkt); +} + +void sendinputmap(panel_connection_t* h, uint64_t pin) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; + Pkt.Data[PACKETTYPE] = INPUTMAP; + Pkt.Data[2] = (unsigned short int) (pin & 0xFFFF); + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); + Pkt.Data[4] = (unsigned short int) (pin >> 32 & 0xFFFF); + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); + + panel_command(h, &Pkt); +} + +void sendoutputmap(panel_connection_t* h, uint64_t pin) +{ + CommandPacket Pkt; + + Pkt.Data[PACKETLEN] = (char *) &Pkt.Data[5 + 1]-(char *) &Pkt.Data[0]; + Pkt.Data[PACKETTYPE] = OUTPUTMAP; + Pkt.Data[2] = (unsigned short int) (pin & 0xFFFF); + Pkt.Data[3] = (unsigned short int) ((pin >> 16)&0xFFFF); + Pkt.Data[4] = (unsigned short int) (pin >> 32 & 0xFFFF); + Pkt.Data[5] = (unsigned short int) ((pin >> 48)&0xFFFF); + + panel_command(h, &Pkt); +} + +static void panel_command(panel_connection_t *h, CommandPacket *Pkt) +{ + if (send(h->socket, (char *) Pkt, Pkt->Data[PACKETLEN], 0) == - 1) { + perror(PANEL_NAME "send"); +#ifdef __MINGW32__ + closesocket(h->socket); +#else + close(h->socket); +#endif + h->socket = - 1; /* act like we never connected */ + } +} + +/* Wait for values to be read back from panel */ +bool panel_read(panel_connection_t* h, uint64_t* Data) +{ + fd_set rfds, efds; + int LengthInBuffer; + int select_res = 0; + + CommandPacket *PktPtr = (CommandPacket *) malloc(sizeof (CommandPacket)); + CommandPacket *Pkt; + bool NoError = true; + bool NewData = false; + bool NoData = false; + struct timeval timeout; + + int ReadStart = 0; + + timeout.tv_sec = 0; + timeout.tv_usec = 0; + + if (h->socket != - 1) { + rfds = h->fds; + efds = h->fds; + +// printf(PANEL_NAME "panel_read\n"); + + Pkt = PktPtr; + while (NoError&&! NoData) { + select_res = select(h->socket + 1, &rfds, NULL, &efds, &timeout); + if (select_res > 0) { + if (FD_ISSET(h->socket, &rfds)) { + /* receive more data */ + if ((LengthInBuffer = recv(h->socket, (char *) &Pkt[ReadStart], sizeof (*Pkt) - ReadStart, 0)) > 0) { + LengthInBuffer += ReadStart; + for (int i = 0; LengthInBuffer > 0; i ++) { + if (LengthInBuffer >= Pkt->Data[i + PACKETLEN]) { + switch (Pkt->Data[i + PACKETTYPE]) + { + case PINSTOQEMU: + *Data = (uint64_t) Pkt->Data[i + 2]; + *Data |= ((uint64_t) Pkt->Data[i + 3]) << 16; + *Data |= ((uint64_t) Pkt->Data[i + 4]) << 32; + *Data |= ((uint64_t) Pkt->Data[i + 5]) << 48; + + NewData = true; + break; + + case PROTOCOLDESCFROMPANEL: + h->ProtocolInUse = (int) Pkt->Data[i + 2]; + if(h->ProtocolInUse!=-1) + { + printf(PANEL_NAME "Protocol %d in used\n",h->ProtocolInUse); + } + else + { + printf(PANEL_NAME "No Common Protocol\n"); + } + break; + + default: + printf(PANEL_NAME "Invalid data received\n"); + break; + } + LengthInBuffer -= Pkt->Data[PACKETLEN]; + i += Pkt->Data[PACKETLEN]; // Pkt=(CommandPacket *)&(Pkt->Data[Pkt->Data[PACKETLEN]]); + } else { + ReadStart = LengthInBuffer; + for (int j = 0; j < LengthInBuffer; j ++) { + Pkt->Data[j] = Pkt->Data[i + j]; + } + printf(PANEL_NAME "Partial Packet Read"); + } + } + } else { + if (LengthInBuffer < 0) { + if (errno != EINTR) { + printf(PANEL_NAME "recv"); + NoError = FALSE; + } + } else { + printf(PANEL_NAME "closed connection\n"); + NoError = FALSE; + } + } + } + } else if (select_res == 0) { + NoData = true; + } else if (errno != EINTR) { +#ifdef __MINGW32__ + closesocket(h->socket); +#else + close(h->socket); +#endif + h->socket = - 1; /* act like we never connected */ + perror(PANEL_NAME "select error"); + NoError = FALSE; + } + } + } + + free(PktPtr); + + return NewData; +} + +bool panel_open(panel_connection_t* h) +{ + int rv; +#ifdef __MINGW32__ + struct sockaddr_in remote; +#else + struct sockaddr_in remote; +#endif + + bool returnval = false; + +#ifdef __MINGW32__ + printf("__MINGW32__\n"); +#else + printf("NOT __MINGW32__\n"); +#endif + + h->socket=-1; + h->ProtocolInUse=-1; + +#ifdef __MINGW32__ + WSADATA wsadata; + if (WSAStartup(MAKEWORD(1, 1), &wsadata) == SOCKET_ERROR) { + printf("Error creating socket.\n"); + } + else +#endif + { + if ((h->socket = socket(AF_INET, SOCK_STREAM, 0)) != - 1) { +#ifdef __MINGW32__ + memset((char *)&remote, 0, sizeof(remote)); + remote.sin_family = AF_INET; + remote.sin_port = htons(DEFAULT_PORT); + remote.sin_addr.s_addr = inet_addr("127.0.0.1"); +#else + bzero((char *)&remote, sizeof(remote)); + remote.sin_family = AF_INET; + remote.sin_port = htons(DEFAULT_PORT); + remote.sin_addr.s_addr = inet_addr("127.0.0.1"); +#endif + if ((rv=connect(h->socket, (struct sockaddr *) &remote, sizeof (remote))) != - 1) { +#ifdef __MINGW32__ + char value = 1; + setsockopt(h->socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof ( value)); + +#endif + FD_ZERO(&h->fds); + + /* Set our connected socket */ + FD_SET(h->socket, &h->fds); + + printf(PANEL_NAME "Connected OK %d\n",rv); + + panel_send_protocol_command(h); + + returnval=true; + } else { + printf(PANEL_NAME "connection Failes %d\n",rv); +#ifdef __MINGW32__ + closesocket(h->socket); +#else + close(h->socket); +#endif + h->socket = - 1; + } + } + } + return returnval; +} +