monome / libmonome Goto Github PK
View Code? Open in Web Editor NEWmakes writing applications for Monomes easy.
License: ISC License
makes writing applications for Monomes easy.
License: ISC License
Currently wscript
always calls ldconfig
after building. See
Line 237 in 3be6a37
Gentoo uses a sandbox that doesn't allow writing to the root filesystem when building package. Since ldconfig
tries to write to /etc/ld.so.cache
this causes a sandbox violation and building/installing the package fails.
I wanted to discuss how to address this.
I don't know why the ldconfig
option was added (there's no mention of the reason in the commit), but normally the package manager does these kinds of things. If it's not necessary maybe it can be removed?
If it is for some reason then it could become an option? Or it could become and option to disable it.
What would be the preferred way to address this?
That makes me a sad panda
I can't get the waf script to build it, even though I have liblo installed.
Can't troubleshoot as the whole waf thing is entirely opaque to me.
Hi, I have been trying to build libmonome with the following liblo:
In no way waf will find it. I printed "conf.env.LIBDIR" and it's actually pointing to the right place, /usr/local/lib. adding -vvv to configure doesn't really make a difference because it doesn't show the error code of clang. what could it be? I am on Mavericks.. cheers
write a sysfs-based implementation of the device metadata code
README
should include build instructions. Those of us unfamiliar with waf don't really have a starting point, and the Documentation Page just jumps right into the C API.
waf
looked executable, so I ran it:
libmonome $ ./waf
The project was not configured: run "waf configure" first!
Ok...
libmonome $ ./waf configure
Setting top to : /Users/rknLA/Sandbox/libmonome
Setting out to : /Users/rknLA/Sandbox/libmonome/build
Checking for 'gcc' (c compiler) : /usr/bin/gcc
Checking for endianness : little
Checking for working poll() : no (will use select())
Checking for library dl : yes
Checking for liblo : yes
'configure' finished successfully (0.590s)
All appears fine. liblo
appears to be installed.
But nope: ../src/proto/osc.c:21:19: error: lo/lo.h: No such file or directory
Not sure where to dig next.
Update: just found a forum thread
iMac-TMP:~ joe$ curl -I http://illest.net/libmonome/ -v --connect-timeout 20
* Trying 149.210.139.23...
* Connection timed out after 20010 milliseconds
* Closing connection 0
curl: (28) Connection timed out after 20010 milliseconds
iMac-TMP:~ joe$
Here's a little program. All it does is print the event data received by calling monome_event_next
when poll
says that there's data to read.
#include "monome.h"
#include <poll.h>
#include <stdio.h>
int main() {
// to actually use this on your machine, you'd have to change the path to match your grid.
monome_t *m = monome_open("/dev/tty.usbmodemm44642411");
int fd = monome_get_fd(m);
monome_event_t e;
e.monome = m;
do {
struct pollfd fds;
fds.fd = fd;
fds.events = POLLIN;
fds.revents = 0;
if (poll(&fds, 1, 1) < 0) {
fprintf(stderr, "libmonome: error in poll()");
break;
}
if (monome_event_next(m, &e) < 1)
continue;
switch (e.event_type) {
case MONOME_BUTTON_DOWN:
fprintf(stderr, "%d, %d, %d\n", e.grid.x, e.grid.y, 1);
break;
case MONOME_BUTTON_UP:
fprintf(stderr, "%d, %d, %d\n", e.grid.x, e.grid.y, 0);
break;
default: break;
}
} while (1);
monome_close(m);
return 0;
}
What's bizarre is that if I mash the keys on my 128 grid, I can get values in the 30s for x
and/or y
. Repeatedly pressing a key also sometimes results in two presses in a row or two releases in a row, rather than them being properly interleaved.
I'd love to be better able to use monome_event_next
to avoid this behavior! I tried reproducing it in Max (presumably with serialosc
) and was unable to... but it's not clear to me what's different there.
currently the autodetection branch doesn't even compile on darwin. as the metadata is already present in the tty filename, this should be trivial to do.
When building without udev I get the following error
../src/platform/linux_sysfs.c: In function ‘monome_platform_get_dev_serial’:
../src/platform/linux_sysfs.c:71:2: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&buf, FTDI_PATH "/*/%s", path);
^
../src/platform/linux_sysfs.c: At top level:
cc1: error: unrecognized command line option ‘-Wno-initializer-overrides’ [-Werror]
cc1: all warnings being treated as errors
currently, there is only a facility for buffering one incoming /press message...in the case of an asynchronous application in which monome_next_event() is called rarely, there is an overwhelming chance that events will be missed.
propose implementing a basic ringbuffer.
I'm trying to use the Python bindings. Latest version w/waf build on OS X 10.7, Python 2.7.1
>>> from monome import Monome
>>> m = Monome("osc.udp://127.0.0.1:9000/monome", "8000")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "monome.pyx", line 260, in monome.Monome.__init__ (monome.c:2342)
self.devpath = (monome_get_devpath(self.monome)).decode()
TypeError: Expected str, got unicode
liblo error: lo_send, lo_message_add, or lo_message_add_varargs called with mismatching types and data at
../src/server.c:104, exiting.
The following lines in wscript
:
conf.env.append_unique("CFLAGS", ["-mmacosx-version-min=10.5"])
conf.env.append_unique("LINKFLAGS", ["-mmacosx-version-min=10.5"])
lead to build failure with Xcode 10 on macOS Mojave, where versions of -mmacosx-version-min
earlier than 10.9 are not supported anymore. Removing that code of block fixes the issue.
investigate what it would take to port libmonome to win32...consider just not doing it if it's too much work
copies data incorrectly, should be a straightforward fix.
Hi,
I have problems with using the python bindings. When registering for events, the code below will tell me as soon as a button is pressed:
Exception TypeError: '__cinit__() takes exactly 1 positional argument (4 given)' in 'monome.handler_thunk' ignored
I tried to debug the code myself, but could not find any obvious error. I also tried to compile with the most recent cython version, however, this would not resolve the issue.
BTW, I added the following lines to the monome.pyx:
BUTTON_UP, BUTTON_DOWN, ENCODER_DELTA, ENCODER_KEY_UP, ENCODER_KEY_DOWN, TILT = range(6)
CABLE_LEFT, CABLE_BOTTOM, CABLE_RIGHT, CABLE_TOP = range(4)
Here is a sligthly modified version of simple.py that I tried to use.
import monome
device = "/dev/ttyUSB0"
def button_handler(event):
x, y = event.x, event.y
buttons[x][y] ^= 1
if buttons[x][event.y]:
m.led_on(x, y)
else:
m.led_off(x, y)
m = monome.Monome(device)
buttons = [[0] * m.columns] * m.rows
m.register_handler(monome.BUTTON_DOWN, button_handler)
print("simple.py running, press some buttons!")
try:
m.event_loop()
except KeyboardInterrupt:
m.clear()
Thanks in advance
Alex
waf configure
fails with Checking for liblo.
I couldn't find any information about this dependency.
I installed it with
brew install liblo
(I'm on a mac)
but waf still fails:
['/usr/bin/clang', 'test.c.1.o', '-o', 'libmonome/build/.conf_check_2b591adc3300f330d1bbd3f91f2ee0d7/testbuild/testprog', '-llo']
err: ld: library not found for -llo
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there a way to specify the path or something?
that is all
Two issues, the LO_LDFLAGS and the install location of libmonome.pc (pkgconfig)
not really sure why the LDFLAGS are causing a problem but it is easy to ignore the errors in homebrew and still get a working install
As for the pkgconfig issue, it would appear it could be fixed by defaulting to the prefix... but you had changed this in a prior commit
I guess this is caused by the update to waf 2.0 (or maybe waf's behaviour already changed in an earlier version).
First of all bld.env.CYTHON
no longer gets set, no clue why yet.
And when I change that so it forces building the python bindings waf errors with the following message
File /home/simon/src/forks/libmonome/bindings/python/monome.pyx has no mapping in ['.py', '.c', '.obj', '.o', '.pc.in'] (load a waf tool?)
There's probably a way to fix this, but I couldn't find anything useful in the waf docs.
I was hoping the cython example in waf would be useful, but that has the same error :x
https://github.com/waf-project/waf/issues/2047
When trying to build with Python 3.7 I get the following error message
* libmonome-1.4.1.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
�]0;9d5840e5020d: emerge: (1 of 1) media-libs/libmonome-1.4.1-r1 Compile� * Using python3.7 to build
>>> Unpacking source...
>>> Unpacking libmonome-1.4.1.tar.gz to /var/tmp/portage/media-libs/libmonome-1.4.1-r1/work
>>> Source unpacked in /var/tmp/portage/media-libs/libmonome-1.4.1-r1/work
>>> Preparing source in /var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1 ...
'CCFLAGS=-O2 -pipe' 'LINKFLAGS=-O2 -pipe -Wl,-O1 -Wl,--as-needed' 'PKGCONFIG=x86_64-pc-linux-gnu-pkg-config' '/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/waf' '--prefix=/usr' '--disable-osc' '--disable-udev' 'configure'
Traceback (most recent call last):
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Node.py", line 299, in ant_iter
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Scripting.py", line 117, in waf_entry_point
run_commands()
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Scripting.py", line 165, in run_commands
parse_options()
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Scripting.py", line 148, in parse_options
ctx.execute()
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Options.py", line 196, in execute
super(OptionsContext,self).execute()
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Context.py", line 84, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Context.py", line 125, in recurse
user_function(self)
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/wscript", line 96, in options
opt.load("compiler_c")
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Context.py", line 82, in load
fun(self)
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Tools/compiler_c.py", line 40, in options
opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py'])
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Context.py", line 326, in load_special_tools
lst=self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
File "/var/tmp/portage/media-libs/libmonome-1.4.1-r1/work/libmonome-1.4.1/.waf3-2.0.0-0104def7527f52b931fd4a82b2c485f5/waflib/Node.py", line 353, in ant_glob
return list(it)
RuntimeError: generator raised StopIteration
This is supposedly fixed in waf 2.0.7 (https://gitlab.com/ita1024/waf/blob/master/ChangeLog#L119).
I've read in a couple of places that upgrading waf might be slightly more involved, see for example mpv-player/mpv#5958, will have to try if it just works for us or not.
in the recently-added 1-byte long test cases, the output fails to be what is expected on monomes with 2-byte widths and heights. fundamentally, the behavior is undefined -- we're currently just sending a led_row/col_8, which is the Right Thing to do. serial-pyio implements things a different way, however...it sends along a led_r/c_16 with a zeroed second byte. this provides overall a more consistent behavior.
propose implementing this behavior.
asdf see title
when enabling the python bindings, i get this error output when building against python 2.6 and 2.7:
[... package manager stuff ...]
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --enable-python --prefix=/usr
configuring libmonome 1.0:
checking platform: linux 2.6.38.4
checking for gcc: gcc 4.4.5
determining byte order: little endian
checking for poll: poll works
checking for libudev: libudev 151
checking for liblo: liblo 0.26
checking for python: python 2.7.1 and cython 0.14.1
checking for python headers: yes
options:
installation prefix: /usr
protocols: mext series 40h osc
bindings: python
run make to compile libmonome.
Source configured.
Compiling source in /var/tmp/portage/media-libs/libmonome-9999/work/libmonome-9999 ...
make -j4
CC src/libmonome.o
CC src/rotation.o
CC src/platform/linux_libudev.o
CC src/platform/linux.o
CC src/platform/posix.o
CC src/monomeserial.o
LD src/libmonome.so
LD src/monomeserial
CC src/proto/mext.o
CC src/proto/series.o
CC src/proto/40h.o
CC src/proto/osc.o
LD src/proto/protocol_40h.so
LD src/proto/protocol_series.so
LD src/proto/protocol_osc.so
LD src/proto/protocol_mext.so
CYTHON bindings/python/monome.c
CC bindings/python/monome.o
monome.c: In function 'pyx_f_6monome_event_from_event_t':
monome.c:1583: error: 'monome_event_t' has no member named 'x'
monome.c:1585: error: 'monome_event_t' has no member named 'y'
cc1: warnings being treated as errors
monome.c: In function '__pyx_pf_6monome_6Monome_10clear':
monome.c:2908: error: implicit declaration of function 'monome_clear'
monome.c:2908: error: 'monome_clear_status_t' undeclared (first use in this function)
monome.c:2908: error: (Each undeclared identifier is reported only once
monome.c:2908: error: for each function it appears in.)
monome.c:2908: error: expected ')' before '__pyx_v_status'
monome.c: In function '__pyx_pf_6monome_6Monome_9intensity___set':
monome.c:3100: error: implicit declaration of function 'monome_intensity'
monome.c: In function '__pyx_pf_6monome_6Monome_13led_row':
monome.c:3341: error: passing argument 4 of 'monome_led_row' makes integer from pointer without a cast
../../public/monome.h:124: note: expected 'size_t' but argument is of type 'uint8_t '
monome.c:3341: error: too few arguments to function 'monome_led_row'
monome.c: In function '__pyx_pf_6monome_6Monome_14led_col':
monome.c:3449: error: passing argument 4 of 'monome_led_col' makes integer from pointer without a cast
../../public/monome.h:122: note: expected 'size_t' but argument is of type 'uint8_t *'
monome.c:3449: error: too few arguments to function 'monome_led_col'
monome.c: In function '__pyx_pf_6monome_6Monome_15led_frame':
monome.c:3668: error: implicit declaration of function 'monome_led_frame'
make[2]: ** [monome.o] Error 1
make[1]: *** [python] Error 2
make: *** [all] Error 2
not sure what i don't have, but here's the make sequence...
$ make
CC src/libmonome.o
CC src/rotation.o
CC src/platform/darwin.o
CC src/platform/posix.o
LD src/libmonome.dylib
CC src/monomeserial.o
LD src/monomeserial
CC src/proto/mext.o
LD src/proto/protocol_mext.dylib
Undefined symbols:
"_monome_platform_wait_for_input", referenced from:
_mext_open in mext.o
"_rotspec", referenced from:
_mext_led_row_col in mext.o
_mext_led_row_col in mext.o
_mext_led in mext.o
_mext_led_col in mext.o
_mext_led_row in mext.o
_mext_led_frame in mext.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [protocol_mext.dylib] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2
As mentioned by @artfwo in #65
I've never heard of anybody using the libmonome's python bindings though, so we could as well deprecate them.
Would it be an idea to simply remove the Python bindings?
@artfwo I assume that most people would/should be using pymonome instead?
Are there any advantages to libmonome's Python bindings over pymonome?
skeleton is there
should be the last thing (besides testing) to ready for a release
This would help with getting libmonome included in the main repository for Homebrew
If I try to use clang to build, I get the following errors:
CC=clang CXX=clang++ ./waf configure
./waf build
Waf: Entering directory /Projects/libmonome/build' [ 1/29] c: src/proto/40h.c -> build/src/proto/40h.c.2.o [ 2/29] c: src/proto/series.c -> build/src/proto/series.c.3.o clang: error: argument unused during compilation: '-compatibility_version 1' clang: error: argument unused during compilation: '-current_version 1' [ 3/29] c: src/proto/mext.c -> build/src/proto/mext.c.4.o clang: error: argument unused during compilation: '-compatibility_version 1' clang: error: argument unused during compilation: '-current_version 1' clang: error: argument unused during compilation: '-compatibility_version 1' clang: error: argument unused during compilation: '-current_version 1' Waf: Leaving directory
/Projects/libmonome/build'
Build failed
The fix is to add the command line option: -Qunused-arguments
I've pushed this change to my fork:
https://github.com/pcbeard/libmonome.git
in the branch "clang".
I'm attempting to build libmonome for OpenBSD 7.0 and running into issues. Is building for OpenBSD still supported?
I was able to hack together a build but not successfully run the examples by removing the ldl check, using the posix.c and darwin.c platform files and removing the OFILL flag: https://github.com/jesselucas/libmonome
I'm guessing the darwin.c platform file is the issue with OpenBSD but before trying more wanted to make sure there wasn't an easier path to build that I was missing.
I'm currently working on providing Series compatibility to halvves/webmonome, and am wondering what the difference is between LED intensity and LED levels. If I understand the docs correctly:
intensity
controls the brightness for all LEDs (and this appears to work for my Walnut 64)level
provides brightness control for either a single LED, rows or columns, an 8x8 block, or the entire gridIf so, is there a reason why the Series protocol reduces the level to a single bit:
Lines 263 to 266 in cd11b2f
Could it just pass the level value unchanged?
Also, given that my Walnut 64 supports variable brightness for all the LEDs, could it also support varying levels for individual LEDs/row/frames?
Thanks!
configure fails in bash 4.2 with following errors, 'return' is now restricted to unsigned integer options:
configuring libmonome 1.0:
checking platform: linux 3.0.0-11-generic
checking for gcc: gcc 4.6.1
determining byte order: little endian
checking for poll: poll works
checking for libudev: ./configure: line 164: return: -1: invalid option
return: usage: return [n]
no, using sysfs (you're probably running an old system)
checking for liblo: ./configure: line 164: return: -1: invalid option
return: usage: return [n]
no liblo :(
libraries in /usr/lib/i386-linux-gnu/ (libudev, liblo) are not found by configure, e.g.:
checking for liblo: gcc -ggdb -I/usr/local/include -fPIC -ggdb -L/usr/local/lib -I/usr/local/include -L/usr/local/lib -llo -lpthread .conftests/lo.c -o .conftests/lo
/tmp/ccYzLJQu.o: In function main': /home/art/pkg/2build/libmonome-1.0~git20110819/.conftests/lo.c:4: undefined reference to
lo_address_new'
/home/art/pkg/2build/libmonome-1.0~git20110819/.conftests/lo.c:5: undefined reference to `lo_address_free'
collect2: ld returned 1 exit status
Would it be an option to add writing of a libmonome.pc
pkg-config file to the wscript?
That way it'll be a lot easier for other projects to automatically find libmonome and use it with their build tool of choice.
Seems like there's a built-in option to waf to do this called subst_pc
See for an example the JACK2 wscript
Hello,
I'm trying to get the examples to work that ship with libmonome.
I can connect to my monome with serialosc, and even monomeserial. However, when I run the compiled example programs there is no output on the monome, and none in my console either.
uname -a reports: Linux ragnarok 3.11.4-1-ARCH #1 SMP PREEMPT Sat Oct 5 21:22:51 CEST 2013 x86_64 GNU/Linux
Any advice on how to go about debugging?
self explanatory
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.