Sunday, April 19, 2020

Chromcast chromium Linux not connecting

Just a short post on problems connecting Chromium to a Chromcast device

Much confusion on this problem, people go into great detail on obvious answers with setting up Chromcast but of course this is a bit more detailed then simple setup problem. The first problem is to see that chromium supports casting nativity no need for extensions for apps etc. Go into settings and you will see a cast label, select the label and something should popup like cast tab ? If your Chromcast device pops up your are all set, if not read on. Chromcast is not firewalls friendly , IE once found a udp flow from Chromcast comes to your machine/IP that is NOT related . So in order to connect to your Chromcast device you must open your machine FW a bit. Since Chromcast works best if you are on the same wireless device you can put up a rule that just's allows the Chromcast device IP in your INPUT rules: "iptables -I INPUT 7 -s Chromcast-IP -j ACCEPT -m comment --comment "chromcast cast device" , where Chromcast-IP is the IP of the device. I found a much more complicated set of rules like this:
export CHROMECAST_IP=10.1.2.3 # Adjust to the Chromecast IP in your local network
iptables -A INPUT -s ${CHROMECAST_IP}/32 -p udp -m multiport --sports 32768:61000 -m multiport --dports 32768:61000 -m comment --comment "Allow Chromecast UDP data (inbound)" -j ACCEPT
iptables -A OUTPUT -d ${CHROMECAST_IP}/32 -p udp -m multiport --sports 32768:61000 -m multiport --dports 32768:61000 -m comment --comment "Allow Chromecast UDP data (outbound)" -j ACCEPT
iptables -A OUTPUT -d ${CHROMECAST_IP}/32 -p tcp -m multiport --dports 8008:8009 -m comment --comment "Allow Chromecast TCP data (outbound)" -j ACCEPT
iptables -A OUTPUT -d 239.255.255.250/32 -p udp --dport 1900 -m comment --comment "Allow Chromecast SSDP" -j ACCEPT

That said my simple rule is a bit simpler and assumes you all ready have rules that allows outbound connection like this: INPUT/OUTPUT ctstate RELATED,ESTABLISHED , that allows outbound connections to flow . I think the complicated above should work but is a bit complicated so I didn't try it . Once I had the one rule for the Chromcast IP in INPUT everthing worked from Chromium without issues . Most problems are simple and most solutions are also simple why get complicated .

Friday, April 19, 2019

ESP8266 notes and hints

There is a fair amount of information out there and web sites to building/using the ESP8266, the problem is there is a lot of just wrong info on the ESP8266 out there . ESP8266 wasn't designed to be like a Arduino but info was released and programmers hacked it and now it's a lot like a Arduino , it seems to be designed to be used by a Arduino like a processor using a serial connection and a AT modem set (a flash back to the 1990) . You can find a lot of Arduino library's that let you do this but the real power of the ESP8266 is that you can re-flash it with Arduino like code and use it as a stand alone Arduino. The confusion on the ESP8266 starts because there are a lot of hardware version of the ESP8266, google ESP8266 wiki and read, lots of versions and manufacturers so here is the start of miss-information . Lots of datasheets poor translations , incorrect interpretations of the documents . It also doesn't help that these are 3.3v devices where most of the Arduino's were 5v, IE 3.3v devices are a lot easier to damage due to over voltage IE anything over 3.6v and you device is garbage, and let me count the ways that can happen (at least 4-5 times I have done this, by mistake or indirectly). Once you damage a ESP8266 it can still function but not to spec , IE GPIO's show off when on , A/D can work but be wrong , at boot pins will recycle up and down randomly etc .

One of the first things you hit when using the ESP8266 is how you have to set it up to program or just run it , IE 3 pins will need pull up resistors and 1 pin a pull down , RESET,GPIO0,GPIO2 up, GPIO15 down, please read the data sheet for the device you have to verify this, don't trust anyone , again because of the above . GPIO0 is the program pin, low puts it into programming/flashing mode. But one of the things you will run into is that there are a lot of pins that go up and down during a boot, IE power on. This can cause un-wanted functions to trigger on your design, so again find some documentation and experiment. The other major problem is that the ESP8266 has a built in wireless stack that when activated will take time away from any process to keep the connections alive and well. There are many Arduino library writers that have had to fix there code because of this time share of this device, IE your code is not the only thing running of this chip, keeping that in mind you have to be able to give up control to the communication code so that it can maintain connections health etc .

