R761's commentary

13 February 2011

3G USB internet

Filed under: Linux, Mobile Broadband, Ubuntu, Uncategorized — r761 @ 11:52 pm

I recently purchased a vodafone USB mobile broadband adaptor. While NetworkManager identified it as a mobile broadband device, it did not work consistently. After much experimentation I found that pppconfig was simple to configure, and the pon and poff worked reliably.

Summary:

Run: sudo pppconfig
Connection name: provider
Phone number: *99#
Device: /dev/gsmmodem
Username and password: anything, they do not matter as they are not used

Once configured you can connect to the internet by running pon and disconnect by running poff.

Detail

For a while I’ve been looking for a mobile broadband solution for occasional use at limited cost. Recently Dick Smith Electronics had a pre-pay special of a USB wireless modem and 15 GB with 1 year expiry for half the normal price.  The long expiry gives me the flexibility to use several GB one month, and nothing during other months. Unfortunately there was no easy way to know if the modem would work before I had purchased it.

Once home I opened the package. The instructions included the APN which I thought was a good sign. (I later discovered that this APN didn’t work.)

On connecting the modem it appeared to be recognised. lsusb describes the device as:

Bus 001 Device 005: ID 19d2:1009 ONDA Communication S.p.A.

Syslog had a message about USB mass storage device, but I couldn’t find a drive to mount. I later discovered that the device initially presents its self a USB mass storage device with windows drivers in a .exe. Once these are installed they tell the device to go out of mass storage mode in become a modem. Under Linux this switch is handled automatically by usb-modeswitch – which explains why all I was able to see was the modem.

Devices

The modem presents 5 devices: /dev/ttyUSB0 to /dev/ttyUSB4 . NetworkManager appears to randomly pick one of these devices. I noticed that when it picked ttyUSB3 it worked, but picking anoher device it didn’t work. The driver appears to know which device to use as it creates a symbolic link from /dev/gsmmodem to ttyUSB3 . As far as I could tell there is no way to tell NetworkManager which device to use. This means that NetworkManager is useless for this device – so I needed a better way to connect.

When the automagic of Gnome or KDE makes things less reliable it is time to return to basics – pon, poff, and pppconfig. What parameters should I configure? /dev/gsmmodem is the obvious device. Some googling revealed that dialing *99# will connect using the previous APN

APNs and dailing numbers

With the help of the Gnome Mobile Broadband configuration tool I found out the the correct APN to use for pre-pay mobile broadband from vodafone in Australia is vfprepaymbb. The modem stores the recently used APNs. These can be viewed by using a serial terminal (such as screen /dev/gsmmodem) to type the command at+cgdcont. You don’t have to specify or know the APN to connect – dialing *99# will connect using the most recently used APN. Once you have successfully connected using the modem (with any operating system) you can then just dial *99# to connect.

7 June 2009

Watching TV under Ubuntu with Totem

Filed under: Linux, Ubuntu — r761 @ 10:54 pm

How to watch TV under Linux with Totem and a USB DVB dongle.

  1. Insert USB DBV card. In my case lsub reports it as “Bus 001 Device 059: ID 0b05:171f ASUSTek Computer, Inc.”, while dmesg says “dvb-usb: found a ‘ASUS My Cinema U3000 Mini DVBT Tuner'”.
  2. Run totem. Select the menu item “Movie -> Watch TV on ‘DVB Adapter 0′”. Totem them complains that:

    Totem is missing a channels listing to be able to tune the receiver.
    Please follow the instructions provided in the link to create a channels listing.
    [OK]

    The trouble is that “the link” is not provided. Googling unconvers this suggestion:

  3. Get the channel list by running:

    w_scan -X > ~/.gstreamer-0.10/dvb-channels.conf

    This takes about 4 minutes to run.

  4. Go back to totem and select “Movie -> Watch TV on ‘DVB Adapter 0′” – you should now be able to watch TV.

5 May 2009

Upgrading to Ubuntu 9.04

Filed under: E51, Ubuntu — r761 @ 9:37 pm

