You are here

Risharde's Blog

pyUSB on Raspberry Pi

sudo python setup.py install

http://stackoverflow.com/questions/29345325/raspberry-pyusb-gets-resourc...

https://pixiescorner.wordpress.com/2009/09/05/utilityconvert-x10-to-inst...

This isn't too bad, but there are a couple quirks to be aware of. One limitation is that sending X10 codes breaks if you go too fast. I added a Wait subroutine (see the end of this page). The PLM seems to need a 500 millisecond pause between X10 commands. Lower delays didn't seem to work.

Also, the indexes are odd. I set up two arrays with the necessary values (see below).

The following also assumes that

house = the X10 house code as an integer, 0 = A, etc
device = the X10 device code as an integer

Put this in the declarations area of your form/module:

Public PLM_X10_House(16) as Byte
Public PLM_X10_Device(16) as Byte

Set the values for those areas somewhere convenient (like Form1.Load):

PLM_X10_House(1) = 96 ' House code A
PLM_X10_House(2) = 224 ' House code B
PLM_X10_House(3) = 32 ' House code C
PLM_X10_House(4) = 160 ' House code D
PLM_X10_House(5) = 16 ' House code E
PLM_X10_House(6) = 144 ' House code F
PLM_X10_House(7) = 80 ' House code G
PLM_X10_House(8) = 208 ' House code H
PLM_X10_House(9) = 112 ' House code I
PLM_X10_House(10) = 240 ' House code J
PLM_X10_House(11) = 48 ' House code K
PLM_X10_House(12) = 176 ' House code L
PLM_X10_House(13) = 0 ' House code M
PLM_X10_House(14) = 128 ' House code N
PLM_X10_House(15) = 64 ' House code O
PLM_X10_House(16) = 192 ' House code P

PLM_X10_Device(1) = 6
PLM_X10_Device(2) = 14
PLM_X10_Device(3) = 2
PLM_X10_Device(4) = 10
PLM_X10_Device(5) = 1
PLM_X10_Device(6) = 9
PLM_X10_Device(7) = 5
PLM_X10_Device(8) = 13
PLM_X10_Device(9) = 7
PLM_X10_Device(10) = 15
PLM_X10_Device(11) = 3
PLM_X10_Device(12) = 11
PLM_X10_Device(13) = 0
PLM_X10_Device(14) = 8
PLM_X10_Device(15) = 4
PLM_X10_Device(16) = 12
To send an X10 On command:

Dim data(3) as Byte

data(0) = 2 ' start first message: send X10 address only
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + PLM_X10_Device(device) ' X10 address (house + device)
data(3) = 0 ' flag = this is the address
SerialPLM.Write(data, 0, 4)
Wait(500)
data(0) = 2 ' start second message: send X10 house + command
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + 2 ' X10 address (house + command)
data(3) = 128 ' flag = this is house + address
SerialPLM.Write(data, 0, 4)
To send an X10 Off command:

Dim data(3) as Byte

data(0) = 2 ' start first message: send X10 address only
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + PLM_X10_Device(device) ' X10 address (house + device)
data(3) = 0 ' flag = this is the address
SerialPLM.Write(data, 0, 4)
Wait(500)
data(0) = 2 ' start second message: send X10 house + command
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + 3 ' X10 address (house + command)
data(3) = 128 ' flag = this is house + address
SerialPLM.Write(data, 0, 4)

import usb.core
import usb.util

# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)

# was it found?
if dev is None:
raise ValueError('Device not found')

# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()

# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]

ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)

assert ep is not None

# write the data
ep.write('test')

Raspberry PI 2 - Installing Iceweasel

I have been trying to install iceweasel and keep getting a error 404 when using 'apt-get install iceweasel'
So here's the fix:

sudo su
apt-get update
apt-get dist-upgrade
sync
reboot

Then after reboot
sudo su
apt-get install iceweasel

Raspberry RAM Drive for LOGS

http://www.makeuseof.com/tag/extend-life-raspberry-pis-sd-card/

Basically, you edit the /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0
tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0
tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0

Save

Reboot

Get back your start menu in Windows 8

I've been using Windows 8.1 and absolutely dislike the returned start menu as it lacks a lot of features compared to the Windows 7 start menu.

The good news is that the guys over at Classic Shell has created software to return the taskbar to its rightful bottom of the screen.

You can get it free at http://www.classicshell.net/

Good luck!

PhotoSync To PC for Android and Windows

Get more information and demonstration video here: https://play.google.com/store/apps/details?id=net.dovetechnologies.photo...

Synchronize your android photos to your PC with a few clicks! Never lose your photos because you broke your android device or don't have access to it!
Just run our Windows application on your computer which you can download at http://www.dovetechnologies.net/photosynctopc.html

Run the Windows app to send your photos to your computer in your My Pictures folder! It's just that simple!

It also sends video files that are in your camera directory as well automatically!

It's so extremely simple, you'll never have to connect your android device/phone using the USB cable again and doing complicated actions to back up your photos!

Use it once and you'll see how easy it is!

Uninstalling applications that don't want to uninstall

I've come across trying to install some applications which simply don't want to uninstall via the Programs and Features section of the Windows Control Panel. Well the good news is that there are coders out there that are smarter than Microsoft that developed a really useful application that intelligently scans the application you want to uninstall and remove it from your computer. This comes in handy when trying to uninstall adware from your PC as well. The name of the application is Revo Uninstaller that there's a free version that does the basics. It saved one of my computers so far.

http://www.revouninstaller.com/revo_uninstaller_free_download.html

Samsung Prices

Maybe its because of the craze and popularity... or perhaps its because its the latest advertised technology but I really think that Samsung prices are fairly expensive. Getting one of their higher end phones will cost you 4000Tt and up such as the note 2 and note 3 or even the s4. Now why would I describe it as expensive? Well for one the added samsung gear would cost you another 2000 tt easy. Compare the cost of an s4 to a high end Blu phone and the features dont seem to be much different except for the fact that Blu doesnt have a smart watch to my knowledge. Furthermore this gorilla glass is over rated. I really dont care for gorilla glass with regard to scratching... I want something strong enough to handle a fall and gorilla glass cracks very easily.

Kloxo vulnerability causes devastating outbound ddos attacks

Recently Kloxo a fairly popular open source control panel for linux contained a vulnerability that allowed an attacker to take control of the server running kloxo and sending out attacks via multiple methods one of which was dns reflection due to misconfiguration. This is one of the reasons I decided to move on from kloxo a few years ago, it was extremely vulnerable and I wanted to sleep better at night. While they have released an update I am not convinced it is safe for production use. As for KloxoMR I really dont see how one man can keep up with maintaining it forever.

Pages