The ESP32 is the next generation of the ESP8266 and it solves some of the ESP8266 problems IE duel processors more pins better documentation and designed to be programmable from the ground up. But the ESP32 is 2x the money at least if not more as of this document creation. So in the low price area ESP8266 still has a place and a market if you can get around the above issues. I had some good success with it so far .

Sunday, November 1, 2015

Honda Wallpaper img imid option

To create a Wallpaper for your Honda 2015 you need to read the owner Manual and see the following limitations of the image:

Each image file can be up to 2 MB.
• The maximum image size is 1,680 x 936 pixels. If the image size is less than 420 x 234 pixels, the image is displayed in the middle of the screen with the extra area appearing in black.
• The number of files that can be selected is up to 255.
• Up to 64 characters can be displayed in the file name.

Also when you create the JPEG file you must not use progressive compression for the jpg file. By default gimp turns this on and the paint program does not.

Monday, February 2, 2015

DIY PDF Bluetooth foot pedal for Android

DIY PDF Bluetooth foot pedal for Android

Why do this:

There are many directions that someone can go to build/buy something like this , so why bother and why is this worth while ? 
I think learning and understanding how things work and why they work or don't keep people in a balanced state , IE ignorance is not good for any one, details are the only path out.
This project keeps my mind into a sample of current electronics/Android development and how new products can change the way we work and think.  Also this touches things I can use and do, IE wood work is a something I like to do, electronics is something I find fun and programming/machine building is in my blood somehow. The BT foot pedal is something that is changing how sheet music is read when playing a instrument IE no paper just a tablet and a foot pedal I play there for this is good . I found this link to a DIY foot pedal project Bluetooth-page-turner-pedal-for-sheet-music-apps .  It was a good project to find the bluefruit-ez-key which gave me the rest of my project as I built everything around it.

Designing the pedal:

 I always start with the minimum of what I need:
  • Some kind of platform to rest the foot on to trigger a switch/page turn.
  • Some kind of switch ?
  • Power the unit ? 
  • Some way to package the hole unit ?
Since most of this project will be built with the Bluefruit-ez-key unit most of the questions and design points will be answered there. Some key features of the EZ-key:
  •  Power the module with 3-16VDC, so a 9V battery will work great.
  •  Acts just like a BT keyboard, IE plug a switch to a key and it works.
  •  Sends the 4 arrow keys, return, space, etc.
It looks like all I need is a platform to hold switches and a box to hold the EZ-key and a 9V battery. I start with the platform, some major points :
  • Comfort , I don't want to be picking the foot up to hit a page turn, I wanted something to  use as a foot rest and then rotate the foot left or right. 
  • Back and forward keys will be closest and I wanted a home and end function key to act as a top of document and end of document.
  • Pitch of the pedal would be not too high and not too low so again minimal foot movement. 
  • Size of unit should be small to be able to easily pack away in a gig bag.
  • Stability of the unit no tip or chance of turning over during a session.  
I wanted a lot of pitch control on the platform so I made this with some scrap wood. Wood is something you can just form into any shape and pitch/angle would be controlled with the supports of the platform.  So I started with a shape that would be a arch that would allow the foot to pivot on the heel to each switch.  I determined a pitch that was comfortable to rest the foot on and then I cut out the pieces and glued it together.  
Pitch of the platform for resting the foot
Because the platform is small and the supports are large there isn't much space to hide a 9V battery and the EZ-key board so a external box was needed to support this, I went with plastic because it is a insulator and it is easy to cut and glue a box also I wanted clear to see the led's on the EZ-key board, again something small/strong. I added and on/off toggle to power on off the unit for convenience. 
EZ-key , battery, switch
I wired the box to the platform with some small plastic tie wraps and the wire holes in the foot switch supports.  I used monetary stomp box foot switches to do the key presses and wired them to the 4 keys and ground.  The keyboard keys I'm using are up arrow for page up, down arrow for page down, space for top and enter for max down,  See the EZ-key documentation for the keys and pins . 
Underside so that you can see supports and wiring
I wanted to use this on a Android tablet , I have a nook 9 inch with a Cyanogenmod cm11 loaded with Android 4.4.4 .  I found the pdf reader Ebookdroid which has a way to control the scroll down/up and could remap keyboard keys to do functions like top/end to space/return.  Ebookdroid is also opensource with alot of functionality in it but the documentation is not much but I was able to figure it out. There is a bit of documentation in the EZ-Key unit that I over looked and that is when paring the EZ-Key to a device you have to hit the very small button on the EZ-Key to start the pairing else it will never see it, I wasted some hours of work missing that button.  
The buttons are mapped right to left as bottom, page down, page up, top.
In general this project took months to figure out all the different pieces and to make the decisions on how I wanted it to turn out. There needs to be a top piece to the control box but for now I'm leaving it off for future debugging.  In general this is working well , but I am still in testing and will update with more results later.     