Ubuntu 9.04 is out, and so far it looks good. I’ve upgraded 3 computer from 8.10.  The upgrade has fixed several problems from previous releases.

Nautilus can now write to obex shares over Bluetooth – this means I now have an easy way to write files to my Nokia E51 without resorting to extra adaptors (previously I had been removing the Micro SD card from the phone and putting it in a Micro SD to SD adaptor and then into my laptop).

“Mod4” (otherwise know as the Windows key) modifiers now work for more window manager shortcuts. Specifically I can now map Win-Home to bring up my home directory in Nautilus, and Win-L to lock the screen. A long time ago I mapped Win-F1 to desktop 1, Win-F2 to desktop 2, etc. This mapping continues to work in 9.04.

Apparently 9.04 includes support for force feedback wheels out of the box. I’ll test this once I’ve resurrected the PC with the network card which was taken out by lightening.

The much hyped notification system is a non-event. I had assumed that it would include a history – so you could bring up previous notifications to see what the one you missed was. If this functionality exists I’ve yet to work out how to access it.

Sound on my low powe Via system (called “fan less”, but actually has 2 fans) is still broken. This broke back with the upgrade to 8.10, and is still broken in 9.04. By broken I mean the audio stutters, making it unpleasant to use for listening to audio.

In other Ubuntu configuration changes I recently changed the power button to suspend (to disk) my laptop. (Configured under System->Preferences->Power Management->General->Actions->When the power button is pressed=Hibernate). Given I just about never shutdown my laptop, always opting to Hibernate instead this makes it quick to Hibernate. Previously I would press Alt-F1, Up arrow, enter, use mouse to select the shutdown menu as it invariably didn’t get focus, and then stuff around as the keyboard shortcuts didn’t work well. These keyboard shortcuts appear to be improved in 9.04, but pressing the power button is still much quicker.

8 January 2009

Force Feedback on Linux with a Logitech momo wheel, part 2

Filed under: Games, Linux, Ubuntu — r761 @ 6:28 pm

Force feedback does work with 2.6.28. Here’s what evtest has to say when running 2.6.28:

evtest /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick
Input driver version is 1.0.0
Input device ID: bus 0x3 vendor 0x46d product 0xca03 version 0x100
Input device name: "Logitech Logitech MOMO Racing "
Supported events:
Event type 0 (Reset)
Event code 0 (Reset)
Event code 1 (Key)
Event code 3 (Absolute)
Event code 4 (?)
Event code 21 (ForceFeedback)
Event type 1 (Key)
Event code 288 (Trigger)
Event code 289 (ThumbBtn)
Event code 290 (ThumbBtn2)
Event code 291 (TopBtn)
Event code 292 (TopBtn2)
Event code 293 (PinkieBtn)
Event code 294 (BaseBtn)
Event code 295 (BaseBtn2)
Event code 296 (BaseBtn3)
Event code 297 (BaseBtn4)
Event type 3 (Absolute)
Event code 0 (X)
Value 0
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 1 (Y)
Value 0
Min 0
Max 255
Flat 15
Event type 4 (?)
Event code 4 (?)
Event type 21 (ForceFeedback)
Event code 82 (?)
Event code 96 (?)
Event code 97 (?)
Testing ... (interrupt to exit)
Event: time 1231403438.348166, type 3 (Absolute), code 0 (X), value 56
Event: time 1231403438.348183, type 0 (Reset), code 0 (Reset), value 0
Event: time 1231403438.356172, type 3 (Absolute), code 0 (X), value 516
Event: time 1231403438.356190, type 3 (Absolute), code 1 (Y), value 127
Event: time 1231403438.356192, type 0 (Reset), code 0 (Reset), value 0
^C

Note the addition (after kernel upgrade) of “Event code 21 (ForceFeedback)”. fftest only acknowledges one type of event:

