eccentric blog

[ Home | RSS 2.0 | ATOM 1.0 ]

Mon, 24 Jun 2019

ImageMagick 6.x compile error on centos 6

I ran into some problems updating image magick on older centos6 systems. Specifically ImageMagick-6.9.10-50 which would error during the make compile with:

magick/.libs/libMagickCore-6.Q16.so: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[1]: *** [utilities/animate] Error 1
make[1]: Leaving directory `/usr/src/ImageMagick-6.9.10-50'
make: *** [all] Error 2

This can be fixed by adding compile time flags:

LDFLAGS=" -lrt " ./configure
LDFLAGS=" -lrt " make

posted at: 17:26 | path: /linux | permanent link to this entry

Mon, 13 May 2019

desktop notifications from websites in firefox

So this has been bothering me for a while now where I would sometimes get notifications on my desktop from reddit r/archlinux posts. I finally took some time to track down where they are coming from, and it looks like it's push notifications from firefox. I guess these come in even if you don't have those pages loaded in your browser, which is kind of confusing.

Anyways, this blog post explains how to turn them off, and there is an option to not allow them ever which is also handy (remove all websites and block new requests): https://blog.mozilla.org/firefox/no-notifications/

posted at: 12:56 | path: /linux | permanent link to this entry

Tue, 11 Dec 2018

Adding a menu location for locally installed xdg .desktop application links

I ran into an issue recently trying to install a application menu link on a debian system (desktop was mate in this case, but I think it applies to any gnome based desktop). The issue was that I would install a new .directory file for a new menu entry along with the .desktop file, and when I did, the application would show up under "Other" and not under the menu category I was trying to add.

The processes being:

Running this as the local user, correctly installs the files in ~/.local/share/, but it does not write a menu file. And so the application will show up under Applications->Other

If you run the command as root, it will install system wide, and creates the menu for you under /etc/xdg/menus/applications-merged/company-company.menu

But if you don't want this installed system wide, it seems like the only way to fix this is to setup the .menu file manually? I feel like I'm doing this wrong, and there is a way to specify the menu in a user folder, but at the time I can't seem to figure this out.

To fix the issue I created the /etc/xdg/menus/applications-merged/company-company.menu file manually like this:

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
  "http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
<Menu>
    <Name>Applications</Name>
<Menu>
    <Name>company-company</Name>
    <Directory>company-company.directory</Directory>
    <Include>
        <Category>Company</Category>
    </Include>
</Menu>
</Menu>

This added the menu entry, and the locally installed applications now show up in the correct location.

posted at: 23:43 | path: /linux | permanent link to this entry

Thu, 18 May 2017

wordpress plugin update error: PCLZIP_ERR_BAD_FORMAT

I was having some issues on a server where a particular plugin (bb-plugin) wouldn't update, and I'd just get this error:

PCLZIP_ERR_BAD_FORMAT (-10) : Invalid archive structure

After much poking around, I ended up installing the php5-curl package (on debian), and this ended up solving the problem. I think php was downloading the archive from the update server, but for whatever reason it was getting corrupted or not saving correctly. With curl the download seems to have saved the zip file correctly, and thus the error went away. It seems to have only been effecting this one plugin, as other plugins and wordpress auto updates were working just fine.

Anways, I didn't have much luck in googling a solution to this problem, so I thought I'd publish what I found.

posted at: 17:04 | path: /linux | permanent link to this entry

Sun, 15 Nov 2015

hacking a logic controls cr3003 usb cash drawer

I had this usb cash drawer for a point of sale system, and needed to trigger it to open. I assumed it would be a serial protocol as I saw the drivers mention something about COM port selection in windows, so I figured it would be easy enough to figure out and get working. Turns out that was not the case.

The device itself shows up in lsusb and gets detected with the following information:

$ lsusb
Bus 006 Device 013: ID 0fa8:b033 Logic Controls, Inc.

[299584.252035] usb 6-1: new low-speed USB device number 5 using uhci_hcd
[299584.427042] usb 6-1: New USB device found, idVendor=0fa8, idProduct=b033
[299584.427049] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[299584.427053] usb 6-1: Product: LCI_CR
[299584.427056] usb 6-1: Manufacturer: Logic Controls Inc
[299584.449247] hid-generic 0003:0FA8:B033.000A: hiddev0,hidraw3: USB HID v1.00 Device [Logic Controls Inc LCI_CR] on usb-0000:00:1d.0-1/input0

I probed around the hidraw interface a bit but finally gave up after not being able to transmit anything to it via pyusb without getting usb.core.USBError: [Errno 16] Resource busy errors.

So I broke down and loaded up a windows VirtualBox instance and installed the driver. It seems to emulate a COM port in some fashion, and then there is a utility to set what codes you want to use to open the cash drawer. So I snooped the usb data and found the control code for opening the drawer. Disconnected the usb device from virtualbox, and sent the data with pyusb, and sure enough it was working! I was all happy for a moment then decided to unplug the drawer plug it back in and make sure it still worked, but of course, no. After plugging it back in I got Resource busy errors again, and could transmit the open code. So I enabled usb in virtualbox again, and disabled it a few seconds later, and then I could open it again with libusb. So the driver seems to initialize the device in some way when it first talks to it.

So I then found some info on the web about how to capture data with the usbmon kernel driver and ended up doing the following:

tcpdump -i usbmon6 -w - -U > dump.out

Then connected the device in virtualbox, let the driver do it's initialization and then disconnect from virtualbox.

With that I had the raw usb data the driver used to initalize the device in dump.out. With some google searching I found this USB Reverse Engineering toolset which had a script to replay data from a capture. So I downloaded that library and ran the following:

cat dump.out | python ./usbreplay.py --vid 0x0fa8 --pid 0xb033

This produced some errors, but ultimately turned out to work. After doing that I could open the cash drawer with the following python code:

import usb.core
import usb.util

dev = usb.core.find(idVendor=0x0fa8, idProduct=0xb033)
if dev.is_kernel_driver_active(0) is True:
    dev.detach_kernel_driver(0)

cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
epout = usb.util.find_descriptor(intf, custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT)
assert epout is not None
epout.write([0x31, 0x07])

I ended up wrapping all that uglyness up into a hack that does the job, but ugh. In my google searching I did find a device called "USB Trigger For Cash Drawer (Model: DT-100U)", which would have been a better solution (along with any old cash drawer with receipt printer interface). This is just a serial usb device, and when you send it data, it triggers the cash drawer via the commonly used receipt printer interface (24V).

posted at: 04:08 | path: /linux | permanent link to this entry

Sun, 04 Oct 2015

Using qmail-autoresponder with qmailadmin

So I have been using qmail-autoresponder. for vacation messages on qmail, but it doesn't work with qmailadmin. which expects the program autorespond. So I finally got around to fixing this up and patching qmailadmin to write the proper files, and set the .qmail file to use qmail-autoresponder.

In doing so I've created a patch file which patches qmailadmin qmailadmin-qmail-autoresponder.patch. - I also use this ezmlm7 patch mailinglist.c.ezmlm7.patch.

I'm going to just dump my installation instructions which explain the usage:

# download patch files and qmailadmin
tar zxvf qmailadmin-1.2.16.tar.gz
cd qmailadmin-1.2.16

sed -i "33i\#include \"config.h\"" command.c
patch < ../mailinglist.c.ezmlm7.patch
patch < ../qmailadmin-qmail-autoresponder.patch

./configure --enable-cgibindir=/var/cgi-bin/ \
--enable-htmldir=/var/www/ \
--enable-imagedir=/var/www/ \
--enable-imageurl=/images \
--enable-domain-autofill \
--enable-ezmlmdir=/usr/local/bin/ezmlm \
--enable-autoresponder-path=/usr/local/bin

posted at: 02:57 | path: /linux | permanent link to this entry

Made with Pyblosxom