Tuesday, December 18, 2012

Asus AS U32U laptop with Linux

Asus AS U32U laptop with Linux

This is a AMD E-450 dual core, cool running CPU with these lspci:

00:00.0 Host bridge: Advanced Micro Devices [AMD] Family 14h Processor Root Complex
00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6320]
00:01.1 Audio device: Advanced Micro Devices [AMD] nee ATI Wrestler HDMI Audio [Radeon HD 6250/6310]
00:04.0 PCI bridge: Advanced Micro Devices [AMD] Family 14h Processor Root Port
00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus Controller (rev 42)
00:14.1 IDE interface: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 IDE Controller (rev 40)
00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA) (rev 40)
00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI to PCI Bridge (rev 40)
00:15.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0)
00:15.1 PCI bridge: Advanced Micro Devices [AMD] nee ATI SB700/SB800/SB900 PCI to PCI bridge (PCIE port 1)
00:15.2 PCI bridge: Advanced Micro Devices [AMD] nee ATI SB900 PCI to PCI bridge (PCIE port 2)
00:15.3 PCI bridge: Advanced Micro Devices [AMD] nee ATI SB900 PCI to PCI bridge (PCIE port 3)
00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 0 (rev 43)
00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 1
00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 2
00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 3
00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 4
00:18.5 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 6
00:18.6 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 5
00:18.7 Host bridge: Advanced Micro Devices [AMD] Family 12h/14h Processor Function 7
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01)
04:00.2 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 0a)
05:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller
06:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

The only real problem area was the Realtek RTL8111/8168B Ethernet controller , I had to upgrade to Linux kernel 3.7.0 for this to work at all.  Atheros wireless works at N speed without any issues so far at kernel 3.6.6 .   

Suspend worked with "s2ram -f -a1" and X11 worked with a almost default file , sound works with a 3.6.6 kernel but mute on headphone didn't work till the 3.7.0 kernel.  Put my own 180G Intel SSD and works without any issues for the last month .  

I like the Asus build quality a lot and think this is a great laptop where you can still put standard parts in it like ssd - ide / memory with out issues unlike the ultralights out there with special ssd and memory.

Hope this helps. 

Sunday, March 27, 2011

You never get fired for buying MS/Cisco/Oracle/IBM/HP/Dell etc ?

Is this still true "you'll never get fired for buying the big brands"  ?
Is this the magic formula to a successful corporate job ?
Does corporate IT still live and breath this cry, has nothing changed in 30 years ?

Linux in the corporate environment has caused some small cracks in the above Iron, but it seems not much.  In my job I get questions like "are sure you are spending enough here", or "well that is only a AMD machine" Or "why don't we just buy all the machines now" .  In general most managers just don't understand what a corporate machine should be, thus they want to fall back to someone to defined that for them (and expert), and big brand names are more then happy to do this.  Big brands try to look at what they think the current corporate environment is and to drain as much cash from that environment, thus the model lines are developed and sold.  Is there a way to fight/counter  this madness ?  Here are some steps that might help change the corporate environment.

1) To bring in hardware that is off brand it has to work, and work well for today and into the future.
2) You need to establish a track record of the above at least 2-3 years.
3) You must then sell this to your managers and underlings all the time.
4) Mangers must understand that this is not only saving money but is better for today and the future.
5) Underlings must work with you and not against.

Why fight this fight, here are some reasons :

1) Most big brand hardware is 1-2 years behind the technical hardware curve, thus you will spend more for less advanced hardware.
2) Fast and more up to date hardware will give you a 2-3 year advantage for  performance and up time numbers.
3) You will be able to buy more hardware, faster and reliable because you can shop for the best/price point within each category .

Current examples:
1) SSD hard drives are changing everything about I/O, database access and reliability .
2) The fastest system memory is the best way to make applications run fast.
3) Mega multi core machines are creating main frames on 1U servers.
4) There are always 2-3 reasons to build your own machines, always.

Are there reason why you don't want to do this (Yes):
1) You just don't have the time.
2) You are scared of failing .
3) Non Linux software does not work well with new hardware.
4) MS licensing gives you a huge costs disadvantage to rolling your own.  

