Coder Social home page Coder Social logo

dbus-egg's People

Contributors

bunny351 avatar cmb avatar dieggsy avatar ec1oud avatar mario-goulart avatar sjamaan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dieggsy cmb

dbus-egg's Issues

Support additional dbus types, dict and variant

Currently the dbus egg documentation claims it supports the int32, double, boolean, array and string dbus types. I would like to try and implement the org.freedesktop.DBus.Properties interface, but those require the dict and variant types.

Consider a get-property function?

I found it rather annoying to need two different contexts for getting properties and calling methods, and found that dbus properties are something common enough to perhaps warrant their own generalized scheme function that could work on any context, provided it has a org.freedesktop.DBus.Properties interface.

I've been using something like this, for example:

(use (prefix dbus dbus:))

(define (get-property context prop)
  (let* ((prop (->string prop))
         (bus (vector-ref context 1))
         (service (vector-ref context 2))
         (path (vector-ref context 3))
         (old-interface (vector-ref context 4))
         (context
          (dbus:make-context
           bus: bus
           service: service
           path: path
           interface: 'org.freedesktop.DBus.Properties))
         (raw
          (handle-exceptions err #f
            (dbus:call context "Get" (symbol->string old-interface) prop))))
    (and raw (car raw))))

I guess the handle-exceptions bit is sorta iffy, wondering if you think it's worth including something like this and regardless how it could be improved.

Signal an error when an unknown method is called

Currently this project just seems to drop the signal when a request for an unknown method appears, which makes clients wait for a reply that never comes and time out. Other dbus services seem to raise an error instead, letting the clients move on to whatever comes next.

For example, an invocation using dbus-send with mowedline and another service:

drd% time dbus-send --print-reply --session --dest=net.retroj.mowedline /net/retroj/mowedline net.retroj.mowedline.updatee string:foo string:bar 
Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
dbus-send --print-reply --session --dest=net.retroj.mowedline   string:foo   0.00s user 0.00s system 0% cpu 25.028 total



drd% time dbus-send --print-reply --session --dest=org.PulseAudio1 /org org.freedesktop.DBus.Introspectable.Introspectt 
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Introspectt" with signature "" on interface "org.freedesktop.DBus.Introspectable" doesn't exist

dbus-send --print-reply --session --dest=org.PulseAudio1 /org   0.00s user 0.00s system 0% cpu 0.003 total

Note the total time on both invocations.

Can't call methods that require UInt64 arguments

Trying to call a method requiring a UInt64 argument is causing me some trouble. When I try to pass along an argument I got from a signal which is supposed to be UInt64 I get the error:

Type of message, '(d)', does not match expected type '(t)'

When I try it using a normal integer value, I get basically the same error, except I get a different type description:

Type of message, '(i)', does not match expected type '(t)'

The type descriptor (d) means double, (t) means uint64 and (i) means int32. According to the documentation there is no conversion from any type to UInt64, and it converts anything too big to be an Int32 to a Double.

arguments to dbus_connection_send_with_reply_and_block() were incorrect

An error was introduced in 7d8842f "gc finalization: define-foreign-type for DBusMessage sets finalizer in retconvert lambda"

$ mowedline-client update title helo
process 3569: arguments to dbus_connection_send_with_reply_and_block() were incorrect, assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in file ../../../dbus/dbus-connection.c line 3546.
This is normally a bug in some application using the D-Bus library.
*** Error in `mowedline-client': munmap_chunk(): invalid pointer: 0x00007ffd30e62bd0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7f1310378bcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76fa6)[0x7f131037efa6]
/lib/x86_64-linux-gnu/libdbus-1.so.3(dbus_error_free+0x28)[0x7f130fea5e78]
/usr/local/lib/chicken/8/dbus.so(+0x1cfe9)[0x7f13100f9fe9]
/usr/local/lib/libchicken.so.8(+0xace9f)[0x7f1310c5ae9f]
/usr/local/lib/libchicken.so.8(C_allocate_vector+0x0)[0x7f1310e501e3]
/usr/local/lib/libchicken.so.8(+0x2a234f)[0x7f1310e5034f]
/usr/local/lib/libchicken.so.8(+0xa56ae)[0x7f1310c536ae]
/usr/local/lib/libchicken.so.8(+0xad9fe)[0x7f1310c5b9fe]
/usr/local/lib/chicken/8/dbus.so(+0x1e18f)[0x7f13100fb18f]
/usr/local/lib/libchicken.so.8(+0xace9f)[0x7f1310c5ae9f]
/usr/local/lib/libchicken.so.8(C_allocate_vector+0x0)[0x7f1310e501e3]
/usr/local/lib/libchicken.so.8(+0x2a234f)[0x7f1310e5034f]
/usr/local/lib/libchicken.so.8(+0xa56ae)[0x7f1310c536ae]
/usr/local/lib/libchicken.so.8(+0xad9fe)[0x7f1310c5b9fe]
/usr/local/lib/chicken/8/dbus.so(+0x1ec0d)[0x7f13100fbc0d]
/usr/local/lib/libchicken.so.8(C_do_unregister_finalizer+0x0)[0x7f1310e555c8]
/usr/local/lib/libchicken.so.8(+0xd70bf)[0x7f1310c850bf]
/usr/local/lib/chicken/8/dbus.so(+0xd1fc)[0x7f13100ea1fc]
/usr/local/lib/chicken/8/dbus.so(+0x15477)[0x7f13100f2477]
/usr/local/lib/chicken/8/dbus.so(+0x882f)[0x7f13100e582f]
/usr/local/lib/chicken/8/dbus.so(+0x15604)[0x7f13100f2604]
/usr/local/lib/chicken/8/dbus.so(+0x1cf17)[0x7f13100f9f17]
/usr/local/lib/chicken/8/dbus.so(+0x1f74e)[0x7f13100fc74e]
/usr/local/lib/chicken/8/dbus.so(+0x1f917)[0x7f13100fc917]
/usr/local/lib/chicken/8/dbus.so(+0x1ddbd)[0x7f13100fadbd]
/usr/local/lib/libchicken.so.8(+0xadab4)[0x7f1310c5bab4]
/usr/local/lib/libchicken.so.8(C_allocate_vector+0x0)[0x7f1310e501e3]
/usr/local/lib/libchicken.so.8(+0x2a234f)[0x7f1310e5034f]
/usr/local/lib/libchicken.so.8(+0xa56ae)[0x7f1310c536ae]
/usr/local/lib/libchicken.so.8(+0xa2ef2)[0x7f1310c50ef2]
/usr/local/lib/chicken/8/dbus.so(+0x1d2c1)[0x7f13100fa2c1]
/usr/local/lib/chicken/8/dbus.so(+0x1d52d)[0x7f13100fa52d]
/usr/local/lib/chicken/8/dbus.so(+0x1ef42)[0x7f13100fbf42]
/usr/local/lib/chicken/8/dbus.so(+0x1f668)[0x7f13100fc668]
/usr/local/lib/chicken/8/dbus.so(+0x1f736)[0x7f13100fc736]
/usr/local/lib/chicken/8/dbus.so(+0x1f917)[0x7f13100fc917]
/usr/local/lib/chicken/8/dbus.so(+0x1ddbd)[0x7f13100fadbd]
/usr/local/lib/libchicken.so.8(+0xadab4)[0x7f1310c5bab4]
/usr/local/lib/libchicken.so.8(C_allocate_vector+0x0)[0x7f1310e501e3]
/usr/local/lib/libchicken.so.8(+0x2a234f)[0x7f1310e5034f]
/usr/local/lib/libchicken.so.8(+0xa56ae)[0x7f1310c536ae]
/usr/local/lib/libchicken.so.8(+0xa2ef2)[0x7f1310c50ef2]
/usr/local/lib/chicken/8/dbus.so(+0x1d2c1)[0x7f13100fa2c1]
/usr/local/lib/chicken/8/dbus.so(+0x1d52d)[0x7f13100fa52d]
/usr/local/lib/chicken/8/dbus.so(+0x1ef42)[0x7f13100fbf42]
/usr/local/lib/chicken/8/dbus.so(+0x1f668)[0x7f13100fc668]
/usr/local/lib/chicken/8/dbus.so(+0x1f736)[0x7f13100fc736]
/usr/local/lib/chicken/8/dbus.so(+0x1f890)[0x7f13100fc890]
/usr/local/lib/chicken/8/dbus.so(+0xeccf)[0x7f13100ebccf]
/usr/local/lib/chicken/8/dbus.so(+0xc4fc)[0x7f13100e94fc]
/usr/local/lib/chicken/8/dbus.so(+0x1e051)[0x7f13100fb051]
/usr/local/lib/chicken/8/dbus.so(+0x882f)[0x7f13100e582f]
/usr/local/lib/chicken/8/dbus.so(+0x13fdf)[0x7f13100f0fdf]
/usr/local/lib/chicken/8/dbus.so(+0x14249)[0x7f13100f1249]
/usr/local/lib/chicken/8/dbus.so(+0x14c3a)[0x7f13100f1c3a]
/usr/local/lib/chicken/8/dbus.so(+0x1e773)[0x7f13100fb773]
/usr/local/lib/chicken/8/dbus.so(+0x882f)[0x7f13100e582f]
/usr/local/lib/chicken/8/dbus.so(+0xa3a2)[0x7f13100e73a2]
/usr/local/lib/chicken/8/dbus.so(+0xa618)[0x7f13100e7618]
/usr/local/lib/libchicken.so.8(C_do_unregister_finalizer+0x0)[0x7f1310e555c8]
/usr/local/lib/libchicken.so.8(+0xd70bf)[0x7f1310c850bf]
/usr/local/lib/chicken/8/dbus.so(+0xd1fc)[0x7f13100ea1fc]
======= Memory map: ========
00400000-00407000 r-xp 00000000 08:01 40765969                           /usr/local/bin/mowedline-client
00606000-00607000 r--p 00006000 08:01 40765969                           /usr/local/bin/mowedline-client
00607000-00608000 rw-p 00007000 08:01 40765969                           /usr/local/bin/mowedline-client
00661000-006a3000 rw-p 00000000 00:00 0                                  [heap]
7f130e7ff000-7f130e815000 r-xp 00000000 08:01 19922965                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f130e815000-7f130ea14000 ---p 00016000 08:01 19922965                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f130ea14000-7f130ea15000 r--p 00015000 08:01 19922965                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f130ea15000-7f130ea16000 rw-p 00016000 08:01 19922965                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f130ea16000-7f130ea26000 r-xp 00000000 08:01 42207347                   /usr/local/lib/chicken/8/imperative-command-line-a.so
7f130ea26000-7f130ec25000 ---p 00010000 08:01 42207347                   /usr/local/lib/chicken/8/imperative-command-line-a.so
7f130ec25000-7f130ec26000 r--p 0000f000 08:01 42207347                   /usr/local/lib/chicken/8/imperative-command-line-a.so
7f130ec26000-7f130ec27000 rw-p 00010000 08:01 42207347                   /usr/local/lib/chicken/8/imperative-command-line-a.so
7f130ec27000-7f130ec81000 r-xp 00000000 08:01 42207590                   /usr/local/lib/chicken/8/fmt.so
7f130ec81000-7f130ee80000 ---p 0005a000 08:01 42207590                   /usr/local/lib/chicken/8/fmt.so
7f130ee80000-7f130ee85000 rw-p 00059000 08:01 42207590                   /usr/local/lib/chicken/8/fmt.so
7f130ee85000-7f130ee86000 rw-p 00000000 00:00 0
7f130ee86000-7f130ee98000 r-xp 00000000 08:01 19922972                   /lib/x86_64-linux-gnu/libgpg-error.so.0.19.1
7f130ee98000-7f130f098000 ---p 00012000 08:01 19922972                   /lib/x86_64-linux-gnu/libgpg-error.so.0.19.1
7f130f098000-7f130f099000 r--p 00012000 08:01 19922972                   /lib/x86_64-linux-gnu/libgpg-error.so.0.19.1
7f130f099000-7f130f09a000 rw-p 00013000 08:01 19922972                   /lib/x86_64-linux-gnu/libgpg-error.so.0.19.1
7f130f09a000-7f130f10c000 r-xp 00000000 08:01 19923426                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f130f10c000-7f130f30b000 ---p 00072000 08:01 19923426                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f130f30b000-7f130f30c000 r--p 00071000 08:01 19923426                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f130f30c000-7f130f30d000 rw-p 00072000 08:01 19923426                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f130f30d000-7f130f414000 r-xp 00000000 08:01 19923374                   /lib/x86_64-linux-gnu/libgcrypt.so.20.1.3
7f130f414000-7f130f613000 ---p 00107000 08:01 19923374                   /lib/x86_64-linux-gnu/libgcrypt.so.20.1.3
7f130f613000-7f130f615000 r--p 00106000 08:01 19923374                   /lib/x86_64-linux-gnu/libgcrypt.so.20.1.3
7f130f615000-7f130f61c000 rw-p 00108000 08:01 19923374                   /lib/x86_64-linux-gnu/libgcrypt.so.20.1.3
7f130f61c000-7f130f641000 r-xp 00000000 08:01 19923029                   /lib/x86_64-linux-gnu/liblzma.so.5.2.2
7f130f641000-7f130f840000 ---p 00025000 08:01 19923029                   /lib/x86_64-linux-gnu/liblzma.so.5.2.2
7f130f840000-7f130f841000 r--p 00024000 08:01 19923029                   /lib/x86_64-linux-gnu/liblzma.so.5.2.2
7f130f841000-7f130f842000 rw-p 00025000 08:01 19923029                   /lib/x86_64-linux-gnu/liblzma.so.5.2.2
7f130f842000-7f130f849000 r-xp 00000000 08:01 19925922                   /lib/x86_64-linux-gnu/librt-2.24.so
7f130f849000-7f130fa48000 ---p 00007000 08:01 19925922                   /lib/x86_64-linux-gnu/librt-2.24.so
7f130fa48000-7f130fa49000 r--p 00006000 08:01 19925922                   /lib/x86_64-linux-gnu/librt-2.24.so
7f130fa49000-7f130fa4a000 rw-p 00007000 08:01 19925922                   /lib/x86_64-linux-gnu/librt-2.24.so
7f130fa4a000-7f130fa6e000 r-xp 00000000 08:01 19923156                   /lib/x86_64-linux-gnu/libselinux.so.1
7f130fa6e000-7f130fc6d000 ---p 00024000 08:01 19923156                   /lib/x86_64-linux-gnu/libselinux.so.1
7f130fc6d000-7f130fc6e000 r--p 00023000 08:01 19923156                   /lib/x86_64-linux-gnu/libselinux.so.1
7f130fc6e000-7f130fc6f000 rw-p 00024000 08:01 19923156                   /lib/x86_64-linux-gnu/libselinux.so.1
7f130fc6f000-7f130fc71000 rw-p 00000000 00:00 0
7f130fc71000-7f130fc89000 r-xp 00000000 08:01 19924281                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f130fc89000-7f130fe88000 ---p 00018000 08:01 19924281                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f130fe88000-7f130fe89000 r--p 00017000 08:01 19924281                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f130fe89000-7f130fe8a000 rw-p 00018000 08:01 19924281                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f130fe8a000-7f130fe8e000 rw-p 00000000 00:00 0
7f130fe8e000-7f130fedb000 r-xp 00000000 08:01 19923470                   /lib/x86_64-linux-gnu/libdbus-1.so.3.14.8
7f130fedb000-7f13100da000 ---p 0004d000 08:01 19923470                   /lib/x86_64-linux-gnu/libdbus-1.so.3.14.8
7f13100da000-7f13100dc000 r--p 0004c000 08:01 19923470                   /lib/x86_64-linux-gnu/libdbus-1.so.3.14.8
7f13100dc000-7f13100dd000 rw-p 0004e000 08:01 19923470                   /lib/x86_64-linux-gnu/libdbus-1.so.3.14.8
7f13100dd000-7f1310105000 r-xp 00000000 08:01 42206081                   /usr/local/lib/chicken/8/dbus.so
7f1310105000-7f1310304000 ---p 00028000 08:01 42206081                   /usr/local/lib/chicken/8/dbus.so
7f1310304000-7f1310305000 r--p 00027000 08:01 42206081                   /usr/local/lib/chicken/8/dbus.so
7f1310305000-7f1310308000 rw-p 00028000 08:01 42206081                   /usr/local/lib/chicken/8/dbus.so
7f1310308000-7f131049d000 r-xp 00000000 08:01 19924235                   /lib/x86_64-linux-gnu/libc-2.24.so
7f131049d000-7f131069c000 ---p 00195000 08:01 19924235                   /lib/x86_64-linux-gnu/libc-2.24.so
7f131069c000-7f13106a0000 r--p 00194000 08:01 19924235                   /lib/x86_64-linux-gnu/libc-2.24.so
7f13106a0000-7f13106a2000 rw-p 00198000 08:01 19924235                   /lib/x86_64-linux-gnu/libc-2.24.so
7f13106a2000-7f13106a6000 rw-p 00000000 00:00 0
7f13106a6000-7f13106a8000 r-xp 00000000 08:01 19924243                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f13106a8000-7f13108a8000 ---p 00002000 08:01 19924243                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f13108a8000-7f13108a9000 r--p 00002000 08:01 19924243                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f13108a9000-7f13108aa000 rw-p 00003000 08:01 19924243                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f13108aa000-7f13109ad000 r-xp 00000000 08:01 19924246                   /lib/x86_64-linux-gnu/libm-2.24.so
7f13109ad000-7f1310bac000 ---p 00103000 08:01 19924246                   /lib/x86_64-linux-gnu/libm-2.24.so
7f1310bac000-7f1310bad000 r--p 00102000 08:01 19924246                   /lib/x86_64-linux-gnu/libm-2.24.so
7f1310bad000-7f1310bae000 rw-p 00103000 08:01 19924246                   /lib/x86_64-linux-gnu/libm-2.24.so
7f1310bae000-7f1310f15000 r-xp 00000000 08:01 40763448                   /usr/local/lib/libchicken.so.8
7f1310f15000-7f1311114000 ---p 00367000 08:01 40763448                   /usr/local/lib/libchicken.so.8
7f1311114000-7f1311162000 rw-p 00366000 08:01 40763448                   /usr/local/lib/libchicken.so.8
7f1311162000-7f131116f000 rw-p 00000000 00:00 0
7f131116f000-7f1311192000 r-xp 00000000 08:01 19923018                   /lib/x86_64-linux-gnu/ld-2.24.so
7f13111e1000-7f1311264000 r-xp 00000000 08:01 19923132                   /lib/x86_64-linux-gnu/libsystemd.so.0.16.0
7f1311264000-7f1311265000 ---p 00083000 08:01 19923132                   /lib/x86_64-linux-gnu/libsystemd.so.0.16.0
7f1311265000-7f1311268000 r--p 00083000 08:01 19923132                   /lib/x86_64-linux-gnu/libsystemd.so.0.16.0
7f1311268000-7f1311269000 rw-p 00086000 08:01 19923132                   /lib/x86_64-linux-gnu/libsystemd.so.0.16.0
7f1311269000-7f131136e000 rw-p 00000000 00:00 0
7f131138d000-7f1311391000 rw-p 00000000 00:00 0
7f1311391000-7f1311392000 r--p 00022000 08:01 19923018                   /lib/x86_64-linux-gnu/ld-2.24.so
7f1311392000-7f1311393000 rw-p 00023000 08:01 19923018                   /lib/x86_64-linux-gnu/ld-2.24.so
7f1311393000-7f1311394000 rw-p 00000000 00:00 0
7ffd30d7b000-7ffd30e7d000 rw-p 00000000 00:00 0                          [stack]
7ffd30f4f000-7ffd30f51000 r--p 00000000 00:00 0                          [vvar]
7ffd30f51000-7ffd30f53000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Auto-unbox parameter defaults

Is there any benefit to the auto-unbox parameters being #f? In general I'd think it's more useful/intuitive to have these types unboxed by default, and let people who know a little more and want to deal with the new types turn the unboxing off.

compiler warning in `dbus2#make-vtable'

Warning: in toplevel procedure `dbus2#make-vtable':
  (dbus2.scm:842) in procedure call to `dbus2#vtable-message_function-set!', expected argument #2 of type `(or boolean pointer locative)' but was given an argument of type `(procedure fn (* * *) fixnum)'

method to handle all incoming messages

Dbus-egg provides two ways to handle dbus messages - its internal polling thread and poll-for-message. Both of these methods involve calling thread-sleep! between handling each individual dbus message. This makes programs that use the egg susceptible to lagging when a flood of messages comes in, because a minimum amount of time is set for handling each message.

This could be mitigated if we processed all waiting messages between calls to thread-sleep!. We can check whether messages are waiting with dbus_connection_get_dispatch_status().

We have two cases to deal with - the internal loop and poll-for-message.

  • internal loop: handling all waiting messages should probably be the default behavior of the internal loop.
  • poll-for-message: we could either add a keyword argument to this method that would say to handle all waiting messages, or we could create a new method, poll-for-messages that would do that.

Further discussion: issue #5, retroj/mowedline#22

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.