./fftest /dev/input/event4
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event4 opened
Axes query:
Effects: Constant
Number of simultaneous effects: 16
Upload effects[0]: Invalid argument
Upload effects[2]: Invalid argument
Upload effects[3]: Invalid argument
Upload effects[4]: Invalid argument
Upload effects[5]: Invalid argument
Enter effect number, -1 to exit
0
Now Playing: Sine vibration
Enter effect number, -1 to exit
1
Now Playing: Constant Force
Enter effect number, -1 to exit
2
Now Playing: Spring Condition
Enter effect number, -1 to exit
3
Now Playing: Damping Condition
Enter effect number, -1 to exit
4
Now Playing: Strong Rumble
Enter effect number, -1 to exit
5
Now Playing: Weak Rumble
Enter effect number, -1 to exit
6
No such effect
Enter effect number, -1 to exit
-1
No such effect

None of these effects make a noticeable difference to the wheel. The force feedback device is normally /dev/input/event4, though this changes occasionally between plugins. /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick is a symbolic link to the device (usually to ../event4). Most commands appear to work with either the link, or the actual device. fftest only works with the device (event4), and will fail to run if the link is specified. By default /dev/input/event4 is only accessible by root. The simple, one off fix, is to run

sudo chgrp plugdev /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick

This can be made permanent with the help of udev rules. Here’s what my /etc/udev/rules.d/80-logitech-mom-wheel.rules looks like now:

ACTION!="add", GOTO="event_end"
SUBSYSTEM!="input", GOTO="event_end"

KERNEL!="js[0-9]*", GOTO="js_end"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/logger udev Logitech momo wheel: running jscal"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/jscal -s 2,1,0,507,507,1058885,1044464,1,0,127,127,4227201,4194176 $tempnode"
LABEL="js_end"

KERNEL!="event[0-9], GOTO="event_end"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/logger udev Logitech momo wheel: setting feedback group"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", GROUP="plugdev"
LABEL="event_end"

According to the output in syslog (from the logger command) the group is set 3 times. From what I can tell by watching debug statements in udev rules, the momo wheel is 8 different devices (a joystick, a force feedback device, and I’m not sure what the others are). The auto-centre feedback force can be set with the ffset command:

ffset -a 100 /dev/input/event4

Will make the wheel harder to turn away from the centre. When released it will return to the centre quickly.

ffset -a 20 /dev/input/event4

Will make the wheel easier to turn. It will also return to centre more slowly. What Linux games support force feedback? The only one I know of is vdrift. To get vdrift working make sure the permissions are set (see above) and then edit the [ joystick ] section of ~/.vdrift/VDrivf.config to look like:

[ joystick ]
calibrated = off
deadzone = off
ff_device = /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick
ff_gain = 1.500000
ff_invert = off
selected_index = 0
touchcomp = off
two_hundred = on
type = wheel

That’s it – you are now ready to enjoy vdrift with force feedback.

2 January 2009

Force Feedback on Linux with a Logitech momo wheel

Filed under: Games, Linux, Ubuntu — r761 @ 2:33 pm

Force feedback doesn’t appear to be supported out of the box on Ubuntu 8.10 (with kernel 2.6.27) with the Logitech momo wheel.

By default the /dev/input/eventX devices are not readable by ordinary users. A temporary fix (until the device is removed and added) is to run chgrp plugdev /dev/input/event*.

The force-feedback package (libff/ffutils) has some test commands. To find the right device use evtest /dev/input/eventX. I found the event2 was the correct device:

bash> ./evtest /dev/input/event2
Input driver version is 1.0.0
Input device ID: bus 0x3 vendor 0x46d product 0xca03 version 0x100
Input device name: "Logitech  Logitech MOMO Racing "
Supported events:
  Event type 0 (Reset)
    Event code 0 (Reset)
    Event code 1 (Key)
    Event code 3 (Absolute)
    Event code 4 (?)
  Event type 1 (Key)
    Event code 288 (Trigger)
    Event code 289 (ThumbBtn)
    Event code 290 (ThumbBtn2)
    Event code 291 (TopBtn)
    Event code 292 (TopBtn2)
    Event code 293 (PinkieBtn)
    Event code 294 (BaseBtn)
    Event code 295 (BaseBtn2)
    Event code 296 (BaseBtn3)
    Event code 297 (BaseBtn4)
  Event type 3 (Absolute)
    Event code 0 (X)
      Value    512
      Min        0
      Max     1023
      Fuzz       3
      Flat      63
    Event code 1 (Y)
      Value    127
      Min        0
      Max      255
      Flat      15
  Event type 4 (?)
    Event code 4 (?)