As always what do you think ?  Any more reasons to add to the list ?  What ideas do you have ?

Saturday, October 2, 2010

VDE and QEMU

Networking many qemu-kvm on one hosting machine or Virtual machines with Virtual networking

VDE - Virtual Distributed Ethernet Create a virtual switch in your machine with software.
QEMU - is a generic and open source machine emulator and visualizer
QEMU-KVM - QEMU with Linux Kernel virtual machine, using hardware in processors that support emulations (very fast).

I have been using Qemu-kvm for the last 2 years and the biggest pain is setting up networking for a group of virtual machines, there is a way to set up a tun and bridge interface for each virtual machine but it is a pain and when you display all of the network machines it is a mess to take in. VDE seems like a way to simplify this networking mess, with VDE you can set up a virtual switch that has one tun to connection and many QEMU-KVM connections to VDE. All of this is not perfect and may require some bridge creation and or FW rules.

Setting up VDE

There is a VDE daemon that must be started to bring up a switch:
vde_switch -tap tap0 -daemon
This daemon must be running to use vde to run qemu, you can bring it up when you start up your machine or with a script as you start up your qemu-kvm machines.  Please note that this will create a pipe file in /tmp/ or /var/tmp , depends on installation of vde and parm overrides.

Creating a Linux bridge interface

To get the vm machines to communicate out you can set up routing in linux with a FW SNAT or you can set up a bridge interface over you active network interface.  The bridge option is a bit easier and better if you want to connect to your virtual machines from the outside of your host machine.  You can create a br0 device through your network start up (Using your normal distro startup) or by hand (using brctl utils) then attach your active network interface to it and the tap0 device and you are done with the network setup, well almost.   Note: Distro networking is notorious confusing and worthless, yes people (in most cases people running old distros that google search works well for) do get it to work , but for the rest of us it's not worth the pain since setting it up requires us to understand the start scripts written by some bash hacker of dubious intentions.  The doc from brctl is easy to understand thus why bother with anything else.

Using vde with qemu-kde

To put all of this together you need to run qemu-kde under vde and the best way is with this format of a command:
vdeq qemu-kvm -net vde,vlan=0 -net nic,model=virtio,vlan=0,macaddr=52:54:00:00:AA:01 -curses -drive file=/space/images/linux-amd64-2.img,snapshot=off,cache=none,if=virtio,boot=on -smp 2 -m 1G -monitor telnet:127.0.0.1:9221,server,nowait
When running qemu-kvm under vdeq you can add network options IE "-net vde".  With this option qemu will connect to a free port on the vde_switch which is now bridged with the br0 device and has free access to the internet/lan . The one trick here is defining the mac address "macaddr=
, this needs to be done for each VM you inter connect to the switch, else all machines will get the same default mac address, the rest of the command is pure qemu and I leave that to the reader to figure out. 

Running multiple network interfaces

One last trick is running qemu-kde with vde and having eth[1-100].  The standard way of doing this is bring up multiple vde_switch daemons and connect to the different UNIX sockets of the multiple switch daemons and set up multiple bridges to connect to which switches and etc .  This can get very complex very fast and in most cases it is not needed.  The quick way to do this is to use the vlan=X option in vde and use the same vde_switch for each vlan option , a example :
vdeq qemu-kvm -curses -drive file=/space/images/linux-amd64-1.img,cache=none,if=virtio,snapshot=off,boot=on -smp 2 -m 1G -monitor telnet:127.0.0.1:9222,server,nowait -net vde,vlan=0 -net nic,model=virtio,vlan=0,macaddr=52:54:00:00:AA:03 -net vde,vlan=1 -net nic,model=virtio,vlan=1,macaddr=52:54:00:00:AA:04
Note the vlan=0 and vlan=1, this creates a different interface for the qemu-kvm and rides the networks on the same vde_switch, IE you networks can not conflict for this to work address/subnets/netmasks but if that is clean , as it should be, you will be running two/3/4 different networks on the same switch  ( There may be security issues with this and thus you may be forced not to do this ) .  The vlan= option gives you a easy way to simulate multiple networks between multiple VM's .

Summay

Using vde with qemu-kvm will simplify putting many qemu-kvm machines up on the same machine and make networking very straight forward for the VM's and the hosting machine.  For me its a breath of fresh air for networking simple and direct.  Anyone with any other networking gems for Linux ? Any other experiences with vde/qemu/kvm ?

Some wastland posts

Some wastland posts