http://nikosapi.org/w/api.php?action=feedcontributions&user=Nikosapi&feedformat=atomnikosapi.org wiki - User contributions [en-ca]2024-03-29T08:47:20ZUser contributionsMediaWiki 1.35.0http://nikosapi.org/w/index.php?title=Route_Squid_Proxy_Traffic_Through_an_OpenVPN_Gateway&diff=210Route Squid Proxy Traffic Through an OpenVPN Gateway2014-03-02T05:43:08Z<p>Nikosapi: /* iproute2 Configuration */</p>
<hr />
<div>==Problem Description==<br />
<br />
When using a VPN, the default configuration is to route all traffic over the VPN tunnel. However, there are some instances where it is useful to only route application-specific traffic instead of forcing all traffic through the VPN. This isn't always possible, but if application in question supports an HTTP proxy then we can use Squid to transparently pass that traffic off to an OpenVPN gateway.<br />
<br />
==Implementation Details==<br />
<br />
===iproute2 Configuration===<br />
Permanently add a custom routing table for OpenVPN traffic:<br />
echo "100 openvpn" >> /etc/iproute2/rt_tables<br />
<br />
The addition/deletion of the actual routes will be added by the OpenVPN up/down scripts.<br />
<br />
===Squid Configuration===<br />
Traffic which is accepted by Squid must be emitted on the OpenVPN tunnel interface in order for this to work. Since IP address for the interface is dynamic (assuming the server is not configured to provide static IP addresses) this would require updating the Squid config file every time the VPN connection is established (AFAIK, a hostname cannot be provided in place of the IP address). To get around this limitation, we will emit traffic on a random IP address and then use iptables to forward traffic to the real IP address.<br />
<br />
The following lines were added to the ''/etc/squid3/squid.conf'' config file:<br />
acl local_net src 192.168.0.0/255.255.255.0<br />
http_access allow local_net<br />
forwarded_for delete<br />
tcp_outgoing_address 10.202.101.1<br />
<br />
The first line defines my local network, the second line instructs Squid to accept connections from any computer on my local network, and the third line prevents Squid from including the X-Forwarded-For header in its outgoing connections. The last line defines the source IP address for which Squid will use to make requests on behalf of users. Note that this IP address should not belong to your local subnet or the OpenVPN subnet.<br />
<br />
===OpenVPN Client Configuration===<br />
Add the following items to the client config file:<br />
route-noexec<br />
route-up route-up.sh<br />
down down.sh<br />
<br />
The ''route-noexec'' parameter prevents the client from applying the default routing configuration which is pushed from the server. The ''route-up'' parameter must point to a script which will be used to setup the custom routing and the ''down'' parameter must point to a script that will remove the custom routing once the VPN client is stopped.<br />
<br />
The content of ''route-up.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh" <br />
<br />
logger "OpenVPN route-up.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL"<br />
<br />
# Add the default route to our custom 'openvpn' routing table<br />
ip route add default via $ifconfig_remote dev $dev table $VPNBRIDGE_TBL<br />
<br />
# Add new interface to act as a middleman between the fixed address used <br />
# by Squid and the dynamic address provided by OpenVPN<br />
ip tuntap add dev $VPNBRIDGE_IF mode tun<br />
ip addr add $VPNBRIDGE_ADDR dev $VPNBRIDGE_IF<br />
ip link set dev $VPNBRIDGE_IF up<br />
<br />
# All packets from Squid are passed to the custom routing table<br />
ip rule add from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
<br />
# Rewrite the source address to match the one provided by OpenVPN<br />
iptables -t nat -A POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
<br />
logger "OpenVPN route-up.sh: local: $ifconfig_local remote: $ifconfig_remote device: $dev"<br />
<br />
The content of ''down.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh"<br />
<br />
logger "OpenVPN down.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL openvpn local: $ifconfig_local"<br />
<br />
ip rule del from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
iptables -t nat -D POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
ip tuntap del dev $VPNBRIDGE_IF mode tun<br />
<br />
Finally, the common configurable parameters for both of these scripts is found in another script named ''vpn_config.sh''. Its contents should look like this:<br />
#!/bin/bash<br />
<br />
export VPNBRIDGE_IF=vpnbridge0<br />
export VPNBRIDGE_ADDR=10.202.101.1<br />
export VPNBRIDGE_TBL=openvpn<br />
<br />
These three scripts should be placed in the same directory and must be marked as executable (chmod +x).<br />
<br />
==Theory of Operation==<br />
This solution is probably overcomplicated, but this is the best I could do with the limited networking skills I have. That being said, I'll attempt to explain the method here.<br />
<br />
The ''route-up.sh'' script creates a new virtual tunnel network interface (named vpnbridge0) with the IP address which was provided for the tcp_outgoing_address parameter in the Squid configuration file (10.202.101.1). Additionally, the script instructs the kernel to route any traffic from that address to the custom 'openvpn' routing table. So when traffic is emitted from the proxy, it gets passed to the openvpn routing table but since the source IP address doesn't match the dynamic address provided by the VPN server, the request fails. To get around this, iptables NAT feature is used to rewrite the source address of the traffic to match that of the VPN client's local IP address. This makes the VPN software happy, and the traffic can flow!<br />
<br />
As far as I can tell, this is how the traffic ends up flowing:<br />
* A client sends a request to Squid.<br />
* Squid binds to 10.202.101.1 and emits the request.<br />
* The kernel's routing chain prepares to send the traffic to the route defined in the custom 'openvpn' routing table.<br />
* The iptables POSTROUTING chain notices the packet has a source address of 10.202.101.1, so it rewrites it to match the $ifconfig_local address.<br />
* The traffic is put onto the VPN's virtual network interface and VPN server handles the rest.</div>Nikosapihttp://nikosapi.org/w/index.php?title=Route_Squid_Proxy_Traffic_Through_an_OpenVPN_Gateway&diff=209Route Squid Proxy Traffic Through an OpenVPN Gateway2014-03-02T05:28:00Z<p>Nikosapi: </p>
<hr />
<div>==Problem Description==<br />
<br />
When using a VPN, the default configuration is to route all traffic over the VPN tunnel. However, there are some instances where it is useful to only route application-specific traffic instead of forcing all traffic through the VPN. This isn't always possible, but if application in question supports an HTTP proxy then we can use Squid to transparently pass that traffic off to an OpenVPN gateway.<br />
<br />
==Implementation Details==<br />
<br />
===iproute2 Configuration===<br />
Permanently add a custom routing table for OpenVPN traffic:<br />
echo "100 openvpn" > /etc/iproute2/rt_tables<br />
<br />
The addition/deletion of the actual routes will be added by the OpenVPN up/down scripts.<br />
<br />
===Squid Configuration===<br />
Traffic which is accepted by Squid must be emitted on the OpenVPN tunnel interface in order for this to work. Since IP address for the interface is dynamic (assuming the server is not configured to provide static IP addresses) this would require updating the Squid config file every time the VPN connection is established (AFAIK, a hostname cannot be provided in place of the IP address). To get around this limitation, we will emit traffic on a random IP address and then use iptables to forward traffic to the real IP address.<br />
<br />
The following lines were added to the ''/etc/squid3/squid.conf'' config file:<br />
acl local_net src 192.168.0.0/255.255.255.0<br />
http_access allow local_net<br />
forwarded_for delete<br />
tcp_outgoing_address 10.202.101.1<br />
<br />
The first line defines my local network, the second line instructs Squid to accept connections from any computer on my local network, and the third line prevents Squid from including the X-Forwarded-For header in its outgoing connections. The last line defines the source IP address for which Squid will use to make requests on behalf of users. Note that this IP address should not belong to your local subnet or the OpenVPN subnet.<br />
<br />
===OpenVPN Client Configuration===<br />
Add the following items to the client config file:<br />
route-noexec<br />
route-up route-up.sh<br />
down down.sh<br />
<br />
The ''route-noexec'' parameter prevents the client from applying the default routing configuration which is pushed from the server. The ''route-up'' parameter must point to a script which will be used to setup the custom routing and the ''down'' parameter must point to a script that will remove the custom routing once the VPN client is stopped.<br />
<br />
The content of ''route-up.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh" <br />
<br />
logger "OpenVPN route-up.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL"<br />
<br />
# Add the default route to our custom 'openvpn' routing table<br />
ip route add default via $ifconfig_remote dev $dev table $VPNBRIDGE_TBL<br />
<br />
# Add new interface to act as a middleman between the fixed address used <br />
# by Squid and the dynamic address provided by OpenVPN<br />
ip tuntap add dev $VPNBRIDGE_IF mode tun<br />
ip addr add $VPNBRIDGE_ADDR dev $VPNBRIDGE_IF<br />
ip link set dev $VPNBRIDGE_IF up<br />
<br />
# All packets from Squid are passed to the custom routing table<br />
ip rule add from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
<br />
# Rewrite the source address to match the one provided by OpenVPN<br />
iptables -t nat -A POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
<br />
logger "OpenVPN route-up.sh: local: $ifconfig_local remote: $ifconfig_remote device: $dev"<br />
<br />
The content of ''down.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh"<br />
<br />
logger "OpenVPN down.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL openvpn local: $ifconfig_local"<br />
<br />
ip rule del from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
iptables -t nat -D POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
ip tuntap del dev $VPNBRIDGE_IF mode tun<br />
<br />
Finally, the common configurable parameters for both of these scripts is found in another script named ''vpn_config.sh''. Its contents should look like this:<br />
#!/bin/bash<br />
<br />
export VPNBRIDGE_IF=vpnbridge0<br />
export VPNBRIDGE_ADDR=10.202.101.1<br />
export VPNBRIDGE_TBL=openvpn<br />
<br />
These three scripts should be placed in the same directory and must be marked as executable (chmod +x).<br />
<br />
==Theory of Operation==<br />
This solution is probably overcomplicated, but this is the best I could do with the limited networking skills I have. That being said, I'll attempt to explain the method here.<br />
<br />
The ''route-up.sh'' script creates a new virtual tunnel network interface (named vpnbridge0) with the IP address which was provided for the tcp_outgoing_address parameter in the Squid configuration file (10.202.101.1). Additionally, the script instructs the kernel to route any traffic from that address to the custom 'openvpn' routing table. So when traffic is emitted from the proxy, it gets passed to the openvpn routing table but since the source IP address doesn't match the dynamic address provided by the VPN server, the request fails. To get around this, iptables NAT feature is used to rewrite the source address of the traffic to match that of the VPN client's local IP address. This makes the VPN software happy, and the traffic can flow!<br />
<br />
As far as I can tell, this is how the traffic ends up flowing:<br />
* A client sends a request to Squid.<br />
* Squid binds to 10.202.101.1 and emits the request.<br />
* The kernel's routing chain prepares to send the traffic to the route defined in the custom 'openvpn' routing table.<br />
* The iptables POSTROUTING chain notices the packet has a source address of 10.202.101.1, so it rewrites it to match the $ifconfig_local address.<br />
* The traffic is put onto the VPN's virtual network interface and VPN server handles the rest.</div>Nikosapihttp://nikosapi.org/w/index.php?title=Route_Squid_Proxy_Traffic_Through_an_OpenVPN_Gateway&diff=208Route Squid Proxy Traffic Through an OpenVPN Gateway2014-03-02T05:09:30Z<p>Nikosapi: Created page with "==Problem Description== When using a VPN, the default configuration is to route all traffic over the VPN tunnel. However, there are some instances where it is useful to only ..."</p>
<hr />
<div>==Problem Description==<br />
<br />
When using a VPN, the default configuration is to route all traffic over the VPN tunnel. However, there are some instances where it is useful to only route application-specific traffic instead of forcing all traffic through the VPN. This isn't always possible, but if application in question supports an HTTP proxy then we can use Squid to transparently pass that traffic off to an OpenVPN gateway.<br />
<br />
==Implementation Details==<br />
<br />
===iproute2 Configuration===<br />
Permanently add a custom routing table for OpenVPN traffic:<br />
echo "100 openvpn" > /etc/iproute2/rt_tables<br />
<br />
The addition/deletion of the actual routes will be added by the OpenVPN up/down scripts.<br />
<br />
===Squid Configuration===<br />
Traffic which is accepted by Squid must be emitted on the OpenVPN tunnel interface in order for this to work. Since IP address for the interface is dynamic (assuming the server is not configured to provide static IP addresses) this would require updating the Squid config file every time the VPN connection is established (AFAIK, a hostname cannot be provided in place of the IP address). To get around this limitation, we will emit traffic on a random IP address and then use iptables to forward traffic to the real IP address.<br />
<br />
The following lines were added to the ''/etc/squid3/squid.conf'' config file:<br />
acl local_net src 192.168.0.0/255.255.255.0<br />
http_access allow local_net<br />
forwarded_for delete<br />
tcp_outgoing_address 10.202.101.1<br />
<br />
The first line defines my local network, the second line instructs Squid to accept connections from any computer on my local network, and the third line prevents Squid from including the X-Forwarded-For header in its outgoing connections. The last line defines the source IP address for which Squid will use to make requests on behalf of users. Note that this IP address should not belong to your local subnet or the OpenVPN subnet.<br />
<br />
===OpenVPN Client Configuration===<br />
Add the following items to the client config file:<br />
route-noexec<br />
route-up route-up.sh<br />
down down.sh<br />
<br />
The ''route-noexec'' parameter prevents the client from applying the default routing configuration which is pushed from the server. The ''route-up'' parameter must point to a script which will be used to setup the custom routing and the ''down'' parameter must point to a script that will remove the custom routing once the VPN client is stopped.<br />
<br />
The content of ''route-up.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh" <br />
<br />
logger "OpenVPN route-up.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL"<br />
<br />
# Add the default route to our custom 'openvpn' routing table<br />
ip route add default via $ifconfig_remote dev $dev table $VPNBRIDGE_TBL<br />
<br />
# Add new interface to act as a middleman between the fixed address used <br />
# by Squid and the dynamic address provided by OpenVPN<br />
ip tuntap add dev $VPNBRIDGE_IF mode tun<br />
ip addr add $VPNBRIDGE_ADDR dev $VPNBRIDGE_IF<br />
ip link set dev $VPNBRIDGE_IF up<br />
<br />
# All packets from Squid are passed to the custom routing table<br />
ip rule add from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
<br />
# Rewrite the source address to match the one provided by OpenVPN<br />
iptables -t nat -A POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
<br />
logger "OpenVPN route-up.sh: local: $ifconfig_local remote: $ifconfig_remote device: $dev"<br />
<br />
The content of ''down.sh'' should look like this:<br />
#!/bin/bash<br />
<br />
source "`dirname $0`/vpn_config.sh"<br />
<br />
logger "OpenVPN down.sh: bridge if: $VPNBRIDGE_IF addr: $VPNBRIDGE_ADDR table: $VPNBRIDGE_TBL openvpn local: $ifconfig_local"<br />
<br />
ip rule del from $VPNBRIDGE_ADDR lookup $VPNBRIDGE_TBL<br />
iptables -t nat -D POSTROUTING -s $VPNBRIDGE_ADDR -j SNAT --to-source $ifconfig_local<br />
ip tuntap del dev $VPNBRIDGE_IF mode tun<br />
<br />
Finally, the common configurable parameters for both of these scripts is found in another script named ''vpn_config.sh''. Its contents should look like this:<br />
#!/bin/bash<br />
<br />
export VPNBRIDGE_IF=vpnbridge0<br />
export VPNBRIDGE_ADDR=10.202.101.1<br />
export VPNBRIDGE_TBL=openvpn<br />
<br />
These three scripts should be placed in the same directory and must be marked as executable (chmod +x).</div>Nikosapihttp://nikosapi.org/w/index.php?title=Binary_Clock&diff=207Binary Clock2013-09-14T15:22:28Z<p>Nikosapi: /* Media */</p>
<hr />
<div>The title sums it up, it's a clock that displays it's output in binary. It's computer controlled so it's easier for novices (like myself) to build and since the output is dictated by software it can be modified to do many other fun things.<br />
[[Image:BClock-front.jpg|thumb]]<br />
== The Files ==<br />
* The schematic: [[:Image:Binary-clock.png|binary-clock.png]] (png format) or [http://nikosapi.org/hardware/binary-clock/binary-clock.sch binary-clock.sch] (eaglecad schematic)<br /><br />
* The source code: [http://nikosapi.org/software/binary-clock/lpt-bin-clock.tar.gz lpt-bin-clock.tar.gz] (version 0.2)<br />
<br />
== Basic List Of Materials ==<br />
* 10 NPN transistors ([http://nikosapi.org/hardware/binary-clock/PN2222A.pdf 2N2222] or 2N4401 or 2N3904, etc..)<br />
* 1 [http://nikosapi.org/hardware/binary-clock/4017.pdf 4017] Decade counter<br />
* 1 [http://nikosapi.org/hardware/binary-clock/LM7805.pdf 7805] 5V voltage regulator<br />
* 24 5mm red L.E.D.s<br />
* 24 82ohm resistors<br />
* 10 1Kohm resistors<br />
* 2 10Kohm resistors<br />
* 4 1N4004 diodes (or any regular diodes from telephones or radios)<br />
* 1 100 MicroFarad capacitor (anything from 50 to 470 will work)<br />
* 1 male DB25 connector (find one on an old printer cable)<br />
* 1 12:1 transformer (with center tap for 240V)<br />
* 1 Computer (>=333MHz,16MB ram,running some form of linux with gcc)<br />
<br />
== Notes On Construction ==<br />
* If you are using 240 volts to power the clock please use a 12:1 transformer's center tap (or a 24:1 transformer) otherwise if you don't you will have to heatsink your voltage regulator accordingly.<br />
* If you are afraid of mains current buy a 10v battery eliminator and pass it through the capacitor and voltage regulator.<br />
* To wire the L.E.D.s it's easier to lay them out in a grid on styrofoam and solder them in place.<br />
<br />
== Compiling And Using The Software ==<br />
* Download the above sourcecode and open up a shell/terminal/command-prompt then untar/gzip the software with "tar -xzvf lpt-bin-clock.tar.gz" then cd into the newly untarred directory.<br />
* Compile the software with "gcc -O3 -o lpt-bin-clock-0.2 lpt-bin-clock-0.2.c" - The software needs to be run as root to get port access. Run it like this: su -c "./lpt-bin-clock-0.2"<br />
* Press Ctrl + c to kill it. - To use the clock just plug it into the wall, into the computer's parallel port, cross both your fingers and toes and run the program.<br />
<br />
== Note About The Software ==<br />
* The software I wrote for this is crude but it works, if you want to modify it please do and if you need help understanding the software (due to some missing comments) please e-mail me at mailto:nikosapi@gmail.com<br />
<br />
== Media ==<br />
* Here are some photos of my binary clock:<br />
<gallery><br />
Image:BClock-front.jpg<br />
Image:BClock-inside.jpg<br />
Image:BClock-leds.jpg<br />
</gallery><br />
<br />
* Here is a video of it running: [http://nikosapi.org/software/binary-clock/Bin-clock.avi Bin-clock.avi]<br />
<br />
== How To Read It ==<br />
This is how to read it:<br />
* First row: tens of hours<br />
* Second row: ones of hours<br />
* Third row: tens of minutes<br />
* Forth row: ones of minutes<br />
* Fifth row: tens of seconds<br />
* Sixth row: one of seconds<br />
<br />
Remember, this is all in binary. Go [http://en.wikipedia.org/wiki/Binary_numeral_system here] to learn how to read binary.</div>Nikosapihttp://nikosapi.org/w/index.php?title=Software&diff=206Software2013-09-14T15:16:01Z<p>Nikosapi: </p>
<hr />
<div>*[[Archos-Sync]]<br />
*[[ENHANCE]]<br />
*[[FC4 on a Toshiba Satellite M40X-RH4]]<br />
*[[foo2svi - an SVI video encoder frontend]]<br />
*[[GoGoMini - Simple Software For Controlling gorecord]]<br />
*[[Mazda Entertainment System|Mazda Entertainment System Bus Protocol Information]]<br />
*[[MSP430 HD44780 Controller Software]]<br />
*[[PVR-Remote]]<br />
*[[PXE boot Ubuntu from a Debian server]]<br />
*[[Binary Clock#Compiling_And_Using_The_Software | Software for controlling the binary clock]]<br />
*[[WiiCheck]]<br />
*[[WIS Go7007 Linux driver]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Hardware&diff=205Hardware2013-09-14T15:15:00Z<p>Nikosapi: </p>
<hr />
<div>* [[Binary Clock]]<br />
* [[MazdaSpoof - A Tape Deck Emulator|Mazda Entertainment System Tape Deck Emulator]]<br />
* [[Mazda Protege Fan Detection Circuit Analysis]]<br />
* [[My First Casemod]]<br />
* [[Nintendo Wi-Fi USB Connector]]<br />
* [[Old-Timey Phone]]<br />
* [[Portable iPod Charger]]<br />
* [[Replacing The Playstation 2 (slim)'s Laser]]<br />
* [[Making Printed Circuit Boards Using the Toner Transfer Method]]<br />
* [[Xbox DVD Playback Kit Pinout]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Software&diff=204Software2013-09-14T15:12:33Z<p>Nikosapi: </p>
<hr />
<div>*[[Archos-Sync]]<br />
*[[ENHANCE]]<br />
*[[FC4 on a Toshiba Satellite M40X-RH4]]<br />
*[[foo2svi - an SVI video encoder frontend]]<br />
*[[GoGoMini - Simple Software For Controlling gorecord]]<br />
*[[Mazda Entertainment System|Mazda Entertainment System Bus Protocol Information]]<br />
*[[MSP430 HD44780 Controller Software]]<br />
*[[PVR-Remote]]<br />
*[[Binary Clock#Compiling_And_Using_The_Software | Software for controlling the binary clock]]<br />
*[[WiiCheck]]<br />
*[[WIS Go7007 Linux driver]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=File:IPod-usb-charger-small.png&diff=203File:IPod-usb-charger-small.png2013-09-14T15:03:49Z<p>Nikosapi: </p>
<hr />
<div></div>Nikosapihttp://nikosapi.org/w/index.php?title=File:Binary-clock.png&diff=202File:Binary-clock.png2013-09-14T14:58:19Z<p>Nikosapi: </p>
<hr />
<div></div>Nikosapihttp://nikosapi.org/w/index.php?title=User:Nikosapi&diff=201User:Nikosapi2013-09-14T14:54:20Z<p>Nikosapi: Created page with "Contact info: * Email: [mailto:me@nikosapi.org me@nikosapi.org] * IRC: nikosapi on irc://irc.freenode.net"</p>
<hr />
<div>Contact info:<br />
* Email: [mailto:me@nikosapi.org me@nikosapi.org]<br />
* IRC: nikosapi on irc://irc.freenode.net</div>Nikosapihttp://nikosapi.org/w/index.php?title=Main_Page&diff=200Main Page2013-09-14T14:21:12Z<p>Nikosapi: </p>
<hr />
<div><big>'''Welcome to nikosapi.org'''</big><br />
<br />
This site is a place for me ([[User:Nikosapi|nikosapi]]) to put up stuff I find interesting or don't want to forget.<br />
<br />
The wiki is currently closed for editing due to the massive amount of spam which was being added on a daily basis. If you'd like to edit something email me and I'll provide you with an account.<br />
<br />
----<br />
<br />
'''Quick Links:''' <br /><br />
<br />
<!-- Thank you ablomen! --><br />
<div style=" position: relative; height: 150px; overflow: hidden;"><br />
<div style="position: absolute; top: 0px; left: 0px;"><br />
<div style="float: left"><br />
<imagemap><br />
Image:Software.png|150px<br />
default [[Software]]<br />
desc none<br />
</imagemap><br />
</div><br />
<div style="float: left"><br />
<imagemap><br />
Image:Hardware.png|150px<br />
default [[Hardware]]<br />
desc none<br />
</imagemap><br />
</div><br />
<div style="float: left;"><br />
<imagemap><br />
Image:blog.png|150px<br />
default [http://nikosapi.org/blog]<br />
desc none<br />
</imagemap><br />
</div><br />
</div><br />
</div></div>Nikosapihttp://nikosapi.org/w/index.php?title=File:Software.png&diff=199File:Software.png2013-09-14T14:16:28Z<p>Nikosapi: </p>
<hr />
<div></div>Nikosapihttp://nikosapi.org/w/index.php?title=File:Hardware.png&diff=198File:Hardware.png2013-09-14T14:16:20Z<p>Nikosapi: </p>
<hr />
<div></div>Nikosapihttp://nikosapi.org/w/index.php?title=File:Blog.png&diff=197File:Blog.png2013-09-14T14:15:51Z<p>Nikosapi: </p>
<hr />
<div></div>Nikosapihttp://nikosapi.org/w/index.php?title=MediaWiki:Sidebar&diff=196MediaWiki:Sidebar2013-09-14T14:07:34Z<p>Nikosapi: Created page with " * navigation ** mainpage|mainpage ** hardware|Hardware ** software|Software ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help * SEARCH * TOOLBO..."</p>
<hr />
<div><br />
* navigation<br />
** mainpage|mainpage<br />
** hardware|Hardware<br />
** software|Software<br />
** recentchanges-url|recentchanges<br />
** randompage-url|randompage<br />
** helppage|help<br />
* SEARCH<br />
* TOOLBOX<br />
* LANGUAGES</div>Nikosapihttp://nikosapi.org/w/index.php?title=Template:MazdaRadioSeeAlso&diff=85Template:MazdaRadioSeeAlso2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>==See Also==<br />
[[Mazda Entertainment System]]{{MazdaRadio}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Template:MazdaRadio&diff=83Template:MazdaRadio2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>* [[Mazda Entertainment System - Bus Protocol|Bus protocol documentation]]<br />
* [[Mazda Entertainment System - Connector Documentation|Connector Documentation]]<br />
* [[Mazda Entertainment System - Capturing Bus Data|Capturing bus data]]<br />
* [[Mazda Entertainment System - Sample Bus Data Dumps|Sample bus data dumps]]<br />
* [[MazdaSpoof - A Tape Deck Emulator]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Main_Page&diff=81Main Page2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>'''MediaWiki has been successfully installed.'''<br />
<br />
Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.<br />
<br />
== Getting started ==<br />
* [//www.mediawiki.org/wiki/Manual:Configuration_settings Configuration settings list]<br />
* [//www.mediawiki.org/wiki/Manual:FAQ MediaWiki FAQ]<br />
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]<br />
* [//www.mediawiki.org/wiki/Localisation#Translation_resources Localise MediaWiki for your language]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Protege_Fan_Detection_Circuit_Fix&diff=79Mazda Protege Fan Detection Circuit Fix2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>This page is a how-to guide for applying the solution for the "Flickering Fan Speed" which was presented here: [[Mazda Protege Fan Detection Circuit Analysis]]<br />
<br />
== Materials ==<br />
The only thing you really need to do this are two resistors that are close to 470 Ohms (yellow-violet-brown) and 200 Ohms (red-black-brown). I'll list everything I used just for the sake of completeness.<br />
<br />
Materials:<br />
* 1x 470 Ohm resistor (1/4W or greater)<br />
* 1x 200 Ohm resistor (1/4W or greater)<br />
* 2x Small/Red crimp-type butt connectors<br />
* 1x Small/Red solderless quick splice connector<br />
* 3x 20cm length of hook-up wire<br />
* 1x 10cm length of 1/4" heat-shrink tubing<br />
<br />
Tools:<br />
* Soldering Iron<br />
* Wire cutters/strippers<br />
* Crimp tool<br />
* Small flat-head screwdriver<br />
* Radio removal tool (made from a coat hanger)<br />
<br />
== Instructions ==<br />
These instructions are merely the process I used, feel free to get creative.<br />
<br />
=== Prepare the resistors ===<br />
[[File:Mazda-fan-detection-fix-01.jpg]]<br />
<br />
=== Attach wires, solder, and trim ===<br />
This is the colour code I used for my wires:<br />
* Black - Ground<br />
* White - Input<br />
* White/Blue - Output<br />
<br />
[[File:Mazda-fan-detection-fix-03.jpg]]<br />
<br />
=== Add some heat-shrink to isolate everything ===<br />
Tape works just as well...<br />
<br />
[[File:Mazda-fan-detection-fix-04.jpg]]<br />
<br />
<br />
=== I pre-crimped and labelled my connectors to make sure I don't mess up===<br />
[[File:Mazda-fan-detection-fix-05.jpg]]<br />
<br />
=== A quick primer on how to remove a stock Protege radio ===<br />
Remove the plastic covers on either side of the radio.<br />
<br />
[[File:Mazda-fan-detection-fix-06.jpg]]<br />
<br />
Insert two bent pieces of coat hanger wire into the holes as shown. You'll feel them lock in place when you get far enough (don't be afraid to force them in there). Push your tools towards the doors while pulling out and the radio should just slide out. You might not get it the first time, but when you do you'll be able to steal a stock radio in less than 15 seconds ;)<br />
<br />
Remember to remove the antenna and main radio harness connectors before proceeding.<br />
<br />
[[File:Mazda-fan-detection-fix-07.jpg]]<br />
<br />
=== This is the wire you're going to cut (Blue/Yellow) ===<br />
It's much easier if you remove the connector from the back of the climate control unit to give yourself more room to work.<br />
<br />
[[File:Mazda-fan-detection-fix-08.jpg]]<br />
<br />
=== Cut and strip the wire ===<br />
Try to cut away from the connector ... just in case you make a mistake.<br />
<br />
[[File:Mazda-fan-detection-fix-09.jpg]]<br />
<br />
=== Connect the circuit you made previously ===<br />
* Connect the "output" to the wire that's still attached to the connector (the right butt connector).<br />
* Connect the "input" to the wire that's buried in the harness (the left butt connector).<br />
<br />
[[File:Mazda-fan-detection-fix-10.jpg]]<br />
<br />
=== Connect your ground ===<br />
Not very surprisingly, the black wire in that harness is ground. Splice into it or use any other bare metal to make your ground connection. I used one of those fancy solderless quick splice connector's just because I had some handy.<br />
<br />
[[File:Mazda-fan-detection-fix-11.jpg]]<br />
<br />
=== Enjoy some A/C at a proper fan speed ===<br />
Seriously, 3 is the best speed.<br />
<br />
[[File:Mazda-fan-detection-fix-12.jpg]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Protege_Fan_Detection_Circuit_Analysis&diff=77Mazda Protege Fan Detection Circuit Analysis2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>A common problem amongst ageing 3rd generation Mazda Proteges is that the air conditioning will stop working on fan speeds 2 and 3. The failure often starts as an occasional flickering of the green "A/C" LED which can often be remedied by moving the fan speed switch back and forth a few times. Over time the light will (and the compressor) will stay off on fan speed 3 and eventually fan speed 2: no amount of playing with the switch will make it work.<br />
<br />
Many solutions have been proposed but I don't believe anyone has examined the root cause of the problem. This page hopes to shed some light on why this happens. First we will examine the blower motor speed control circuit and then we'll take a look at the circuit that detects whether the fan is running or not.<br />
<br />
'''TL;DR''': If you couldn't care less about why it's not working, skip right to the how-to: [[Mazda Protege Fan Detection Circuit Fix]]<br />
<br />
== The Blower-Motor Circuit ==<br />
<br />
The fan speed control circuit is very basic, current is limited through the motor by a series of high-power resistors which are switched in by the speed selector switch (note that in reality only one of the speed switches could be closed at a time.<br />
<br />
[[File:Mazda-protege-fan-circuit.png]]<br />
<br />
The wire labelled "Sense Wire" is the point that's used to determine if the fan is running or not. In theory when the fan is off the sense wire node will be at 12V (battery voltage) and when it's on it should be 0V (ground). Of course that doesn't happen in practice, the former is true, but the latter really isn't. In the example above there's a voltage drop across the Blue/Red wire, another voltage drop across the switch, and yet another voltage drop from the switch to ground. Add all these drops up and you probably have close to a 1V drop on an average Protege, if your A/C isn't working on speed 2/3 then that drop is over 1.1V (we'll get to that later).<br />
<br />
So how is it that we could have such a large voltage drop over a connection which is theoretically 0 Ohms? '''Current!'''<br />
<br />
Here are measurements taken from my car:<br />
<br />
{| class="wikitable" border="1" cellpadding="5" style="text-align: center;"<br />
! Fan Speed <br />
| 1 || 2 || 3 || 4<br />
|-<br />
! Current (Amps)<br />
| 2.75 || 6.35 || 8.8 || 11.75<br />
|}<br />
<br />
<br />
Using this table we can see to achieve that 1V drop on fan speed 3, we only need 0.11 Ohms of resistance. That's nothing considering that all that current is passing through 3 connectors (out of the resistor block, into the switch, and back out of the switch) and Mazda thought it would be a good idea to use what appears to be 20 gauge wire for the connection between the resistor block and the switch (the blue/red wire). The voltage drop is significantly less for fan speed 4 because they used a much thicker wire for that particular speed.<br />
<br />
<br />
== The Fan Detection Circuit ==<br />
<br />
The climate control unit needs to know whether the fan is running or not in order to know whether to enable A/C clutch. It uses a sense wire which is tied to the fan speed 1 switch input, and is thus active-low (when the fan is running the voltage on the sense wire is low). The problem as we'll see is that the cut-off for what constitutes a "low" voltage is much too low because of the way the circuit was designed.<br />
<br />
After a bit of reverse-engineering, this is what I determined to be the fan speed detection circuit:<br />
[[File:Mazda-protege-fan-detection-circuit.png]]<br />
<br />
The "Input" node is connected directly to the "Sense Wire" shown in the first schematic and the "Output" node is connected through another 10K resistor (not shown) to what appears to be a custom ASIC (active-high input). The circuit is a simple inverting amplifier; I really like the built-in input protection from the diode (but that's about it). We'll see that the problem with this circuit is simply a bad choice of biasing resistors. Let's simulate it and you'll see what I mean:<br />
<br />
[[File:Mazda-protege-fan-speed-detection-dc-sweep.png]]<br />
<br />
It's pretty clear that anything over ~1.1V on the input will produce a logic low on the output (thus turning off the A/C compressor). For new cars coming off the line I'm sure that was more than acceptable, but after 10 years switch contacts wear-out, and connector contacts corrode. If they had some forethought they might have extended the acceptable range for the "low" voltage to ~4V (1/3 of Vcc, like everyone else does).<br />
<br />
== Fixing the Fan Detection Circuit ==<br />
<br />
It's very tempting to simply replace R48 with a lower value resistor (4.7K would do the trick in case you're interested), but I wanted to provide a solution which was simple enough for anyone to do (turns out most people don't find SMD soldering very fun). The good news is we can slap a voltage divider right on the fan detection input and achieve a similar result. Here's my proposed solution:<br />
<br />
[[File:Mazda-protege-fan-detection-circuit-fixed-2x.png]]<br />
<br />
<br />
By adding that resistor divider (made up of R-1 and R-2) we get the following response from the circuit:<br />
<br />
<br />
[[File:Mazda-protege-fan-speed-detection-fixed-dc-sweep.png]]<br />
<br />
<br />
Now the "low" voltage cut-off is at approximately 3V which is more than adequate for our application (if there's more than a 3V drop across that wire, something's probably on fire =/). I tested this very circuit and it actually worked as expected!<br />
<br />
I measured the voltage at the climate control's fan detection input with and without the modification and these are the results:<br />
{| class="wikitable" border="1" cellpadding="5" style="text-align: center;"<br />
! Fan Speed<br />
| 1 || 2 || 3 || 4<br />
|-<br />
! Without Modification (Volts)<br />
| 0.12 || 0.84 || 1.0 || 0.40<br />
|-<br />
! With Modification (Volts)<br />
| 0.21 || 0.42 || 0.45 || 0.29<br />
|}<br />
<br />
Notice that with the modification in place the input voltage is always less than half the 1.1V cut-off. Success!<br />
<br />
For a step-by-step guide to building and installing the resistor divider, visit this page: [[Mazda Protege Fan Detection Circuit Fix]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Making_Printed_Circuit_Boards_Using_the_Toner_Transfer_Method&diff=75Making Printed Circuit Boards Using the Toner Transfer Method2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>== Introduction ==<br />
<br />
This isn't so much a complete how-to guide, it's just the process I use to make PCBs (ie. documentation for when I forget). There are [http://fullnet.com/~tomg/gooteepc.htm plenty] of [http://www.riccibitti.com/pcb/pcb.htm great] [http://www.instructables.com/id/Cheap-and-Easy-Toner-Transfer-for-PCB-Making/ guides] on how to do this so I won't beat a dead horse by going over every detail. <br />
<br />
== Motivation ==<br />
<br />
The most annoying part of the toner transfer method is the fact that you can't always be certain you'll get good results. Especially on larger boards, you'll end up applying too much heat/pressure to one section of the board and not enough to another side. Luck plays a large factor when it comes the quality of the resulting board. This is unacceptable when making boards with 10 mil traces spaced 30 mil apart, any small defect becomes a big pain to fix.<br />
<br />
== Method ==<br />
<br />
I start by placing some matchsticks on a cutting board to act as spacers for a thermocouple.<br />
<br />
[[Image:pcb1.jpg|400px|thumb|none|Matchstick spacers and the thermocouple]]<br />
<br />
<br />
A heavy-gauge piece of sheet metal is then placed over the spacers and the thermocouple. The thermocouple must make contact with the metal.<br />
<br />
[[Image:pcb2.jpg|400px|thumb|none|Sheet metal resting on the thermocouple]]<br />
<br />
<br />
The transfer sheet is then placed on top of the metal plate facing upwards. I happen to really like using glossy magazine paper (not pictured) but you can use whatever works best for you.<br />
<br />
[[Image:pcb3.jpg|400px|thumb|none|Toner transfer sheet resting on the metal plate]]<br />
<br />
<br />
The copper clad board is then carefully placed over the transfer sheet so it lines up properly.<br />
<br />
[[Image:pcb4.jpg|400px|thumb|none|Copper clad board positioned over the transfer sheet]]<br />
<br />
<br />
Then another large piece of heavy-gauge sheet metal is placed over the copper clad board. This helps spread the heat from the iron more evenly, otherwise you'll end up with cold spots where the holes on the bottom of the iron meet the board. Alternatively you could move the iron around but this also results in uneven heating.<br />
<br />
[[Image:pcb5.jpg|400px|thumb|none|Another piece of heavy-gauge sheet metal to complete the sandwich]]<br />
<br />
<br />
Here's a picture of the final setup. The iron is centered on the top piece of sheet metal and a digital thermometer reads the temperature of the bottom plate.<br />
<br />
[[Image:pcb6.jpg|400px|thumb|none|Final setup]]<br />
<br />
== Heating cycle ==<br />
<br />
This requires some experimentation to get right, but once you "calibrate" your setup you should be able to easily make quality boards without any guesswork (the final temperature depends on the gauge of the sheet metal and the type of toner you're using). I first tried heating to about 80C but that was barely enough, so I moved onto 100C and finally 110C where I started getting good results. No pressure is applied, the weight of the iron and the sheet metal are sufficient to press everything together.<br />
<br />
The procedure is very simple, I plug in the iron, wait for the thermometer to hit 110C, then remove the iron and the top piece of sheet metal (no need to rush). After giving the copper clad a minute to cool off I throw it in some lukewarm water and wait until I can easily peel off the paper.<br />
<br />
== Observations/Tips ==<br />
<br />
* Excess heat causes the toner to "boil", you'll end up with bubbly-looking traces which are useless.<br />
* Excess pressure causes the traces to "fan out" (ie. become fatter). This isn't always a problem, it depends on the distance between your traces.<br />
* A clean copper clad board is a must! A bit of steel wool and some lacquer thinner does a great job.<br />
* Throwing a hot board in cold water yields worse results than if you wait a minute or two for the board to cool down before dunking it.<br />
* Small breaks in traces can easily be repaired with a thin sharpie permanent marker.</div>Nikosapihttp://nikosapi.org/w/index.php?title=MSP430_HD44780_Controller_Software&diff=73MSP430 HD44780 Controller Software2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>The following page is dedicated to hosting a simple interface for the [http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf HD44780 display controller] written in C for the TI MSP430 family of microcontrollers. Specifically, this library was written with the MSP430 Launchpad (msp430g2231) in mind but it should work with any microcontroller in that family without modification.<br />
<br />
== Get The Code ==<br />
Download the code (including a pre-compiled example) here: [http://nikosapi.org/software/msp430-hd44780.tar.bz2 msp430-hd44780.tar.bz2]<br />
<br />
== Requirements ==<br />
<br />
# The microntroller's main clock should be running at 16MHz or less (the library is designed with 16MHz as the wosrt-case clock frequency). <br />
# You must use the controller in 4-bit mode, which means the least significant data lines don't get connected. This is a bit slower, but makes better use of the limited pins on the smaller MSP430 devices.<br />
# All 7 lines coming from the display controller (DB7-DB4, RS, RW, and EN) must be connected to the same port on the microcontroller.<br />
# The four data lines must be connected in order, in a contiguous set of pins. For example: DB7=P1.6, DB6=P1.5, DB5=P1.4, DB4=P1.3<br />
# The following must be #define'd in your code in order to use this library (do this in hd44780_config.h):<br />
#* HD44780_PORT: The OUT register of the port that the display is connected to (eg. P1OUT)<br />
#* HD44780_PORTDIR: The port's DIR register (eg. P1DIR)<br />
#* HD44780_PORTIN: The port's IN register (eg. P1IN)<br />
#* HD44780_RS: The pin that's connected to RS (eg. BIT0)<br />
#* HD44780_RW: The pin that's connected to RW (eg. BIT1)<br />
#* HD44780_EN: The pin that's connected to EN (eg. BIT2)<br />
#* HD44780_BUSY: The pin that's connected to DB7 (eg. for P1.7, use BIT7)<br />
#* HD44780_DATA: A mask containing all the data lines, for example: If DB7 is connected to P1.7, use (BIT7|BIT6|BIT5|BIT4)<br />
#* HD44780_DATA_OFFSET: The data lines' offset relative to DB0 (eg. for the example shown in HD44780_DATA, this must be set to 4)<br />
<br />
== List of Functions in hd44780.h ==<br />
This library only has 5 functions, but even so you should be able to do almost any operation that the controller supports.<br />
<br />
==== void hd44780_init(uint8_t); ====<br />
HD44780 initialization routine, must be run before any other hd44780_* functions. This function clears the display so there's no need to do so after calling this function.<br />
<br />
The argument sets the number of lines on your display. It can be one of two values, either HD44780_CMD_1_LINE_MODE or HD44780_CMD_2_LINE_MODE. Once initialized, the HD44780_CMD_*_LINE_MODE commands should _not_ be issued again (as specified in the datasheet). */<br />
<br />
==== void hd44780_send_command(uint8_t); ====<br />
Send the HD44780 a command. Commands are #define'd above (HD44780_CMD_*).<br />
Note: There is no need to check the busy flag before sending commands, this is done for you in the function.<br />
<br />
==== void hd44780_write_char(char); ====<br />
Write a single character to the display. <br />
Note: This function waits for the busy flag for you.<br />
<br />
==== void hd44780_write_string(char*); ====<br />
Write a null-terminated string of characters to the display. This function simply loops over your string writing one character at a time using hd44780_write_char().<br />
<br />
==== uint8_t hd44780_get_busy_flag(); ====<br />
Returns the busy flag as reported by the HD44780.<br />
Returns either 0x80 (busy) or 0x00 (not busy).</div>Nikosapihttp://nikosapi.org/w/index.php?title=MazdaSpoof_-_A_Tape_Deck_Emulator&diff=71MazdaSpoof - A Tape Deck Emulator2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>In order to use the tape deck audio input a device is needed which can pretend to be the tape deck by correctly answering the base unit commands. Furthermore, it is also possible to react to the base unit commands to control an external device using the radio's controls.<br />
<br />
MazdaSpoof attempts to do this. In it's most basic form it simply pretends to be a tape deck which allows use of the tape deck audio input. It also fakes responses for all the available buttons on the head unit. This allows us to do fancy things like basic iPod integration.<br />
<br />
<br />
==Software==<br />
The software is written in C for the ATtiny45, it can be ported to other AVRs without too much trouble. The code is licensed under GPL (version 3), so have fun with it!<br />
<br />
Latest Code (version 1.0):<br />
* Archive of source code and schematics: [http://nikosapi.org/hardware/mazda-radio/mazdaspoof-1.0.tar.bz2 mazdaspoof-1.0.tar.bz2]<br />
* Binary image in Intel Hex format: [http://nikosapi.org/hardware/mazda-radio/mazdaspoof-1.0/src/spoof.hex spoof.hex]<br />
* Browse the source: [http://nikosapi.org/hardware/mazda-radio/mazdaspoof/src/ ./mazdaspoof/src/]<br />
<br />
==Circuitry==<br />
===Tape Deck Emulator===<br />
[[File:Mazdaspoof.png]]<br />
<br />
This diagram includes extra circuitry for iPod integration, if you don't need iPod integration you can do the following:<br />
* Connect pin 7 (PB2) of the ATtiny45 to ground (omit R2 and R3)<br />
* Leave pin 6 (PB1) of the ATtiny45 floating (omit R4 and R5)<br />
* Connect the input of regulator (78L05) to ACC (switched 12V) instead of B+ (constant 12V)<br />
* Use 10K input resistors for the left/right audio inputs<br />
<br />
<br />
===iPod Dock Connector Connections===<br />
[[File:Mazda-ipod-dock.png]]<br />
<br />
<br />
===Switched 5V Power Supply===<br />
To charge an iPod you'll need a suitable power supply, the 78L05 used in the [[#Tape Deck Emulator|Tape Deck Emulator]] can't supply enough current. Much simpler power supplies can be built (think relays) but I went with this because it'll fit nicely in the void under the head unit.<br />
[[File:Mazda-Ipod-ps.png]]<br />
<br />
Notes:<br />
*'''Important:''' When dropping 7-9V at 500mA across a 7805 it's will get '''very''' hot. Use a big heat-sink (at least 2x2cm of metal) to prevent overheating.<br />
*The 2SA715 might be hard to find, but any large PNP transistor should work (like the TIP30C).<br />
<br />
<br />
==Built Circuit Pictures==<br />
The [[#Tape Deck Emulator|tape deck emulator]]:<br />
<br />
[[File:Mazda-spoof-board.jpg]]<br />
<br />
<br />
The [[#Switched 5V Power Supply|switched iPod power supply]]:<br />
<br />
[[File:Mazdaspoof-ipod-ps.jpg]]<br />
<br />
<br />
The two boards installed in the radio:<br />
<br />
[[File:Mazdaspoof-installed.jpg]]<br />
<br />
{{MazdaRadioSeeAlso}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Connector_Documentation&diff=69Mazda Entertainment System - Connector Documentation2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>==Peripheral Connector==<br />
[[File:Mazda-peripheral-connector.png]]<br />
<br />
{|border="1"<br />
!Pin<br />
!Function<br />
|-<br />
|1<br />
|Bus data (+5v TTL)<br />
|-<br />
|2<br />
|Bus ground<br />
|-<br />
|3<br />
|B+ Power (Constant ~12V)<br />
|-<br />
|4<br />
|B+ Power (Constant ~12V)<br />
|-<br />
|5<br />
|Power Ground<br />
|-<br />
|6<br />
|Power Ground<br />
|-<br />
|7<br />
|Eject<br />
|-<br />
|8<br />
|N/C<br />
|-<br />
|9<br />
|Text - Cl(ock?)<br />
|-<br />
|10<br />
|Text - Do(?)<br />
|-<br />
|11<br />
|Accessory Power (Switched ~12V)<br />
|-<br />
|12<br />
|SMUTE<br />
|-<br />
|13<br />
|Audio: Right channel<br />
|-<br />
|14<br />
|Audio: Ground<br />
|-<br />
|15<br />
|Audio: Left channel<br />
|}<br />
<br />
<br />
{{MazdaRadioSeeAlso}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Radio_Bus_Dumps&diff=67Mazda Radio Bus Dumps2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Mazda Entertainment System - Sample Bus Data Dumps]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Bus_Protocol_Documentation&diff=65Mazda Entertainment System - Bus Protocol Documentation2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Mazda Entertainment System - Bus Protocol]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System&diff=63Mazda Entertainment System2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[File:Mazda-radio-front.jpg|250px|thumb|Radio from a 2002 Protege5]]<br />
Late model Proteges and early Mazda 3s all used the same head unit with different plastic trim. The electronics are all the same, and are more sophisticated than a traditional stock head unit. Each peripheral that's attached to the radio communicates on a shared bus, this page serves to document the bus protocol.<br />
<br />
==Acknowledgements==<br />
For the time being I only have Mr. David O'Shea to thank for his original work on decoding most of the messages sent over the radio's bus. His work can be found [http://mazda.davidoshea.homelinux.net/radio/ here] ([http://nikosapi.org/hardware/mazda-radio/davidoshea-archive/radio/ archive]), without it I don't know if I would have ever gotten this far. I've taken the liberty to re-post some of his work on this wiki so his information can grow.<br />
<br />
==Documentation==<br />
Here's what I've got so far, Enjoy!<br />
<br />
{{MazdaRadio}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entrainment_System_-_Capturing_Bus_Data&diff=61Mazda Entrainment System - Capturing Bus Data2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Mazda Entertainment System - Capturing Bus Data]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Capturing_Bus_Data&diff=59Mazda Entertainment System - Capturing Bus Data2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>Here are two ways to get data off the bus. The first is useful for bulk transfer and the second is useful for examining signal timing.<br />
<br />
==Using A Decoder==<br />
The easiest way to view data on the bus is to use an external decoder. I wrote some software for an ATmega168 that captures data off the bus and sends it (one command at a time) out of it's USART. It can then be connected to a computer where the data can be presented with the use of a simple python script.<br />
<br />
This simple circuit is all you need: [[File:MazdaDump.png]]<br />
<br />
====Related files====<br />
* Source code for ATmega168: [http://nikosapi.org/hardware/mazda-radio/serialdump/dump.c dump.c]<br />
* Software for displaying the data: [http://nikosapi.org/hardware/mazda-radio/serialdump/ffdump.py ffdump.py]<br />
* All the related files in an archive: [http://nikosapi.org/hardware/mazda-radio/serialdump.tar.bz2 serialdump.tar.bz2]<br />
<br />
<br />
==Capturing Raw Data==<br />
The easiest way to capture data off the message bus is to connect the bus directly to a parallel port and sample the port roughly every 0.1ms (more than fast enough to capture even the shortest messages). This method also allows you to accurately measure message timing.<br />
<br />
One problem I had was that my parallel port's input resistance was too low which would cause the bus to idle at around 4V instead of 5V. That small voltage drop was enough to prevent the radio from sending messages so I had to build a small non-inverting amplifier. The schematic for that amplifier is available here: [[File:Mazda-radio-bus-amp.png]]<br />
<br />
====Related files====<br />
* Code used to sample the parallel port: [http://nikosapi.org/hardware/mazda-radio/sample/sample.c sample.c]<br />
<br />
==See Also==<br />
{{MazdaRadio}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Radio&diff=57Mazda Radio2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Mazda Entertainment System]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Sample_Bus_Data_Dumps&diff=55Mazda Entertainment System - Sample Bus Data Dumps2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>The following are a bunch of dumps from the data bus to help people understand how the protocol works. <br />
<br><br><br />
<br />
The dump format is:<pre style="font-size:larger">timecode command</pre><br />
* timecode is [seconds in epoch].[fraction of a second]<br />
* command is a hexadecimal representation of the data on the bus<br />
<br><br />
----<br />
'''NOTE:''' The timestamps are horribly wrong. You'll notice that some commands occur in less than 1ms which is impossible. I'm guessing that those closely-spaced packs of data were held up in some kernel buffer before being read. That explains why they appear to have happened so close together. The timestamps are still useful for seeing how the commands are sent in bursts but please do not rely on them.<br />
----<br />
<br><br />
<br />
A list of events is provided at the top of each dump to help the reader know when a specific action was taken and what commands were sent because of that action.<br />
<br />
==Base Unit==<br />
===Initialization (no peripherals connected)===<br />
<pre style="font-size:larger">Events:<br />
1281462287.476655 - Radio is powered-on<br />
<br />
<br />
1281462287.476655 38C*<br />
1281462287.476734 089<br />
1281462287.476770 18A<br />
1281462287.476801 68F<br />
1281462287.476831 58E<br />
1281462287.476862 780<br />
1281462288.040639 38C<br />
1281462288.040717 089<br />
1281462288.040752 18A<br />
1281462288.040784 68F<br />
1281462288.040814 58E<br />
1281462288.040845 780<br />
1281462288.656645 38C<br />
1281462288.656726 089<br />
1281462288.656762 18A<br />
1281462288.656794 68F<br />
1281462288.656826 58E<br />
1281462288.656858 780<br />
1281462289.272641 38C<br />
1281462289.272716 089<br />
1281462289.272752 18A<br />
1281462289.272785 68F<br />
1281462289.272817 58E<br />
1281462289.272849 780</pre><br />
<br />
==CD Deck==<br />
===Initialization and playback===<br />
<pre style="font-size:larger">Events:<br />
1281461783.680635 - Radio is powered-on (with disk in CD Deck)<br />
1281461796.240642 - "CD" button is pressed<br />
1281461818.376646 - "POWER" button is pressed (base unit now in standby mode)<br />
1281461831.444645 - "POWER" button is pressed (base unit wakes up)<br />
<br />
<br />
1281461783.680635 38C*<br />
1281461783.680714 089<br />
1281461783.680749 B813<br />
1281461783.680779 18A<br />
1281461784.112651 BBA0006000C1<br />
1281461784.112740 68F<br />
1281461784.112775 58E<br />
1281461784.112807 780<br />
1281461784.112838 39B<br />
1281461784.320651 BB91000000C5<br />
1281461784.320738 089<br />
1281461785.124654 BB91000000C5<br />
1281461785.124744 18A<br />
1281461785.124780 68F<br />
1281461785.124812 58E<br />
1281461785.124843 780<br />
1281461785.124874 089<br />
1281461785.124905 18A<br />
1281461785.124935 68F<br />
1281461785.124965 58E<br />
1281461785.124994 780<br />
1281461785.604641 089<br />
1281461785.604722 18A<br />
1281461785.604759 68F<br />
1281461785.604790 58E<br />
1281461785.604820 780<br />
1281461786.068638 39B<br />
1281461786.228857 BB91000000C5<br />
1281461786.468658 BD1000000000008000<br />
1281461786.648654 BC00000000008<br />
1281461786.864658 B9000010000000C0<br />
1281461796.240642 39B*<br />
1281461796.400648 BB91000000C5<br />
1281461796.640654 BD1000000000008000<br />
1281461796.808649 BC00000000008<br />
1281461797.120650 B9000010000000C0<br />
1281461797.120745 3110121<br />
1281461797.328653 B940001000000017<br />
1281461797.540655 B940001000000017<br />
1281461800.068653 B940101000000018<br />
1281461800.244651 BC101104138F8<br />
1281461800.460650 B950101000000017<br />
1281461800.712651 B940101000000018<br />
1281461800.924659 B940101000000018<br />
1281461801.700656 B940101000100017<br />
1281461802.696652 B940101000200016<br />
1281461803.692652 B940101000300015<br />
1281461804.688653 B940101000400014<br />
1281461805.684656 B940101000500013<br />
1281461806.684659 B940101000600012<br />
1281461807.680655 B940101000700011<br />
1281461808.676655 B940101000800010<br />
1281461809.672654 B94010100090001F<br />
1281461810.672651 B940101001000017<br />
1281461811.668671 B940101001100018<br />
1281461812.664655 B940101001200015<br />
1281461813.660648 B940101001300016<br />
1281461814.656657 B940101001400013<br />
1281461815.652659 B940101001500014<br />
1281461816.652653 B940101001600011<br />
1281461817.648656 B940101001700012<br />
1281461818.376646 3116028*<br />
1281461818.500642 3116028<br />
1281461819.128650 B9001010017000C9<br />
1281461831.444645 39B*<br />
1281461831.600654 BB91010000C6<br />
1281461831.840655 BD1000000000008000<br />
1281461832.012655 BC101104138F8<br />
1281461832.320656 B9001010017000C9<br />
1281461832.320752 3110121<br />
1281461832.528650 B940101001700012<br />
1281461832.740647 B950101001700011<br />
1281461834.568659 B940101001700012<br />
1281461835.224646 B94010100180001F<br />
1281461836.220655 B940101001900010<br />
1281461837.217076 B940101002000016<br />
1281461838.212656 B940101002100015<br />
1281461839.208654 B940101002200018<br />
1281461840.208650 B940101002300017<br />
1281461841.204652 B940101002400012<br />
1281461842.200652 B940101002500011<br />
1281461843.196657 B940101002600014<br />
1281461844.192654 B940101002700013<br />
1281461845.188657 B94010100280001E<br />
1281461846.184655 B94010100290001D<br />
1281461847.180730 B940101003000015</pre><br />
<br />
===Seeking===<br />
<pre style="font-size:larger">Events:<br />
1281462697.556635 - SEEK "up" button pressed/released<br />
1281462699.692641 - SEEK "up" button pressed/released<br />
1281462704.168635 - SEEK "down" button pressed/released<br />
1281462709.928643 - Skip forward (>>) button pressed<br />
1281462712.380741 - Skip forward (>>) button released<br />
1281462715.704642 - Skip backward (<<) button pressed<br />
1281462717.312736 - Skip backward (<<) button released<br />
<br />
<br />
1281462694.704647 B94010100090001F<br />
1281462695.700649 B940101001000017<br />
1281462696.696646 B940101001100018<br />
1281462697.556635 31300213*<br />
1281462697.760644 B940101001200015<br />
1281462697.972650 B950201000000016<br />
1281462698.368645 B940201000000015<br />
1281462698.580647 B940201000000015<br />
1281462699.364645 B940201000100016<br />
1281462699.692641 31300314*<br />
1281462699.936648 B950301000000015<br />
1281462700.312647 B940301000000016<br />
1281462700.524647 B940301000000016<br />
1281462701.308646 B940301000100015<br />
1281462702.304646 B940301000200018<br />
1281462703.304646 B940301000300017<br />
1281462704.168635 31300314*<br />
1281462704.376645 B940301000400012<br />
1281462704.588648 B950301000000015<br />
1281462704.800646 B940301000000016<br />
1281462705.008647 B940301000000016<br />
1281462705.736645 B940301000100015<br />
1281462706.732647 B940301000200018<br />
1281462707.728645 B940301000300017<br />
1281462708.724646 B940301000400012<br />
1281462709.720653 B940301000500011<br />
1281462709.928643 3110426*<br />
1281462710.172643 B960301000500013<br />
1281462710.384645 B960301000800010<br />
1281462710.596645 B960301001200015<br />
1281462710.804644 B960301001500014<br />
1281462711.016664 B96030100180001F<br />
1281462711.228650 B960301002100015<br />
1281462711.440648 B960301002500011<br />
1281462711.652650 B96030100280001E<br />
1281462711.868647 B960301003100016<br />
1281462712.080649 B960301003300018<br />
1281462712.380648 B960301003600013<br />
1281462712.380741 3110121*<br />
1281462712.592648 B940301004100011<br />
1281462712.804645 B940301004300013<br />
1281462713.012648 B940301004300013<br />
1281462713.240650 B940301004400016<br />
1281462714.236646 B940301004500015<br />
1281462715.232647 B940301004600018<br />
1281462715.704642 311082A*<br />
1281462715.952648 B970301004600015<br />
1281462716.164846 B970301004300012<br />
1281462716.372646 B970301004000013<br />
1281462716.588647 B970301003600014<br />
1281462716.800644 B970301003300017<br />
1281462717.012652 B970301003000016<br />
1281462717.312646 B970301002700014<br />
1281462717.312736 3110121*<br />
1281462717.520646 B940301002300015<br />
1281462717.732647 B940301002300015<br />
1281462717.940652 B940301002300015<br />
1281462718.152645 B940301002400014</pre><br />
<br />
===Random/Repeat===<br />
<pre style="font-size:larger">Events:<br />
1281467080.200636 - RPT button is pressed/released<br />
1281467084.040637 - RPT button is pressed/released<br />
1281467086.080638 - RDM button is pressed/released<br />
1281467087.696638 - RDM button is pressed/released<br />
<br />
<br />
1281467079.372645 B940101001300016<br />
1281467080.200636 31440003*<br />
1281467080.412645 B940101001400013<br />
1281467080.624647 B940101001440017<br />
1281467081.372644 B940101001540018<br />
1281467082.360644 B940101001640015<br />
1281467083.364650 B940101001740016<br />
1281467084.040637 31400007*<br />
1281467084.284645 B940101001700012<br />
1281467084.496647 B94010100180001F<br />
1281467085.352644 B940101001900010<br />
1281467086.080638 31400052*<br />
1281467086.324646 B950201000002018<br />
1281467086.824644 B940201000002017<br />
1281467087.036649 B940201000002017<br />
1281467087.696638 31400007*<br />
1281467087.908650 B940201000102018<br />
1281467088.120648 B940201000100016</pre><br />
<br />
===Load/Eject===<br />
<pre style="font-size:larger">Events:<br />
1281470880.932653 - Disk is loaded<br />
1281470890.384647 - Eject button pressed<br />
<br />
<br />
1281470880.932653 BD1000000000008000*<br />
1281470881.088649 BBB1006000C1<br />
1281470882.536648 BB91000000C5<br />
1281470882.536736 39B<br />
1281470882.696656 BB910000001A<br />
1281470882.932653 BD1000000000008000<br />
1281470883.112655 BC00000000008<br />
1281470883.420648 B9000010000000C0<br />
1281470883.420745 3110121<br />
1281470883.632653 B940101000000018<br />
1281470886.252653 BC101104138F8<br />
1281470886.468654 B940101000000018<br />
1281470886.680830 B940101000000018<br />
1281470887.236778 B940101000100017<br />
1281470888.232653 B940101000200016<br />
1281470889.228654 B940101000300015<br />
1281470890.224647 B940101000400014<br />
1281470890.384647 BBA0008000CF*<br />
1281470890.488647 3116028<br />
1281470890.788658 B9000010000000C0<br />
1281470890.788756 3116028<br />
1281470891.000674 B9000010000000C0<br />
1281470891.156651 BBA0008000CF<br />
1281470891.456652 BBA0008000CF<br />
1281470891.756649 BBA0008000CF<br />
1281470892.808649 BBA0006000C1<br />
1281470893.112649 BBA0006000C1<br />
1281470893.364653 B9000010000000C0</pre><br />
<br />
==Tape Deck==<br />
===Initialization and playback===<br />
<pre style="font-size:larger">Events:<br />
1281456004.300642 - Radio is powered-on (cassette in tape deck)<br />
1281456011.724645 - "MD/TAPE" button is pressed<br />
1281456026.028646 - "POWER" button is pressed (base unit now in standby mode)<br />
1281456036.192641 - "POWER" button is pressed (base unit wakes up)<br />
<br />
<br />
1281456004.300642 38C*<br />
1281456004.508650 089<br />
1281456004.508729 8812<br />
1281456004.508763 18A<br />
1281456004.900642 8B90400C3<br />
1281456004.900724 68F<br />
1281456004.900759 58E<br />
1281456004.900790 780<br />
1281456004.900821 09A<br />
1281456005.788648 8B90400C3<br />
1281456005.788737 38C<br />
1281456005.788774 890CE<br />
1281456005.788808 18A<br />
1281456005.788841 68F<br />
1281456005.788872 58E<br />
1281456005.788903 780<br />
1281456005.788934 38C<br />
1281456005.788964 18A<br />
1281456005.788994 68F<br />
1281456005.789024 58E<br />
1281456005.789054 780<br />
1281456006.400638 38C<br />
1281456006.400715 18A<br />
1281456006.400751 68F<br />
1281456006.400782 58E<br />
1281456006.400812 780<br />
1281456006.868639 09A<br />
1281456007.072648 8B90400C3<br />
1281456007.072737 890CE<br />
1281456011.724645 09A*<br />
1281456011.929062 8B90400C3<br />
1281456011.929150 890CE<br />
1281456012.340640 0110124<br />
1281456012.500636 89415<br />
1281456013.560651 8B9040010<br />
1281456014.512638 89415<br />
1281456015.568647 8B9040010<br />
1281456016.520644 89415<br />
1281456017.580643 8B9040010<br />
1281456018.532651 89415<br />
1281456019.588649 8B9040010<br />
1281456020.540645 89415<br />
1281456021.600653 8B9040010<br />
1281456022.552645 89415<br />
1281456023.608652 8B9040010<br />
1281456024.560640 89415<br />
1281456025.620649 8B9040010<br />
1281456026.028646 0116025*<br />
1281456027.244643 890CE<br />
1281456036.192641 09A*<br />
1281456036.392646 8B90400C3<br />
1281456036.392735 890CE<br />
1281456036.796641 0110124<br />
1281456036.952646 89415<br />
1281456037.956643 89415<br />
1281456039.016982 8B9040010<br />
1281456039.968647 89415<br />
1281456041.024647 8B9040010<br />
1281456041.976641 89415<br />
1281456043.036644 8B9040010<br />
1281456043.988641 89415<br />
1281456045.044652 8B9040010<br />
1281456045.996641 89415<br />
1281456047.052660 8B9040010<br />
1281456048.005066 89415</pre><br />
<br />
===Seeking===<br />
<pre style="font-size:larger">Events:<br />
1281468749.168637 - SEEK up button pressed/released (high-speed fast-forward)<br />
1281468754.880642 - SEEK up button pressed/released (high-speed fast-forward)<br />
1281468756.464639 - SEEK down button pressed/released (high-speed rewind)<br />
1281468760.348767 - SEEK down button pressed/released (high-speed rewind)<br />
1281468763.612637 - Fast-forward (>>) button pressed/released<br />
1281468767.812638 - Rewind (<<) button pressed/released<br />
1281468772.620636 - Rewind (<<) button pressed/released<br />
<br />
<br />
1281468749.168637 0141005*<br />
1281468749.328635 89516<br />
1281468749.460641 8B924011D<br />
1281468750.456641 8B924011D<br />
1281468751.408636 89516<br />
1281468752.468641 8B924011D<br />
1281468753.420634 89516<br />
1281468754.476641 8B924011D<br />
1281468754.880642 0140006*<br />
1281468755.168640 8B9040010<br />
1281468755.168723 89415<br />
1281468756.172635 89415<br />
1281468756.464639 0142008*<br />
1281468756.624638 89516<br />
1281468756.756645 8B934011E<br />
1281468757.752638 8B934011E<br />
1281468758.704636 89516<br />
1281468759.764642 8B934011E<br />
1281468760.348767 0140006*<br />
1281468760.636639 8B9040010<br />
1281468760.636725 89415<br />
1281468761.640637 89415<br />
1281468762.696639 8B9040010<br />
1281468763.612637 0110427*<br />
1281468763.900641 8B9040010<br />
1281468763.900725 89617<br />
1281468764.960640 8B9040010<br />
1281468765.912637 89617<br />
1281468766.968640 8B9040010<br />
1281468767.812638 011082B<br />
1281468767.812720 89718*<br />
1281468768.816635 89718<br />
1281468769.872639 8B9040010<br />
1281468770.824633 89718<br />
1281468771.884640 8B9040010<br />
1281468772.620636 0110124*<br />
1281468772.784634 89415<br />
1281468773.788635 89415<br />
1281468774.848638 8B9040010<br />
1281468775.800635 89415<br />
1281468776.856674 8B9040010<br />
1281468777.808635 89415</pre><br />
<br />
===Random/Repeat/Dolby===<br />
<pre style="font-size:larger">Events:<br />
1281469266.648728 - RPT button pressed/released<br />
1281469269.484645 - RPT button pressed/released<br />
1281469272.012650 - RDM button pressed/released<br />
1281469276.436642 - RDM button pressed/released<br />
1281469279.792652 - Dolby noise reduction button pressed/released<br />
1281469283.036649 - Dolby noise reduction button pressed/released<br />
<br />
<br />
1281469264.544694 89415<br />
1281469265.600647 8B9040010<br />
1281469266.648645 89415<br />
1281469266.648728 0140105*<br />
1281469266.772648 8B905001F<br />
1281469267.612651 8B905001F<br />
1281469268.564638 89415<br />
1281469269.484645 0140006*<br />
1281469269.604652 8B9040010<br />
1281469270.608650 8B9040010<br />
1281469271.560640 89415<br />
1281469272.012650 0140208*<br />
1281469272.224651 8B906001E<br />
1281469273.228647 8B906001E<br />
1281469274.180646 89415<br />
1281469275.240648 8B906001E<br />
1281469276.192644 89415<br />
1281469276.436642 0140208*<br />
1281469276.648653 8B9040010<br />
1281469277.652649 8B9040010<br />
1281469278.604641 89415<br />
1281469279.660646 8B9040010<br />
1281469279.792652 8B904101F*<br />
1281469280.744638 89415<br />
1281469281.800650 8B904101F<br />
1281469282.752642 89415<br />
1281469283.036649 8B9040010*<br />
1281469284.044647 8B9040010<br />
1281469284.996674 89415<br />
1281469286.052645 8B9040010</pre><br />
<br />
===Load/Eject===<br />
<pre style="font-size:larger">Events:<br />
1281469649.812643 - Tape is loaded<br />
1281469656.644649 - Eject button pressed<br />
<br />
<br />
1281469649.812643 8BB0400C1*<br />
1281469650.164844 09A<br />
1281469650.364646 8B90400C3<br />
1281469650.364738 890CE<br />
1281469650.840641 0110124<br />
1281469650.840730 89415<br />
1281469651.420645 8B9040010<br />
1281469652.372641 89415<br />
1281469653.428647 8B9040010<br />
1281469654.380642 89415<br />
1281469655.440644 8B9040010<br />
1281469656.392644 89415<br />
1281469656.644649 8BA40004A*<br />
1281469656.944648 8BA40004A<br />
1281469657.248644 8BA40004A<br />
1281469657.548645 8BA40004A<br />
1281469661.176643 8BA0000C6</pre><br />
<br />
==Tape Deck and CD Deck==<br />
===Initialization (no disk in CD Deck, no cassette in Tape Deck)===<br />
<pre style="font-size:larger">Events:<br />
1281469976.556674 - Radio is powered-on<br />
<br />
<br />
1281469976.556674 38C*<br />
1281469976.556758 089<br />
1281469976.556795 B813<br />
1281469976.556827 8812<br />
1281469976.556859 18A<br />
1281469976.708648 BBA0006000C1<br />
1281469977.404645 8B90000C7<br />
1281469977.404733 68F<br />
1281469977.404769 58E<br />
1281469977.404802 780<br />
1281469977.404836 18A<br />
1281469977.404868 68F<br />
1281469977.404900 58E<br />
1281469977.404931 780<br />
1281469977.404963 39B<br />
1281469977.608646 BBA0006000C1<br />
1281469977.608737 18A<br />
1281469977.880651 BD0000000000000007<br />
1281469977.880759 68F<br />
1281469978.088709 BC00000000008<br />
1281469978.088795 58E<br />
1281469978.636658 B9000010000000C0<br />
1281469978.636750 780<br />
1281469978.636786 18A<br />
1281469978.636819 68F<br />
1281469978.636851 58E<br />
1281469978.636885 780<br />
1281469979.392637 39B<br />
1281469979.544653 BBA0006000C1<br />
1281469979.784656 BD0000000000000007<br />
1281469979.966890 BC00000000008<br />
1281469980.220652 B9000010000000C0<br />
1281469980.220746 09A<br />
1281469980.420646 8B90000C7<br />
1281469980.420734 890CE<br />
1281469981.280650 BBA0006000C1</pre><br />
<br />
===Initialization (with disk in the CD Deck, and a cassette in the Tape Deck)===<br />
<pre style="font-size:larger">Events:<br />
1281470594.792638 - Radio is powered-on<br />
<br />
<br />
1281470594.792638 38C*<br />
1281470594.792721 089<br />
1281470594.792758 B813<br />
1281470594.792791 8812<br />
1281470594.792825 18A<br />
1281470595.216648 8B90400C3<br />
1281470595.216736 68F<br />
1281470595.216772 BBA0<br />
1281470595.216806 58E<br />
1281470595.216839 780<br />
1281470595.216872 18A<br />
1281470595.640713 BB91000000C5<br />
1281470595.640800 68F<br />
1281470595.640836 58E<br />
1281470595.640869 780<br />
1281470595.640903 39B<br />
1281470595.848644 BB91000000C5<br />
1281470595.848728 18A<br />
1281470596.120766 BD1000000000008000<br />
1281470596.120865 68F<br />
1281470596.328656 BC00000000008<br />
1281470596.328751 58E<br />
1281470596.876848 B9000010000000C0<br />
1281470596.876944 780<br />
1281470596.876980 18A<br />
1281470596.877014 68F<br />
1281470596.877047 58E<br />
1281470596.877079 780<br />
1281470597.628638 39B<br />
1281470597.784649 BB91000000C5<br />
1281470598.024853 BD1000000000008000<br />
1281470598.204658 BC00000000008<br />
1281470598.460651 B9000010000000C0<br />
1281470598.460740 09A<br />
1281470598.664645 8B90400C3<br />
1281470598.664731 890CE</pre><br />
<br />
<br />
{{MazdaRadioSeeAlso}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=Mazda_Entertainment_System_-_Bus_Protocol&diff=53Mazda Entertainment System - Bus Protocol2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>The message bus on Mazda head units use a simple communication protocol. The bus idles at 5V and is pulled down to 0V to send data pulses. Logical ones and zeros are defined by how long the bus is pulled down, see [[#Timing|Timing]] for details. The protocol uses nibbles instead of bytes; most messages don't line up to a byte boundary (for instance, the shortest message is 12 bits).<br />
<br />
==Message Protocol==<br />
<br />
{|border="1"<br />
! Purpose<br />
! Length (nibbles)<br />
! Notes<br />
|-<br />
|Destination Module<br />
|1<br />
|<br />
0x0 = Tape deck<br><br />
0x1 = (Unknown)<br><br />
0x3 = CD deck<br><br />
0x5 = CD changer (external)<br><br />
0x6 = CD changer (upper module)<br><br />
0x7 = MD deck<br><br />
0x8 = Base unit<br><br />
<br />
If the first bit of this nibble is 1, the command is destined for the base unit and the remaining 3 bits let the base unit know which module it came from. Therefore if the CD deck wants to send a message to the base unit this nibble will be 0x3 + 0x8 which is 0xB (or b1011). If the first bit is 0, then the message originates from the base unit.<br />
|-<br />
|Command<br />
|1<br />
|<br />
|- <br />
|Message data<br />
|0..n<br />
|Message specific<br />
|-<br />
|Checksum<br />
|1<br />
|<br />
XOR all the nibbles, add 1 and ignore any overflow.<br><br />
Example: If the message is 0x311012, the checksum calculated as follows: (3^1^1^0^1^2 + 1) & 0xF = 1<br />
|}<br />
<br />
<br />
===Messages Sent By The Base Unit===<br />
{| border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
|-<br />
|0x1<br />
|4 or 5<br />
|Control<br />
|See [[#Control Command Data Format|Control Command Data Format]]<br />
|-<br />
|0x8<br />
|0<br />
|Anybody home?<br />
|No data<br />
|-<br />
|0x9<br />
|0<br />
|Wake up<br />
|No data<br />
|}<br />
<br />
====Control Command Data Format====<br />
{| border="1"<br />
!Subcommand<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|1<br />
|Playback control<br />
|XX2<br />
|<br />
XX is:<br />
*0x01 for play<br />
*0x04 for ff<br />
*0x08 for rew<br />
*0x60 for stop<br />
|-<br />
|0x3<br />
|Seek to track<br />
|0KK1<br />
|KK is the (BCD encoded) track to seek to<br />
|-<br />
|0x4<br />
|Set configuration data (CD Deck)<br />
|RR00<br />
|RR is:<br />
*0x02 for random mode<br />
*0x08 for "SCAN" mode (plays 10s of each song)<br />
*0x40 for repeat mode<br />
|-<br />
|0x4<br />
|Set configuration data (Tape Deck)<br />
|RR0<br />
|RR is:<br />
*0x01 for repeat mode<br />
*0x02 for random mode<br />
*0x10 for fast fast-forwarding (when the up-seek button is pressed)<br />
*0x20 for fast rewinding (when the down-seek button is pressed)<br />
|}<br />
<br />
<br />
===Messages Sent by the CD Deck===<br />
{|border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|0x8<br />
|1<br />
|Wakeup notification<br />
|0x1<br />
|Sent after connecting power<br />
|-<br />
|0x9<br />
|13<br />
|Status<br />
|NPPQRSSTTWXYZ<br />
|N is:<br />
* 0x0 - stopped<br />
* 0x4 - playing<br />
* 0x5 - seeking<br />
* 0x6 - fast forwarding<br />
* 0x7 - rewinding<br />
<br />
PP is the current track number (BCD encoded)<br><br />
QR is unknown but suspected to be current CD number in a CD changer (always 0x01)<br><br />
SS is the current position in minutes (BCD encoded)<br><br />
TT is the current position in seconds (BCD encoded)<br><br />
W is 0x4 when repeat is on, 0x0 otherwise<br><br />
X is 0x2 when random is on, 0x0 otherwise<br><br />
Y is unknown (always seems to be 0x0)<br><br />
Z is unknown (always either 0x1 or 0xC)<br />
|-<br />
|0xB<br />
|9<br />
|Hardware status<br />
|various<br />
|<br />
0x910000001 - sent when the device enters playback mode<br><br />
0x91000000C - disk present (sent multiple times during startup if disk is present)<br><br />
0x91XX0000C - used when the radio is woken up, XX is current track number (BCD encoded)<br><br />
0xA0006000C - no disk present (always sent once during startup, after 0x8 command)<br><br />
0xA0008000C - ejecting<br><br />
0xB1006000C - disk being inserted<br />
|-<br />
|0xC<br />
|10<br />
|Disk info<br />
|STTWWXXYYZ<br />
|<br />
S is 0x0 for no CD, 0x1 for CD in drive<br><br />
TT is the BCD encoding of the first track number on the CD<br><br />
WW is the BCD encoding of the last track number on the CD<br><br />
XX is the BCD encoding of the total playing minutes<br><br />
YY is the BCD encoding of the total playing seconds<br><br />
Z seems to be 0x0 for no CD, 0xF otherwise<br />
|-<br />
|0xD<br />
|15<br />
|Unknown<br />
|<br />
0x000000000000000<br><br />
0x100000000000800<br />
|This may have something to do with whether or not a CD is present. The first format (0x000...) only appears when there is no CD in the drive and the second format (0x100...) only appears when there is a CD in the drive.<br />
|}<br />
<br />
<br />
===Messages Sent by the Tape Deck===<br />
{|border="1"<br />
!Command<br />
!Data Length (nibbles)<br />
!Purpose<br />
!Data Format<br />
!Details<br />
|-<br />
|0x8<br />
|1<br />
|Wakeup notification<br />
|0x1<br />
|Sent after the base unit sends the first "Wake Up" command<br />
|-<br />
|0x9<br />
|2<br />
|Status<br />
|NP<br />
|N is:<br />
* 0x0 - stopped<br />
* 0x4 - playing<br />
* 0x5 - seeking<br />
* 0x6 - fast forwarding<br />
* 0x7 - rewinding<br />
<br />
P is 0x1 when the tape deck in use, 0xC for all other status messages (like on startup)<br />
|-<br />
|0xB<br />
|6<br />
|Detailed status<br />
|various<br />
|<br />
0x90X00C - sent during initialization, X is:<br />
* 0x0 for no cassette present<br />
* 0x4 for cassette present<br />
<br><br />
0x90Y001 - sent when the tape deck is in use, Y is:<br />
* 0x4 for normal playback<br />
* 0x5 when repeat mode is on<br />
* 0x6 when random mode is on<br />
<br><br />
0x9Z4011 - high speed fast-forward/rewind, Z is:<br />
* 0x2 for fast forward with the seek button<br />
* 0x3 for re-wind with the seek button<br />
<br><br />
0xA40004 - sent while the tape deck is ejecting<br><br />
0xA0000C - sent when the cassette is finally ejected<br><br />
<br />
0xB0400C - sent when a tape is inserted<br />
<br />
For any of these commands, when the Dolby noise reduction mode is on, the 4th nibble will be 0x1. For example: 0x904001 indicates normal playback, but with dolby noise reduction on it will be 0x904101.<br />
|}<br />
<br />
<br />
==Timing==<br />
<br />
The radio seems to be very forgiving when it comes to the duration of various signals. The CD player in particular is very inconsistent; in the same nibble it'll send a logical zero which lasts 0.4ms and then another that lasts 0.55ms, the radio doesn't seem to care.<br />
<br />
{| border="1"<br />
! Operation<br />
! Duration (milliseconds)<br />
|-<br />
|Logical 0<br />
| 0.4 - 0.6<br />
|-<br />
|Logical 1<br />
| 1.7<br />
|-<br />
|Wait after sending logical 0<br />
| 2.4<br />
|-<br />
|Wait after sending logical 1<br />
|1.2<br />
|-<br />
|Wait between nibbles<br />
|0 - 5<br />
|-<br />
|Wait between commands<br />
|10 - 50<br />
|}<br />
<br />
<br />
===Timing Diagrams===<br />
These diagrams are to give an idea of what timing is like on the bus. This particular diagram is of the initialization sequence (without the CD player). The x axis is in microseconds (10^-6 seconds).<br />
[[File:Mazda-cd-1.png|400px|none|thumb|The same 6 "Wake Up" commands are sent 4 times]]<br />
[[File:Mazda-cd-2.png|400px|none|thumb|Each command block is made up of 6 commands]]<br />
[[File:Mazda-cd-3.png|400px|none|thumb|The first command (0x38C)]]<br />
<br />
{{MazdaRadioSeeAlso}}</div>Nikosapihttp://nikosapi.org/w/index.php?title=PXE_boot_Ubuntu_from_a_Debian_server&diff=51PXE boot Ubuntu from a Debian server2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>This guide will help you set up a server from which you can boot diskless clients over the network. This is dissimilar from LTSP because all the processing gets done on the client side (aka "a fat client") instead of on the server. Here the server is only used as the client's root filesystem which means that you don't need a fancy server to support multiple clients (although the clients must have relatively modern hardware).<br />
<br />
In this guide Debian will be running on the server and the clients will be booting Ubuntu 10.10.<br />
<br />
==Install Debian on the server==<br />
This is pretty straightforward, install from the "netinst" disk and select "Standard system" when asked what software to install.<br />
<br />
==Set up the Ubuntu chroot==<br />
In order to boot from Ubuntu on the client machine we need an Ubuntu userland somewhere on the server (I chose /opt/chroots). The reason why we have to download debootstrap is because the version included in the Debian repos doesn't contain the scripts necessary to install Ubuntu 10.10.<br />
aptitude install binutils<br />
wget http://http.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.29_all.deb<br />
dpkg -i debootstrap_1.0.29_all.deb<br />
mkdir -p /opt/chroots/ubuntu10.10<br />
debootstrap --arch i386 maverick /opt/chroots/ubuntu10.10 http://archive.ubuntu.com/ubuntu/<br />
<br />
==Enter the Ubuntu chroot==<br />
Now we need to do a bit of configuration before this distro will be bootable. Firstly, enter the chroot:<br />
chroot /opt/chroots/ubuntu10.10/<br />
Run locale-gen to prevent annoying error messages from aptitude:<br />
locale-gen en_CA.UTF-8 # change "en_CA.UTF-8" to your current locale<br />
Make up a hostname to help differentiate the chroot from the server:<br />
echo "ubuntuchroot" > /etc/hostname<br />
Set up some dns servers (opendns is used in this example):<br />
echo -e "nameserver 208.67.222.222\nnameserver 208.67.220.220" > /etc/resolv.conf<br />
Set up a nice apt sources.list:<br />
{ for distro in maverick maverick-updates maverick-security; do<br />
for type in deb deb-src; do<br />
echo -n "$type http://archive.ubuntu.com/ubuntu $distro "<br />
echo main restricted universe multiverse<br />
done<br />
done; } > /etc/apt/sources.list<br />
That script should yield an /etc/apt/sources.list that looks something like this:<br />
deb http://archive.ubuntu.com/ubuntu maverick main restricted universe multiverse<br />
deb-src http://archive.ubuntu.com/ubuntu maverick main restricted universe multiverse<br />
deb http://archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse<br />
deb-src http://archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse<br />
deb http://archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse<br />
deb-src http://archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse<br />
<br />
Update your apt cache and install a kernel image:<br />
aptitude update<br />
aptitude install linux-image-generic<br />
Modify the initramfs config to support booting over NFS (change BOOT=local to BOOT=nfs):<br />
sed -i 's/BOOT=local/BOOT=nfs/' /etc/initramfs-tools/initramfs.conf<br />
Add the NFS root filesystem mountpoint to /etc/fstab (setting up the NFS server is described later on):<br />
echo "NFS_SERVER_IP:/opt/chroots/ubuntu10.10 / nfs rw,noatime,nolock,vers=3 0 0" > /etc/fstab<br />
Update the installed initramfs:<br />
update-initramfs -ck all<br />
Set a root password:<br />
passwd # follow the prompts<br />
<br />
==Install and configure the TFTP server==<br />
The bootloader, kernel and initrd are transfered over TFTP, so naturally we have to set up a TFTP server. (Make sure you've exited the Ubuntu chroot at this point)<br />
<br />
Install the TFTP server:<br />
aptitude install tftpd-hpa<br />
Make the base directory that tftpd will serve from:<br />
mkdir /opt/tftpboot<br />
Change the line in /etc/inetd.conf that looks like this:<br />
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot<br />
To this:<br />
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /opt/tftpboot<br />
And restart the inetd daemon:<br />
/etc/init.d/openbsd-inetd restart<br />
<br />
==Install and configure PXELINUX==<br />
PXELINUX is a bootloader that works over PXE, we use it to boot the Ubuntu kernel over the network.<br />
<br />
Install the PXELINUX image:<br />
aptitude install syslinux-common<br />
Copy over the bootloader:<br />
cp /usr/lib/syslinux/pxelinux.0 /opt/tftpboot/<br />
Make a boot directory and copy over the kernel and initrd images:<br />
mkdir /opt/tftpboot/boot<br />
cp -L /opt/chroots/ubuntu10.10/initrd.img /opt/tftpboot/boot/<br />
cp -L /opt/chroots/ubuntu10.10/vmlinuz /opt/tftpboot/boot/<br />
Create a directory to hold the default PXELINUX config file:<br />
mkdir /opt/tftpboot/pxelinux.cfg<br />
Add the following to the PXELINUX config file, /opt/tftpboot/pxelinux.cfg/default:<br />
default ubuntu-10.10<br />
timeout 1<br />
prompt 1<br />
serial 0 9600<br />
display display.msg<br />
<br />
label ubuntu-10.10<br />
kernel boot/vmlinuz<br />
append initrd=boot/initrd.img root=/dev/nfs nfsroot=NFS_SERVER_IP:/opt/chroots/ubuntu10.10 ip=dhcp rw<br />
Replace '''NFS_SERVER_IP''' with the IP address of the Debian server; hostnames are not allowed as dns isn't available that early in the boot process.<br />
<br />
Create a file that will display various boot options to the user:<br />
echo -e "\nBOOT OPTIONS\nubuntu-10.10" > /opt/tftpboot/display.msg<br />
<br />
Here's what the directory structure looks like:<br />
/opt:<br />
chroots/ tftpboot/<br />
/opt/chroots:<br />
ubuntu10.10/<br />
/opt/tftpboot:<br />
boot/ display.msg pxelinux.0 pxelinux.cfg/<br />
/opt/tftpboot/boot:<br />
initrd.img vmlinuz<br />
/opt/tftpboot/pxelinux.cfg:<br />
default<br />
<br />
==Configure NFS==<br />
We use NFS to mount the root filesystem over the network, here's how to set it up.<br />
<br />
Install the required packages:<br />
aptitude install nfs-kernel-server nfs-server<br />
Add something like the following to /etc/exports (eg. replace A.B.C with 192.168.0):<br />
/opt/chroots/ A.B.C.0/255.255.255.0(rw,no_root_squash,no_subtree_check)<br />
Export the NFS share(s):<br />
exportfs -ra<br />
<br />
==Configure DHCP==<br />
In order for PXE to find a boot server it uses a special DHCP option. This is very easy to set up if you have a router running DD-WRT.<br />
<br />
Go the following section:<br />
Services->Services->Additional DNSMasq Options<br />
Add the following string:<br />
dhcp-boot=pxelinux.0,some-server,A.B.C.D<br />
Where "some-server" is the hostname of the server and A.B.C.D is it's IP address.<br />
<br />
==You're done! Kinda...==<br />
At this point you should be able to boot off any computer that supports PXE booting. The next sections cover what to do once you're running on the client computer.<br />
<br />
==Installing a desktop environment==<br />
The bootstrapped version of Ubuntu that you're left with is very minimal, so let's install the standard Ubuntu desktop.<br />
<br />
It's as easy as:<br />
aptitude install ubuntu-desktop<br />
<br />
This will take a long while because everything is being installed over the network (unless you're lucky enough to be using gigabit). It's important to install from the client because a lot of things won't install properly from the chroot on the server.<br />
<br />
'''BOLD NOTE:''' After the installation completes the first thing you should do is disable NetworkManager. If you don't, NM has a bad habit of killing you network connection right before GDM starts which means you'll lose access to /.<br />
<br />
Disable it like so:<br />
update-rc.d -f NetworkManager remove<br />
<br />
==Optional: Add memtest86+ as a boot option==<br />
A PXE boot server is a great way to have access to utilities like memtest86+, here's how to set it up.<br />
<br> '''Note:''' This doesn't work, and I'm not sure why, see: http://forum.canardpc.com/showthread.php?t=28864<br />
<br />
Install memtest86+ on the server:<br />
aptitude install memtest86+<br />
Copy over the memtest86+ binary:<br />
cp /boot/memtest86+.bin /opt/tftpboot/boot/<br />
Add the following to the bottom of /opt/tftpboot/pxelinux.cfg/default:<br />
label memtest86<br />
kernel boot/memtest86+.bin <br />
Add the listing to display.msg:<br />
echo memtest86 >> /opt/tftpboot/display.msg<br />
<br />
==TODO==<br />
This guide is far from complete. Here are things that still need to be done/added:<br />
* Security considerations (nfs auth, etc)<br />
* More comprehensive DHCP setup info<br />
<br />
==External Links==<br />
* [http://www.howtoforge.com/pxe_booting_debian Similar tutorial on howtoforge]<br />
* [http://www.linux.org/docs/ldp/howto/Diskless-root-NFS-other-HOWTO-4.html Info on kernel boot options relating to nfsroot]<br />
* [http://www.rom-o-matic.net/ ROM-o-Matic - make PXE bootdisks for PCs with broken/non-existant PXE support]<br />
* [http://syslinux.zytor.com/wiki/index.php/PXELINUX The PXELINUX wiki]<br />
* [http://pxe.dev.aboveaverageurl.com/index.php/Main_Page Lots of PXE booting information]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Foo2svi&diff=49Foo2svi2013-09-14T02:16:28Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:foo2svi-1.1.png|right|thumb|356px|The Graphical Frontend]]<br />
foo2svi is a mencoder/mplayer frontend to convert video to the Samsung Audio Video Interleaving (SVI) format. It is able to detect black bars and crop them out as well as resizing the video with respect to it's aspect ratio.<br />
<br />
== The SVI Video Format ==<br />
* Standard xvid+mp3 avi file<br />
* No b-frames<br />
* The video must fit into to player's screen dimensions.<br />
<br />
Here's a simple way to make an SVI video using mencoder:<br />
mencoder -oac mp3lame -ovc xvid -lameopts cbr:br=96 -xvidencopts fixed_quant=3:max_bframes=0 \<br />
-of avi -vf scale=470:272 -o output.svi input.avi<br />
<br />
== Using foo2svi ==<br />
foo2svi is designed to make encoding to SVI simple on the command line and graphically. It's usage is fairly straightforward but here are some tips:<br />
<br />
=== GUI ===<br />
* Videos can be dragged onto the progress bar<br />
* When encoding, the progress bar tooltip displays the current "Frames per Second" (fps) and mencoder's estimated file size for the output video.<br />
* Right clicking on any video file will give you the option to open it with foo2svi.<br />
* Extra configuration options can be tweaked in the configuration file. ( ~/.config/foo2svi.conf )<br />
* In the preferences window:<br />
** The encoder quality setting modifies the quantizer that is used in the -xvidencopts switch, it can be set from 1 to 15.<br />
** Automatic crop detection is enabled by default which uses mplayer's cropdetect to try to remove horizontal black bars from the video.<br />
** The target video size should be set to your player's screen dimensions, the default (470x272) is for a Samsung YP-P2.<br />
=== Command Line ===<br />
Converting a video from the command line is as easy as:<br />
foo2svi --cli-mode video.avi<br />
For all the other available switches see:<br />
foo2svi --help<br />
<br />
== ChangeLog ==<br />
* Sun Aug 3 2008 - 1.1<br />
- Added drag and drop support<br />
- Added config options to set audio bitrate and cropdetect:limit<br />
- Fixed up the About window<br />
- Added actions for the file and help menus<br />
- Use gobject.timeout_add instead of threading for encoder updates<br />
<br />
* Sun Jul 27 2008 - 1.0<br />
- Initial revision.<br />
<br />
== Download ==<br />
* RPM (Fedora, CentOS, RHEL): [http://nikosapi.org/software/foo2svi/rpm/foo2svi-1.1-1.noarch.rpm foo2svi-1.1-1.noarch.rpm]<br />
** Source RPM: [http://nikosapi.org/software/foo2svi/rpm/foo2svi-1.1-1.src.rpm foo2svi-1.1-1.src.rpm]<br />
* Deb (Ubuntu, Debian): [http://nikosapi.org/software/foo2svi/deb/foo2svi_1.1_all.deb foo2svi_1.1_all.deb]<br />
* Source Tarball: [http://nikosapi.org/software/foo2svi/foo2svi-1.1.tar.gz foo2svi-1.1.tar.gz]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Foo2svi_-_an_SVI_video_encoder_frontend&diff=47Foo2svi - an SVI video encoder frontend2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Foo2svi]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Old-Timey_Phone&diff=45Old-Timey Phone2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Phone-front.jpg|thumb|left|Front]]<br />
[[Image:Phone-inside.jpg|thumb|left|Inside]]<br />
[[Image:Phone-board.jpg|thumb|left|Board Closeup]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=PVR-Remote&diff=43PVR-Remote2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Pvrmote.jpg|right]]<br />
PVR-Remote is a simple PyGTK app that I wrote to control my Hauppauge PVR-150 video capture card. It allows you to change channels and select the Composite or S-Video input.<br />
<br />
== Installation ==<br />
<br />
Installation is quite simple because all the code is contained in one executable python script. <br /><br />
If you'd like to test it out do the following:<br />
cd ~/Desktop<br />
wget http://nikosapi.org/software/pvr-remote.py -O pvr-remote<br />
python ./pvr-remote<br />
<br />
If you like it and would like to install it just make the file executable and stick in ~/bin or /usr/local/bin<br />
sudo mv ~/Desktop/pvr-remote /usr/local/bin<br />
sudo chmod +x /usr/local/bin/pvr-remote<br />
<br />
Then you can add an application launcher in your favorite window manager so you don't have to run 'pvr-remote' each time you want to use it.<br />
<br />
== Usage ==<br />
<br />
The application is pretty straightforward, choose a channel number and press 'Watch!' <br /><br />
Here are the functions of the other buttons:<br />
* Comp/Svid: Switch to the Composite/S-Video input right away<br />
* Ch- and Ch+: Change channel by one or minus one (Only works on Tuner input)<br />
* Set: Change channel but don't attempt to open a media player<br />
* Watch: Change to the specified channel and open a media player or if a media player is open just change channel<br />
<br />
== Configuration ==<br />
<br />
There are 3 options that might be useful to configure in the script:<br />
* DEVICE: Choose the /dev/video* device to stream video from (Default: /dev/video0)<br />
* VIDEO_PLAYER: Choose your prefered media player (Default: /usr/bin/mplayer)<br />
* PLAYER_ARGUMENTS: Configure any special options you wish to pass to the media player<br />
** Default: '-msglevel all=-1 -nolirc -cache 4096 -vf pp=lb ' + DEVICE<br />
** You might want to remove the -nolirc option if you use lirc with mplayer<br />
** Set cache to a higher value if the video is often choppy<br />
** The default video filter is the linear blend deinterlacer (lb), see the mplayer man page for more options.</div>Nikosapihttp://nikosapi.org/w/index.php?title=ENHANCE&diff=41ENHANCE2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Enhance.png|right|200px]]<br />
After watching a dozen episodes of CSI (and Super Troopers) I realized that it would be fun to make a photo enhancing application that always results in a perfect image like on the show. Sadly, I don't have the know-how to write such an app so I made the next best thing. ENHANCE blurs the image and by clicking the ENHANCE button it removes some of the blur until you get back to the unblurred image.<br />
<br />
== Running ENHANCE ==<br />
For this to work you need to have pygtk and PIL (python imaging library) installed.<br />
For Debian/Ubuntu:<br />
sudo apt-get install python-imaging python-glade2 python-gtk2<br />
For Fedora:<br />
su -c "yum install python-imaging pygtk2-libglade pygtk2"<br />
<br />
Once you've installed the required packages do the following to download and run:<br />
# Go to your Desktop<br />
cd ~/Desktop<br />
# Download the tarball<br />
wget http://nikosapi.org/software/ENHANCE.tar.bz2<br />
# Extract the files<br />
tar xvf ENHANCE.tar.bz2<br />
# Change to the extracted directory<br />
cd ENHANCE<br />
# Make ENHANCE.py executable (if it isn't already)<br />
chmod +x ENHANCE.py<br />
# Run the program<br />
./ENHANCE.py</div>Nikosapihttp://nikosapi.org/w/index.php?title=Xbox_DVD_Playback_Kit_Pinout&diff=39Xbox DVD Playback Kit Pinout2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>The Xbox DVD playback kit is a standard USB device with a proprietary connector that interfaces to Microsoft's Xbox.<br />
Right now it is the cheapest ($20 CAD used) USB remote that is supported by LIRC (lirc_atiusb driver). With a piece of USB cable salvaged from an old piece of hardware you can make a top quality remote control device for your Linux-based PC.<br />
<br />
== Small Howto ==<br />
<br />
The procedure is quite simple:<br />
# Pry open the receiver's plastic case with a small screw driver<br />
# Drill a hole in the front part of the case to pass a wire through<br />
# Solder the wire to the receiver following the color code below<br />
# Glue the case back together and you're done!<br />
<br />
== Color Coded Pinout ==<br />
[[Image:Xbox-dvd-pinout.jpg|400px]] <br /><br />
* If you're using a standard USB cable you should just be able to match the colors and solder away, but to be sure check your cable with a continuity tester according to the USB spec provided [http://pinouts.ru/Slots/USB_pinout.shtml here].<br />
# Red = Positive Power (+5V DC)<br />
# White = Data -<br />
# Green = Data +<br />
# Yellow = Unused<br />
# Black = Ground (0V DC)<br />
<br />
== LIRC lircd.conf ==<br />
Here is the config I use to get the remote working with LIRC<br />
<br />
begin remote<br />
<br />
name XboxDVDDongle<br />
bits 8<br />
<br />
begin codes<br />
<br />
SELECT 0x0b<br />
UP 0xa6<br />
DOWN 0xa7<br />
RIGHT 0xa8<br />
LEFT 0xa9<br />
INFO 0xc3<br />
9 0xc6<br />
8 0xc7<br />
7 0xc8<br />
6 0xc9<br />
5 0xca<br />
4 0xcb<br />
3 0xcc<br />
2 0xcd<br />
1 0xce<br />
0 0xcf<br />
DISPLAY 0xd5<br />
BACK 0xd8<br />
SKIP- 0xdd<br />
SKIP+ 0xdf<br />
STOP 0xe0<br />
REVERSE 0xe2<br />
FORWARD 0xe3<br />
TITLE 0xe5<br />
PAUSE 0xe6<br />
PLAY 0xea<br />
MENU 0xf7<br />
<br />
end codes<br />
end remote<br />
<br />
== Notes ==<br />
<br />
Under newer Linux distros the lirc_atiusb driver won't work if the xpad driver gets loaded first. To correct this problem just unload the xpad driver and reload the lirc_atiusb driver.<br />
<br />
modprobe -r lirc_atiusb xpad<br />
modprobe lirc_atiusb<br />
<br />
EDIT<br />
to get this to work with ubuntu 9.04 <br />
sudo apt-get install lirc<br />
for both remote and reciever select the none option.<br />
then do<br />
sudo modprobe -r lirc_atiusb xpad<br />
then<br />
modprobe lirc_atiusb<br />
<br />
modify the /etc/lirc/lircd.conf with the above config<br />
modify the /etc/lirc/hardware.conf <br />
Making sure the below section is enabled<br />
#Enable lircd<br />
START_LIRCD="true"<br />
<br />
done.</div>Nikosapihttp://nikosapi.org/w/index.php?title=Wiki/wiki/index.php&diff=37Wiki/wiki/index.php2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Main Page]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Wiki/index.php&diff=35Wiki/index.php2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[Main Page]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Archos-sync_v0.10_beta&diff=33Archos-sync v0.10 beta2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>The first beta release, it should be stable but I'm not sure everything is going to remain the way it is.<br /><br />
== Testing ==<br />
Just download, make executable and run! (a proper installer/uninstaller will come)<br />
wget http://nikosapi.org/software/archos-sync/archos-sync-0.10.py<br />
chmod +x archos-sync-0.10.py<br />
./archos-sync-0.10.py -h</div>Nikosapihttp://nikosapi.org/w/index.php?title=Archos-Sync&diff=31Archos-Sync2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Archos-sync-0.10.png|right|]]<br />
<br />
Archos-Sync is a little project I started to sync my [http://en.wikipedia.org/wiki/Archos_04_Series#The_604_WiFi archos media player] with [http://www.getmiro.com/ Miro] but it should work with any directory that has videos in it.<br />
<br />
== What's it able to do? ==<br />
* Detect if the filetype is playable on the device<br />
** mplayer is needed for this<br />
** full support for the DVD and Podcast plugins to come later<br />
* Keep the device in sync with the Miro downloads directory<br />
** Also, you can do a one way sync (just copy new files or just delete old files)<br />
* Did I mention the cool copy file progress bar? ;)<br />
<br />
== Usage ==<br />
<br />
Usage: archos-sync.py [-h] [-f] [-q] [-t|-c|-d|-s] [-m VIDEOS_DIR] DEVICE_MOUNT_POINT<br />
<br />
Options:<br />
-h Help Print this message.<br />
-t Test Run Show what files would be copied and deleted.<br />
-c Copy Only Only copy new files to the device, don't delete.<br />
-d Delete Only Only delete files off the device.<br />
-s Sync Do a full sync to the device.<br />
-f Force Copy Videos to the device even if they have been deleted.<br />
-q Quiet Be less verbose [Not Yet Implemented].<br />
-D DVD Copy files that work with the DVD plugin.<br />
-P Podcast Copy files that work with the Podcast Plugin.<br />
-m VIDEOS_DIR The directory where videos are kept.<br />
<br />
== Releases ==<br />
* [[archos-sync v0.10 beta]]<br />
<br />
== What's planned for future releases ==<br />
* Convert file to something supported by your device (using mencoder)<br />
** This would be especially useful for youtube videos<br />
* PyGTK gui</div>Nikosapihttp://nikosapi.org/w/index.php?title=GoGoMini_v1.2&diff=29GoGoMini v1.22013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Gogo-mini-1.2.png|right|thumb|300px|GoGoMini 1.2 in action!]]<br />
== New Features ==<br />
* Support for [[WIS_Go7007_Linux_driver#Making_long_recordings|long recordings]]<br />
* New "Input Source" section in the gui<br />
* A better configuration file with many more options that can be changed (~/.gogo-mini/settings)<br />
<br />
== Installation ==<br />
<br />
The source: [http://nikosapi.org/software/gogo-mini/gogo-mini-1.2.tar.bz2 gogo-mini-1.2.tar.bz2] <br /><br />
<br />
=== Fedora ===<br />
su -c "yum install pygtk2-libglade pygtk2"<br />
wget http://nikosapi.org/software/gogo-mini/gogo-mini-1.2.tar.bz2<br />
tar -xjvf gogo-mini-1.2.tar.bz2<br />
cd gogo-mini-1.2/<br />
su -c "make install"<br />
<br />
=== Ubuntu ===<br />
sudo apt-get install python-glade2 python-gtk2<br />
wget http://nikosapi.org/software/gogo-mini/gogo-mini-1.2.tar.bz2<br />
tar -xjvf gogo-mini-1.2.tar.bz2<br />
cd gogo-mini-1.2/<br />
sudo make install<br />
<br />
<br /><br />
Then that should be it! Run gogo-mini to launch the program or it should have also shown up in your programs menu.</div>Nikosapihttp://nikosapi.org/w/index.php?title=GoGoMini_v1.1&diff=27GoGoMini v1.12013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Gogo-mini-screen.png|right|thumb|300px|GoGoMini in action!]]<br />
== Features ==<br />
* Set the duration of the recording<br />
* Set the bitrate to record at<br />
* Set a delay before it starts recording<br />
* Choose the default save directory for all your recordings<br />
<br />
== Installation ==<br />
<br />
The source: [http://nikosapi.org/software/gogo-mini/gogo-mini-1.1.tar.bz2 gogo-mini-1.1.tar.bz2] <br /><br />
<br />
=== Fedora ===<br />
su -c "yum install pygtk2-libglade pygtk2"<br />
wget http://nikosapi.org/software/gogo-mini/gogo-mini-1.1.tar.bz2<br />
tar -xjvf gogo-mini-1.1.tar.bz2<br />
cd gogo-mini-1.1/<br />
su -c "make install"<br />
<br />
=== Ubuntu ===<br />
sudo apt-get install python-glade2 python-gtk2<br />
wget http://nikosapi.org/software/gogo-mini/gogo-mini-1.1.tar.bz2<br />
tar -xjvf gogo-mini-1.1.tar.bz2<br />
cd gogo-mini-1.1/<br />
sudo make install<br />
<br />
<br /><br />
Then that should be it! Run gogo-mini to launch the program or it should have also shown up in your programs menu.</div>Nikosapihttp://nikosapi.org/w/index.php?title=GoGoMini&diff=25GoGoMini2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>#REDIRECT [[GoGoMini_-_Simple_Software_For_Controlling_gorecord]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=Nintendo_Wi-Fi_USB_Connector&diff=23Nintendo Wi-Fi USB Connector2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Nintendo wifi.jpg|right|thumb|300px|Nintendo Wi-Fi Connector]]<br />
<br />
I bought one of these because I read that it had a ralink 2570 chipset, and low-and-behold it did! The ralink chipsets are pretty well supported by completely free and open source drivers provided by [http://www.ralinktech.com/ralink/Home/Support/Linux.html ralink] and the [http://rt2x00.serialmonkey.com rt2x00] project. What does this mean? Well, the Nintendo Wi-Fi connector is the cheapest USB wifi adapter available today that can do almost anything under Linux (hehe, not as much for you Windows users :-)<br />
I cracked mine apart so we can see what can be done with this little device. <br />
== The Case ==<br />
<br />
It's really easy to get open, just use a small screwdriver where the metal meets the plastic and go around with. The two halves are clipped together, it's like they wanted us to open it up!<br />
[[Image:Nintendo wifi shell.jpg|none|thumb|400px|Soo easy to open!]]<br />
<br />
== The Top of the PCB ==<br />
<br />
If you look to the right of the image you can see the trace on the board that acts as the antenna with what appears to be pads to solder your own antenna in? (Too bad I don't have an extra antenna laying around.) BTW, I could have left my mac address there because the driver lets you easily change it!<br />
[[Image:Nintendo wifi top.jpg|none|thumb|400px|Top of the PCB with RF shield]]<br />
[[Image:Nintendo wifi top nosh.jpg|none|thumb|400px|Top of the PCB without RF shield]]<br />
<br />
== The Bottom of the PCB ==<br />
<br />
I wonder what chip is missing there?<br />
<br />
[[Image:Nintendo wifi bottom.jpg|none|thumb|400px|Bottom of the PCB with RF shield]]<br />
[[Image:Nintendo wifi bottom nosh.jpg|none|thumb|400px|Bottom of the PCB without RF shield]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=GoGoMini_-_Simple_Software_For_Controlling_gorecord&diff=21GoGoMini - Simple Software For Controlling gorecord2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Gogo-mini-1.2.png|thumb|300px|right|GoGoMini in action!]]<br />
GoGoMini is a very simple front-end for gorecord, a program that enables you record video/audio from devices supported by the WIS-Go7007 Linux driver.<br />
<br />
== Why? ==<br />
Because who honestly wants to set up mythtv just to be able to record video? For me, writing my own software was the only graphical, viable alternative. Plus I got to learn Python!<br />
<br />
== What does it do? ==<br />
As is stated in the title, this software (for the time being) is a very simple solution so it doesn't do too much. <br><br />
For now you can:<br />
* Set the duration of the recording<br />
* Set the bitrate to record at<br />
* Set a delay before it starts recording<br />
* Choose the default save directory for all your recordings<br />
* Choose the input to record from<br />
* Supports [[WIS_Go7007_Linux_driver#Making_long_recordings|long recordings]]<br />
<br />
Other settings can be changed in the configuration file (~/gogo-mini/settings) or you'll have to edit the source (don't be afraid, it's simple enough).<br />
<br />
== Prerequisites ==<br />
<br />
* A copy of gorecord from a patched version of the WIS Go7007 driver. I've prepared a driver that seems to work fine on early 2007 versions of the Fedora and Ubuntu kernels with full install instructions at the following page: [[WIS Go7007 Linux driver]]<br />
* Python, Pygtk and Python-libglade (should be included with most distros)<br />
<br />
== Installation ==<br />
<br />
Latest source: [http://nikosapi.org/software/gogo-mini/gogo-mini-1.2.tar.bz2 gogo-mini-1.2.tar.bz2] <br /><br />
<br />
[[GoGoMini_v1.2|Installation instructions for version 1.2]]<br /><br />
[[GoGoMini_v1.1|Installation instructions for version 1.1]]</div>Nikosapihttp://nikosapi.org/w/index.php?title=WIS_Go7007_Linux_driver&diff=19WIS Go7007 Linux driver2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Plextor ConvertX M402U.jpg|right]]<br />
== Intro ==<br />
<br />
WIS's Go7007 MPEG-4 encoder chip is used in many video encoder boxes including the Plextor ConvertX (PX-M402U) which I own. The best part about this chip is it's fully supported under Linux if you have the appropriate driver (which I might add is open source!). To see what devices are supported visit this page: http://oss.wischip.com <br /><br /><br />
The problem is that WIS hasn't updated their driver in a while so it won't work on most modern Linux distributions. Thanks to some talented programmers the driver will work with their patches. I've patched the wis-go7007-linux-0.9.8 source so it works on Fedora Core 5/6, Fedora 7/8/9 and Ubuntu Dapper/Edgy/Feisty/Gutsy/Hardy. I've also patched the gorecord program with an audio/video sync patch and most recently made it possible to record huge video files instead of being limited to 1GB recordings.<br />
* All the patches are available in the '''patches''' directory of the source tarball<br />
<br />
== Driver Versions ==<br />
<br />
* [http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-2.tar.bz2 wis-go7007-linux-0.9.8-2]<br />
** Applied a patch from [http://home.comcast.net/~bender647/go7007/ here] to support linux >= 2.6.24<br />
* [http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-1.tar.bz2 wis-go7007-linux-0.9.8-1]<br />
** New versions of the driver and gorecord.<br />
*** Backwards compatibility fixes<br />
*** No filesize limits for gorecord<br />
*** Udev rules now work on Ubuntu<br />
* [http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-patched.tar.bz2 wis-go7007-linux-0.9.8-patched]<br />
** The first "patched" release<br />
*** 2.6.22 kernel support<br />
*** Many patches to improve the overall driver package<br />
* [http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8.tar.bz2 wis-go7007-linux-0.9.8]<br />
** The initial driver package from Micronas USA<br />
<br />
== Installation ==<br />
<br />
Installation is a bit different for each distro so follow the instructions for your distro. You can probably just copy the commands as one big chunk into your terminal but it's better to do them one at a time.<br />
<br />
=== Fedora Core 5/6 and Fedora 7/8/9 ===<br />
<br />
# Install required development packages<br />
su -c "yum install kernel-devel gcc ncurses-devel"<br />
# Get fxload RPM because the Fedora repos don't carry this package<br />
su -c "rpm -ivh http://nikosapi.org/software/WIS_Go7007/fxload-2002_04_11-1.i386.rpm"<br />
# Get the driver source<br />
wget http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-2.tar.bz2<br />
# Unpack the source<br />
tar -xjvf wis-go7007-linux-0.9.8-2.tar.bz2<br />
# Decend into source directory<br />
cd wis-go7007-linux-0.9.8-2<br />
# Compile the software<br />
make<br />
# Install the software<br />
su -c "make install"<br />
<br />
=== Ubuntu Dapper/Edgy/Feisty/Gutsy/Hardy ===<br />
# Install required development packages (this is a big download)<br />
sudo apt-get install linux-headers-generic fxload libncurses5-dev<br />
# Get the driver source<br />
wget http://nikosapi.org/software/WIS_Go7007/wis-go7007-linux-0.9.8-2.tar.bz2<br />
# Unpack the source<br />
tar -xjvf wis-go7007-linux-0.9.8-2.tar.bz2<br />
# Decend into source directory<br />
cd wis-go7007-linux-0.9.8-2<br />
# Compile the software<br />
make<br />
# Install the software<br />
sudo make install<br />
<br />
'''Note:''' Users of Ubuntu Feisty, Gutsy and Hardy have to follow the [[#Ubuntu_usbfs_fix|instructions to enable usbfs]] before the device will work.<br />
<br />
==== Ubuntu Hardy with kernel <= 2.6.46-17 ====<br />
The above instructions allow to compile the driver but it is not working. The driver crashed during the initialization of the ALSA sound input. For a detailed outline of the errors attempting to load the drivers, see this thread: [http://ubuntuforums.org/showthread.php?t=791842]. <br />
<br />
However, recompiling the kernel, after verifying that the required drivers are included, leads to working setup on Ubuntu with kernel 2.6.24. You can, e.g., follow the [https://bugs.launchpad.net/ubuntu/+bug/204578/comments/4 instructions by Benjamin Schleinzer]<br />
<br />
The exact cause is not clear, however:<br />
* the wis-go7007 readme lists certain kernel configuration flags which habe to be set and are not on the stock kernel, most notably CONFIG_SND.<br />
* the stock kernel provides ALSA 1.0.16 (cat /proc/asound/version.h), whereas the include files state that version 1.0.15 is used (more /usr/include/alsa/version.h).<br />
<br />
'''Other solution for Hardy 8.04''' (maybe better?)<br />
<br />
It is not necessary to recompile the kernel! CONFIG_SND is not enabled in the kernel, but alsa driver and modules are provided via linux-ubuntu-modules (or LUM)<br />
<br />
There's a simple workaround to compile the wis-go7007 driver: Here, to simplify, I suppose that the current kernel version is 2.6.24-19-generic. If not, replace everywhere needed. <br />
<br />
Make sure the following packages are installed:<br />
linux-headers-lum-2.6.24-19-generic <br />
linux-headers-2.6.24-19-generic<br />
<br />
Get rid of the incorrect sound kernel headers (which should never be included): for example, rename<br />
/usr/src/linux-headers-2.6.24-19-generic/include/sound<br />
to<br />
/usr/src/linux-headers-2.6.24-19-generic/include/sound-blacklisted<br />
<br />
In the wis-go7007 source, add the following line at the beginning of kernel/Makefile to take the right LUM alsa headers into account:<br />
EXTRA_CFLAGS += -I /usr/src/linux-headers-lum-2.6.24-19-generic -include sound/config.h<br />
<br />
Compile and install normally.<br />
<br />
== Testing ==<br />
<br />
=== Recording ===<br />
Plug in your (*supported*) video capture device and try the following command:<br />
* for the composite input use: -input 0<br />
* for the svideo input use: -input 1<br />
gorecord -input 0 -duration 20 test-video.avi<br />
This will record video for 20 seconds then stop. The video file will be named test-video.avi<br />
<br />
=== Playback ===<br />
<br />
Playback is a bit tricky because the video is encoded to a so called "proprietary" format (mpeg-4). Which basically means it's not encoded as theora or using some other non-proprietary video codec.<br />
<br />
==== Fedora ====<br />
<br />
* Enable the Livna repository:<br />
For FC5:<br />
su -c "rpm -Uhv http://rpm.livna.org/livna-release5.rpm"<br />
For FC6:<br />
su -c "rpm -Uhv http://rpm.livna.org/livna-release-6.rpm"<br />
For Fedora 7:<br />
su -c "rpm -Uhv http://rpm.livna.org/livna-release-7.rpm"<br />
For Fedora 8:<br />
su -c "rpm -Uhv http://rpm.livna.org/livna-release-8.rpm"<br />
<br />
* Install mplayer:<br />
su -c "yum install mplayer"<br />
* Play the video:<br />
mplayer test-video.avi<br />
<br />
==== Ubuntu ====<br />
<br />
Should be as easy to install as:<br />
sudo apt-get install mplayer<br />
<br />
Then play the video:<br />
mplayer test-video.avi<br />
<br />
== Fun ==<br />
=== GoGomini ===<br />
I wrote a very simple little frontend to gorecord that can be found here: [[GoGoMini_-_Simple_Software_For_Controlling_gorecord|here]]<br />
<br />
=== Video Streaming ===<br />
<br />
You can use wis-streamer to stream video from your go7007-based device to your local network or even onto the internet. There is a cool piece of software on [http://www.goikoetxeta.com/archivos/03-11-2007/wisremote-10/ this page] that lets you easily control wis-streamer and there's also a patched version of wis-streamer that will work with the go7007 devices.<br />
<br />
=== Recording audio only ===<br />
* To record only audio, first you must initialize the device:<br />
gorecord -adevice /dev/dsp -vdevice /dev/video0 -nowrite<br />
Note: /dev/dsp must not be the audio input of the device, use your sound card's input otherwise this won't work.<br />
*Fire up audacity or any other audio recording software that can use an alsa input and start recording!<br />
** For audacity, in the preferences window the device will look something like this: "ALSA: Plextor PX-M402U: (hw:1,0)"<br />
** Remember to use a '''2 channel (stereo)''' recording<br />
<br />
=== Making long recordings ===<br />
<br />
'''Note:''' This shouldn't be needed anymore when using the new version of gorecord because there is no longer is a filesize limit. The "%d" option is still provided but must be used with the -maxsize option to have any effect.<br />
<br />
Because of the filesize limitation by the '''old''' gorecord program, you can't make really long recordings that are stored in one big avi file. The workaround is to use gorecord's %d option to continue recording to a new file after hitting the limit. We can then put the files back together again into one big avi using mencoder.<br />
gorecord [options] filename-"%d".avi<br />
mencoder -oac copy -ovc copy filename-*.avi -o final_video.avi<br />
*Note: The individual files might not be playable until you string them back together with mencoder.<br />
<br />
== Troubleshooting ==<br />
=== Ubuntu usbfs fix ===<br />
<br />
In enable for the fxload program to load the firmware onto your device you must have usbfs (or usbdevfs) mounted on /proc/bus/usb. To enable this /etc/init.d/mountdevsubfs.sh must be modified. <br /><br />
There is a simple patch that can be applied which is included in the latest driver source package, apply it as follows:<br />
<br />
# Backup /etc/init.d/mountdevsubfs.sh<br />
cp /etc/init.d/mountdevsubfs.sh ~/Desktop/<br />
# Decend into source directory<br />
cd wis-go7007-linux-0.9.8-2<br />
# Apply the patch<br />
wd=`pwd`; sudo patch -d /etc/init.d -p0 -i "$wd"/patches/mountdevsubfs.sh-usbfs.patch<br />
# Mount the usbfs<br />
sudo /etc/init.d/mountdevsubfs.sh start<br />
<br />
=== Device not recognized ===<br />
If when you plug in the device it isn't recognized, the '''dmesg''' command will say something like this:<br />
usb 7-2: new high speed USB device using ehci_hcd and address 9<br />
usb 7-2: configuration #1 chosen from 1 choice<br />
If it is recognized it should say something like this:<br />
usb 7-2: new high speed USB device using ehci_hcd and address 8<br />
usb 7-2: configuration #1 chosen from 1 choice<br />
Linux video capture interface: v2.00<br />
go7007-usb: probing new GO7007 USB board<br />
go7007: registering new Plextor PX-M402U<br />
wis-saa7115: initializing SAA7115 at address 32 on WIS GO7007SB<br />
usbcore: registered new interface driver go700<br />
<br />
This normally means that udev/hotplug isn't doing it's job (or you don't have it setup). <br />
<br />
If you are using the latest driver, try running go7007_firmware_load to give you a clue as to why the firmware might not be loading.<br />
<br />
==== Activating the device manually ====<br />
So here's a little bash script to recognize the device and load the firmware for your PX-M402U or PX-TV402U.<br />
<br />
devices="093b:a002|093b:a004|0eb1:6666|0eb1:6668"<br />
device=`lsusb | grep -iE $devices`<br />
bus=`echo $device | cut -d " " -f 2`<br />
device_num=`echo $device | cut -d " " -f 4 | sed 's/://'`<br />
type=`echo $device | cut -d " " -f 6 | tr A-Z a-z`<br />
[ $type == "093b:a002" ] && hex="/lib/firmware/ezusb/hpi_PX-M402U.hex"<br />
[ $type == "093b:a004" ] && hex="/lib/firmware/ezusb/hpi_PX-TV402U.hex"<br />
[ $type == "0eb1:6666" ] && hex="/lib/firmware/ezusb/hpi_LR192.hex"<br />
[ $type == "0eb1:6668" ] && hex="/lib/firmware/ezusb/hpi_StarTrek.hex"<br />
/sbin/fxload -t fx2 -I $hex -D /proc/bus/usb/"$bus"/"$device_num"<br />
<br />
Here's the easy way to get this script working (The script contains some more troubleshooting info):<br />
* '''Note:''' The go7007_firmware_load script is now included under udev/ in the source package<br />
wget http://nikosapi.org/software/WIS_Go7007/go7007_firmware_load<br />
chmod +x ./go7007_firmware_load<br />
sudo ./go7007_firmware_load<br />
<br />
=== GoRecord fails to find the ALSA audio node ===<br />
At least for Ubuntu 8.04 with Kernel 2.6.24, GoRecord from the 0.9.8.2 provided here fails to find the ALSA audio input provided by the snd_go7007 module. A simple fix is to change line 217 in gorecord.c <br />
if (!strcmp(gopath, canonpath))<br />
to <br />
if (!strncmp(gopath, canonpath, strlen(gopath))<br />
<br />
On my system, for gopath and canonpath I have this values: <br />
gopath: /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1.1/5-1.1.4/5-1.1.4:1.0<br />
canonpath: /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1.1/5-1.1.4/5-1.1.4:1.0/sound/card1<br />
<br />
The canonpath points to an actual subdir of gopath. The fix just verifies that gopath matches the prefix of canonpath. <br />
<br />
=== wis-streamer fails to find the ALSA audio node and emulated OSS device node ===<br />
This is the same problem as the last one and the fix is similar. Use strncmp instead of strcmp in WISInput.cpp line 187.<br />
<br />
In addition, the next test in wis-streamer fails to find the emulated OSS device node. To fix it, replace the while loop of WISInput.cpp in line 206 with the while loop of gorecord.c in line 231.<br />
<br />
== Thanks ==<br />
<br />
# Chris P.<br />
#* Created the patch to fix compilation issues on the 2.6.22 kernels<br />
# [http://home.comcast.net/~bender647/go7007/index.html bender647]<br />
#* Created the patch to fix compilation issues on the 2.6.24 kernels<br />
<br />
== Resources ==<br />
# http://home.comcast.net/~bender647/go7007/<br />
#* A collection of patches for the driver<br />
# http://home.comcast.net/~bender647/go7007/gorecord.html<br />
#* A tutorial on how to make DVDs of video recorded from the Plextor ConvertX boxes<br />
<br />
== Footnote ==<br />
<br />
I don't know where the best place for this is, but I've found an bug in the wis-sony-tuner.c module which doesn't seem to have made it into any of the patches. Not needed for gorecord, but other v4l experiments may result in system instability:<br />
<br />
In the VIDIOC_G_TUNER ioctl, where it says:<br />
<br />
memset(t, 0, sizeof(*tun) );<br />
<br />
it should be:<br />
<br />
memset(tun, 0, sizeof(*tun));<br />
<br />
Unfortunately, the bug results in system instability if the VIDIOC_G_TUNER ioctl is ever invoked.--[[User:Bifferos|Bifferos]] 06:13, 16 July 2008 (EDT)</div>Nikosapihttp://nikosapi.org/w/index.php?title=WiiCheck&diff=17WiiCheck2013-09-14T02:16:27Z<p>Nikosapi: 1 revision</p>
<hr />
<div>[[Image:Wii.jpg|right|thumb|200px]]<br />
If you live in Canada, have access to a bash shell and really want a Wii I wrote a script that will facilitate that process. It works by downloading the online availability info from futureshop and bestbuy then it preforms two checks on it. The first (but most effective) is the grep test which uses grep to find the string "in stock" in the downloaded files, the second uses md5sum to see if the availability info has changed (just in case). If the grep test is true it uses mplayer to play a file in the same directory as the script named song1.mp3 and if the md5sum check is false (you'll know what I mean by looking at the script) it plays a file named song2.mp3 in the current directory. If either of the checks are positive it'll open Firefox to the futureshop/bestbuy page that lets you buy a Wii. The script checks for new Wiis every 5 minutes but that can easily be changed.<br />
Download here: [http://nikosapi.org/software/wiicheck/wiicheck-1.1.txt wiicheck-1.1.txt]<br /><br />
Make it executable with:<br />
mv wiicheck-1.1.txt wiicheck-1.1<br />
chmod +x wiicheck-1.1<br />
Then run it:<br />
./wiicheck-1.1<br />
Running the script produces a lot of output so you can always redirect that to a log file by running it like this: <br />
./wiicheck-1.1 >> wiicheck.log<br />
Options are:<br />
--test-fs-grep make sure the grep check works (futureshop)<br />
--test-bb-grep make sure the grep check works (bestbuy)<br />
--test-fs-md5 make sure the md5sum check works (futureshop)<br />
--test-bb-md5 make sure the md5sum check works (bestbuy)<br />
<br />
In the script there are 3 md5s for futureshop and 2 for bestbuy that are known to be used for "out of stock", you can add your own by md5sum'ing the onlineavailability.asp?sku_id=* files and adding your own md5sums. Remember just add a comma to the line of md5s and then add your own (just make one big line).<br />
<br /><br /><br />
Happy Wii hunting!<br />
<br /><br /><br />
nikosapi<br />
<br /><br /><br />
P.S. This does work, I can prove it ^_^</div>Nikosapi