12.07.2015 Views

Download This PDF! - Linux Magazine

Download This PDF! - Linux Magazine

Download This PDF! - Linux Magazine

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Bluetooth with GPRSCOVER STORYmeans it is no longer sufficient to directlyuse a small dialog/ Xdialog-basedshell script like the one in Listing 2 forkey exchange.Luckily, it is still possible to use ascript similar to Listing 2 with the newdbus-based passkey-agent, which iscurrently located in the kdebluetoothDebian package, even though it is just aconsole program that can be called with:knopper@Koffer:~U$ passkey-agent --default U/usr/local/bin/btpin.sh &PIN on DemandBecause passkey-agent does not requireroot privileges to listen on dbus, you canstart passkey-agent as a normal user,which makes access to the graphicaldisplay easier in the actual PIN inputreader. (For instance, you could rewritebtpin.sh so it does not have to extractxauth cookies.)Some <strong>Linux</strong> distributions might requireyou to store the Bluetooth PIN foroutgoing connections in a file such as/etc/bluetooth/pin, but I think that providingthe PIN on demand is a betterapproach.Listing 5: /etc/ chatscripts/umts-with-pin01 TIMEOUT 12002 ABORT BUSY03 ABORT "NO CARRIER"04 "" 'ATE1'05 OK AT+CPIN=123406 TIMEOUT 407 OK-AT+CPIN?-OK AT+CGDCONT=1,"IP","internet.eplus.de"08 TIMEOUT 12009 ABORT ERROR10 # use OK AT_OPSYS=3,2 toprefer UMTS, but still acceptGPRS (default setting?)11 OK ATD*99***1#12 CONNECT \d\cChat and PPPOnce a modem connection to the cellphone is configured, you can set up achat script for a GPRS connection (Listing3). The line AT+CGDCONT=1,"IP","internet" is the correct setting for networkprovider O2; other possibilitiescould be:eplus: AT+CGDCONT=U1,"IP","internet.eplus.de"vodafone: AT+CGDCONT=U1,"IP","web.vodafone.de"D1: AT+CGDCONT=U1,"IP","internet.t-d1.de"The line:ATD*99***1#actually initiates the GPRS “dialing” process,which will then require the PPPprotocol for local authentication and IPconfiguration.A PPP setup similar to the configurationshown Listing 4 should work withmost cellphones. Please note that youleave the “user” option argument emptyhere because authentication against yourprovider’s customer database is reallydone through your phone number andListing 6: /etc/ ppp/ peers/umts01 noauth02 connect "/usr/sbin/chat -v -f/etc/chatscripts/umts-with-pin"03 nodefaultroute04 /dev/ttyS205 11520006 local07 modem08 persist09 crtscts10 passive11 noipdefault12 ipcp-accept-local13 ipcp-accept-remote14 ipcp-restart 415 ipcp-max-configure 2016 ipcp-max-failure 2017 lcp-echo-interval 418 lcp-echo-failure 019 novj20 nodeflate21 nobsdcomp22 usepeerdns23 user ""the cellphone’s IMEI device identification.pppd merely handles a reliableconnection between your cellphoneand your computer on the TCP/ IP level,so your cellphone almost looks like anetwork card to your computer.Getting ConnectedAfter adding the configuration files describedin this article and setting theparameters to match your provider andcellphone or UMTS card, you can getconnected by starting the PPP daemon:root@Koffer# Upppd nodetach call gprsIf you want to see a more verbosedescription of what’s happening, adddebug right after the pppd command.As soon as two lines with IP addressesappear, you are connected. Don’t be confusedby the private IP networks thatpppd displays – these private networksare used internally between your computerand the GPRS provider, and theyare masqueraded via real, routed IPaddresses. However, because of thisdesign, GPRS and UMTS are currentlynot usable for running servers that arevisible from the Internet, except witha tunnel or proxy.A Ctrl-C in the preceding example willend the pppd command and disconnectyour GPRS or UMTS session.With GPRS and UMTS, as opposed toGSM phone mode, traffic is usuallybilled by volume (kilobytes transferred)and not by time. But please look up theactual price list to make sure you canafford it. ■GPRS HintsInteractive response of GPRS and UMTSis horrible; you will experience up tothree seconds of delay between hitting akey and seeing the letter appear in a remoteSSH session. You can get used tothis, but it is uncomfortable. For readingweb pages, you should probably disableautoloading of pictures to save yourphone bill and speed up page downloads.Because GPRS is not designed toautomatically compress transferreddata, you also might experience a dramaticspeed (and cost) improvement byusing a vtun or SSH tunnel to a remoteproxy instead of fetching raw data,especially for text-based protocols likehttp, imap, or pop3.W W W. L I N U X- M A G A Z I N E . C O MISSUE 80 JULY 200737

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!