Testing ... (interrupt to exit)
Event: time 1230869143.661631, type 3 (Absolute), code 0 (X), value 512
Event: time 1230869143.661639, type 0 (Reset), code 0 (Reset), value 0
Event: time 1230869143.669637, type 3 (Absolute), code 0 (X), value 501
Event: time 1230869143.669659, type 0 (Reset), code 0 (Reset), value 0
... lots more Events printed if the wheel is moved, or buttons presed.

In theory fftest should test force feedback. This didn’t work for me. Here’s the output:

bash> ./fftest /dev/input/event2
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event2 opened
Axes query:
Effects:
Number of simultaneous effects: 0
Upload effects[0]: Function not implemented
Upload effects[1]: Function not implemented
Upload effects[2]: Function not implemented
Upload effects[3]: Function not implemented
Upload effects[4]: Function not implemented
Upload effects[5]: Function not implemented
Enter effect number, -1 to exit

There are some changes in the 2.6.28 kernel relating to force feedback and the momo wheel – maybe that will get it working.

Next step: repeat these tests with a 2.6.28 kernel.

1 January 2009

Logitech momo wheel with Linux and Torcs

Filed under: Games, Linux, Ubuntu — r761 @ 10:37 pm

Recently I purchased a Logitech momo wheel for use with car simulators such as the torcs racing game.

Plugging this in to Ubuntu 8.10 it was detected immediately. Running

jstest /dev/input/js0

gives an easy way to show what all the buttons and pedals do. It also demonstrates the problem with the default configuration – there’s a significant dead spot around the centre of the wheel rotation. This can be fixed withjscal. Specifically:

jscal -c /dev/input/js0

Then follow the prompts to calibrate the wheel and pedal ranges. This removes the dead spot in the centre.

jscal -p /dev/input/js0

This prints out a command line which can be run to install the current calibation (as configured with jscal above). For me this output:

/usr/bin/jscal -s 2,1,0,507,507,1058885,1044464,1,0,127,127,4227201,4194176

Now, I could just re-type this command every time I connect the wheel, but being one to automate things I configured udev to automatically run jscal for me. To do this I created the file /etc/udev/rules.d/80-logitech-momo-wheel.rules which looks like:

ACTION!="add", GOTO="momo_end"
SUBSYSTEM!="input", GOTO="momo_end"
KERNEL!="js[0-9]*", GOTO="momo_end"

SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/logger udev Logitech momo wheel: running jscal"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/jscal -s 2,1,0,507,507,1058885,1044464,1,0,127,127,4227201,4194176 $tempnode"

LABEL="momo_end"

What about force feedback? It doesn’t appear to be supported by torcs. Accoding to blogdrake, vdrift does support force feedback so that’s next on my list of things to try.

23 December 2008

Trainz Simulator 2009 (TS2009) under Linux and Wine

Filed under: Games, Linux, Trainz, Ubuntu — r761 @ 3:06 pm

Trainz Simulator 2009 is out and promises a whole set of improvements. Of course I was eager to find out how well it works with Wine. The short answer: much like previous versions – a couple of tweaks and it mostly works.

Here is what I have done to get it working:

1. Create the registary key HKEY_CURRENT_USER/Software/Wine/X11 Driver/ClientSideWithRender Without this most of the startup menus don’t render text – making it hard to select the correct option or route.
2. Use DirectX rendering (not OpenGL) There are several problems with OpenGL, the most obvious being no ground.

After clicking “Start” at the initial screen a dialogue box comes up with “Launch Failed”, “Process exited with error code 9009”. Click on the [Launch Trainz] button to continue.

This is being run on Ubuntu 8.10 with an nVidia NV44 [Quadro NVS 285] using proprietary drivers.

Links:

If you have any more tweaks to improve functionality or performance please let me know.

24 October 2008

Australian Government attempting to filter the Internet

Filed under: Australian Government — Tags: — r761 @ 4:39 pm

The Australian Government (led by Stephen Conroy) is continuing it’s attempt to filter the Internet. When will they stop wasting my tax money on such schemes which are generally acknowledged as being ineffective. Rather than trying to promote cheap, affordable, broadband access for the country they continue trying to put in filters which will just slow it down.

Rather than reiterate all the arguments against the scheme here I’ll point to several articles which already outline many of the problems:

12 July 2008

Connecting Ubuntu with bluetooth to Telstra 3g

Filed under: E51, Ubuntu — Tags: , , , , , , — r761 @ 10:35 pm

I have a Nokia E51 with a Telstra (Australia) SIM. There are a number of pages which describe how to connect. The one crucial step they didn’t explain is what Telstra calls its access point. It is “telstra.wap”. The AT command required is:

AT+CGDCONT=1,”IP”,”internet”

Here’s the whole process:

  1. Set bluetooh on the phone to temporarily discoverable (Home/Menu, Connectivity, Bluetooth, My phone’s visibility=Defined period, 2 minutes.)
  2. Run: sdptool search dun
    Make a note of the MAC address (00:1D:FD:….) and the Channel, (eg 4)
  3. Edit /etc/bluetooth/rfcomm.conf to look like
    # RFCOMM configuration file.
    rfcomm0 {
    # Automatically bind the device at startup
    bind yes;
    # Bluetooth address of the device
    device 00:1D:FD:AB:CD:EF;  # replace with your MAC
    # RFCOMM channel for the connection
    channel	4;  # replace with your channel
    # Description of the connection
    comment "Nokia E51 phone";
    }
  4. Run: sudo rfcomm bind 0 00:1D:FD:AB:CD:EF
  5. Run: sudo /etc/init.d/bluetooth restart
  6. Edit /etc/ppp/peers/3g to look like
    # user and password are ignored by the other end
    user "3g"
    password "3g"
    show-password
    connect "/usr/sbin/chat -t 5 -v '' ATZ OK 'ATV1 E0' OK 'AT+CGDCONT=1,\"IP\",\"telstra.wap\"' OK 'ATDT*99***1#' '}'"
    # Serial device to which the modem is connected.
    /dev/rfcomm0
    # Speed of the serial line.
    115200
    # Assumes that your IP address is allocated dynamically by the ISP.
    noipdefault
    # Try to get the name server addresses from the ISP.
    usepeerdns
    # Use this connection as the default route.
    defaultroute
    # Makes pppd "dial again" when the connection is lost.
    #persist
    # Do not ask the remote to authenticate.
    noauth
    # log connecting messages to /var/log/syslog (via syslog)
    debug
    # serial port locking
    lock
    # disable compression
    novj
    nobsdcomp
    novjccomp
    nopcomp
    noaccomp
    noccp
  7. To connect run: pon 3g
  8. Enjoy the internet at premium Telstra prices
  9. To disconnect run: poff

If the bluetooth serial port stops working for no apparent reason, and minicom complains that the device has gone away, check the channel. It changed on me for no apparent reason. Once I updated it in /etc/bluetooth/rfcomm0 and ran /etc/init.d/bluetooth restart it started working again.

12 June 2008

Predictive text not always available

Filed under: E51 — Tags: , — r761 @ 1:34 pm

In several places, particularly in the web browser, predictive text is not available. Specifically, when entering a a URL or bookmark name predictive text can not be activated. Pressing “#” cycles between “abc”, “ABC”, and “123”, none of which have the “…” for predictive text. This unnecessarily slows down text entry on these screens.

Older Posts »

Blog at WordPress.com.