[tlinux-users:07716] Re: Infrarred and remote control

Paul Koufalas <[email protected]>
Newsgroups gmane.linux.hardware.toshiba
Message-ID <[email protected]>
G'day Manuel,

I appear to have only have one infrared port on my Toshiba Satellite P20
laptop...I really should read the manual.

The SMSC LPC47N227 chip is IRDA compliant and so I compiled lirc 0.8.0
for IRDA compliant remotes, which gave me lirc_sir for low speed
("serial like") Serial Infrared comms.

Now according to wikipedia the IRDA specs define a protocol stack with a
fair number of layers that sit under the IP network layer of the TCP/IP
stack. I think I'm only using the very bottom layer when receiving from
my laptop remote control, i.e. the IRDA physical layer, SIR mode.

If I wanted to link IP capable devices to my laptop, I would look at
using the IRDA tools in the linux kernel. Probably means unloading the
lirc_sir module and loading the smsc_ircc2 module. I'd like to think I
could use either, though the lirc_sir would be limited to low rates.
It's the irda-utils package (in Ubuntu/Debian) that implements the above
physical layers of the IRDA protocol stack. I don't think the SMSC chip
implements anything but the IRDA physical layer.

sudo modprobe smsc-ircc2
sudo /etc/init.d/irda-utils restart
sudo ifconfig

[snip]

irda0     Link encap:IrLAP  HWaddr 00:00:00:00
          UP RUNNING NOARP  MTU:2048  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:197 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:8
          RX bytes:0 (0.0 b)  TX bytes:6132 (5.9 KiB)
          Interrupt:3 Base address:0x6f8

[snip]

IrLAP is the link access protocol sitting about the IrPHY layer. But I
haven't tried anything more than that. I don't have any devices, e.g. my
Nokia mobile phone doesn't have an infrared port. The interrupt and base
address correspond to the SMSC chip IrPHY, Fast infrared (FIR) mode.

sudo irattach irda0

may or may not be necessary, in any case man irattach for more details.
I haven't actually used any of this so I could be writing rubbish here.

Hope this helps in any case.

Cheers

Manuel López-Ibáñez wrote:

> That is really cool!
>
> I cannot understand why it didn't work for me. Doing
>     $ sudo mode2 -d /dev/lirc0
> didn't show any output in my case. Well, I hope to have some free time
> someday to try again.
>
> Just a quick question, the infrared port is the same that is used for
> infrared communications between laptops or am I confusing two
> different things?
>
> Cheers,
>
>     Manuel.
>
>
> Paul Koufalas wrote:
>
>> My final update on the infrared remote control:
>>
>> NEC-pulse.conf is appropriate for the Toshiba P20 laptop remote control.
>>
>> $ sudo irrecord -d /dev/lirc0
>> /usr/src/lirc-0.8.0/remotes/generic/NEC-pulse.conf
>>
>> produces this (renamed) to /etc/lirc/lircd.conf
>>
>> [snip]
>>
>> # brand: SMK
>> # model no. of remote control: 401RRS-420-MIG
>> # devices being controlled by this remote: Toshiba Satellite P20 laptop
>> #
>>
>> begin remote
>>
>>   name  SMK
>>   bits           16
>>   flags SPACE_ENC|CONST_LENGTH
>>   eps            30
>>   aeps          100
>>
>>   header       9000  4500
>>   one           563  1687
>>   zero          563   562
>>   ptrail        563
>>   repeat       9000  4500
>>   pre_data_bits   16
>>   pre_data       0xC798
>>   gap          108000
>>   toggle_bit      0
>>
>>   frequency    38000
>>   duty_cycle   33
>>
>>       begin codes
>>           video_out               0xAA55
>>           onesquare                0x42BD
>>           twosquare                0xC23D
>>           vol_up                   0x22DD
>>           vol_down                 0x629D
>>           arrow_up                 0xA25D
>>           arrow_down               0xD22D
>>           arrow_left               0xE21D
>>           arrow_right              0x926D
>>           enter                    0x12ED
>>           mute                     0x2AD5
>>           twoarrows                0x52AD
>>           menu                     0x32CD
>>           mode                     0xB24D
>>           play_pause               0x728D
>>           stop                     0xF20D
>>           track_prev               0x0AF5
>>           track_next               0xCA35
>>           skip_back                0x8A75
>>           skip_fwd                 0x4AB5
>>       end codes
>>
>> end remote
>>
>> which contains all buttons except the power button -- which powers down
>> my laptop already! I don't know what some of the buttons are meant to do
>> (hence the dumb names in some cases).
>>
>> $ sudo lircd -d /dev/lirc0 /etc/lirc/lircd.conf
>> $ irw
>> 00000000c798a25d 00 arrow_up SMK
>> 00000000c798926d 00 arrow_right SMK
>> 00000000c798d22d 00 arrow_down SMK
>> 00000000c798e21d 00 arrow_left SMK
>> 00000000c79812ed 00 enter SMK
>> 00000000c79832cd 00 menu SMK
>> 00000000c798f20d 00 stop SMK
>> 00000000c798728d 00 play_pause SMK
>>
>> etc is observed on button presses.
>>
>> I can now create a lircdrc file to do something on button presses, using
>> irexec, irxevent or alternatively, emulate mouse events using lircmd.
>> I've successfully tested this with irexec, it brings up a dialogue box
>> by running zenity on a button press.
>>
>> My only whinge: the range of the laptop remote control seems to be very
>> short and receptive only from the right hand side (where it appears the
>> infrared receiver is located). I think I'll try one of the other
>> infrared remotes in the house, we have an assortment to choose from!
>>
>> Thanks to Manuel for his original (very helpful) post on this topic and
>> to all those who offered advice.
>>
>> Cheers!
>>
>>
>> Paul Koufalas wrote:
>>
>>
>>> I forgot to add that the remote I'm using is the one that came with the
>>> P20, a mini Toshiba laptop remote.
>>>
>>> It's obviously an infrared remote; I'm not sure what else it could've
>>> been (possibly a cheap RF remote?)
>>>
>>> I still can't figure out why the remote's laptop power on/off button
>>> works without having to do anything. I should try now that
>>> smsc_ircc2 is
>>> not loaded...could the BIOS be responsible...I get a clean shutdown as
>>> if I'd pressed the power button on the laptop.
>>>
>>>
>>>
>>>
>>> Paul Koufalas wrote:
>>>
>>>
>>>
>>>
>>>> G'day everybody.
>>>>
>>>> Just an update on my progress with the remote control for those few
>>>> who
>>>> are interested...
>>>>
>>>> I downloaded the tarball of lirc 0.8.0 and compiled it for IRDA
>>>> compliant remotes. I figured that since my P20 has the smsc superio
>>>> chip
>>>> and it's IRDA compliant, that's what I should choose. So after
>>>> ./setup.sh, make, sudo make install, I had kernel modules lirc_dev.ko
>>>> and lirc_sir.ko in my lib/modules/...
>>>>
>>>> Brief note: I had to prepare for the above by make menuconfig in my
>>>> linux kernel source tree, load config file from /boot/config-,
>>>> exit/save...and make oldconfig just to be sure, as I was using a
>>>> distro
>>>> kernel image (Ubuntu Breezy 5.10, kernel 2.6.12-10-686). I also had to
>>>> install pciutils-dev (the absence of which was why it failed to
>>>> compile
>>>> the first time around, could not find pci/pci.h).
>>>>
>>>> Not convinced my BIOS initialises the smsc superio chip properly, I
>>>> downloaded smcinit-0.4.1. ./configure, make, sudo make install.
>>>> smcinit
>>>> would not work for me. I edited smcinit.c to make the defaults
>>>> match the
>>>> P20 requirements. I found these from the dmesg output based on
>>>> initially
>>>> loading the smsc_ircc2 kernel module, which contains smcinit. It
>>>> told me
>>>> DMA=1, not DMA=3 (which is on the smcinit web page), and somewhere I
>>>> read this is because DMA 3 is allocated to the Atheros 802.11a/b/g
>>>> chip.
>>>> smcinit then complained that the LPC bridge was not an 82801CAM. So I
>>>> spent some time trawling through Intel chipset doco, and found that
>>>> the
>>>> registers for the ICH5 and ICH3-m are identical, so I changed
>>>> smcinit.c
>>>> to allow for the ICH5 too.
>>>>
>>>> $ sudo smcinit -v
>>>> smcinit 0.4
>>>>
>>>> Default-Values for Satellite P20:
>>>> SIR ioport: 0x2f8
>>>> FIR ioport: 0x6f8
>>>> FIR interupt: 3
>>>> FIR DMA: 1
>>>>
>>>> Detected IO hub vendor id: 0x8086
>>>> Detected IO hub device id: 0x24d0
>>>> Detected Chip id: 0x5a
>>>>
>>>> SIR ioport register      write: 0xbe     read: 0xbe
>>>> FIR interrupt register   write: 0x3      read: 0x3
>>>> FIR ioport register      write: 0xdf     read: 0xdf
>>>> FIR dma register         write: 0x1      read: 0x1
>>>>
>>>> Initialisation of the SMC 47Nxxx succeded
>>>>
>>>> $ sudo modprobe lirc_sir debug=1
>>>> $ dmesg
>>>>
>>>> [snip]
>>>>
>>>> [4332356.183000] lirc_dev: IR Remote Control driver registered, at
>>>> major 61
>>>> [4332356.190000] lirc_dev: lirc_register_plugin: sample_rate: 0
>>>> [4332356.204000] lirc_sir: I/O port 0x02f8, IRQ 3.
>>>> [4332356.204000] lirc_sir: Installed.
>>>>
>>>> $ sudo mode2 -d /dev/lirc0
>>>> space 16777176
>>>> pulse 9000
>>>> space 4493
>>>> pulse 593
>>>> space 1653
>>>> pulse 592
>>>> space 1654
>>>> pulse 593
>>>>
>>>> [snip]
>>>>
>>>>
>>>>
>>>> Cheers,
>>>> Paul.
>>>>
>>>>
>>>>
>>>> Manuel López-Ibáñez wrote:
>>>>
>>>>
>>>>
>>>>  
>>>>
>>>>> Hi ursus and others,
>>>>>
>>>>> Could you elaborate on which hardware and software configuration are
>>>>> you using to achieve remote control of the laptop? Please, provide
>>>>> versions of kernel, kernel modules and software and any parameters
>>>>> that may be involved (even if you do not provided). Don't need to
>>>>> post
>>>>> any configuration file that may exist in my distribution.
>>>>>
>>>>> Cheers,
>>>>>  Manuel.
>>>>>
>>>>> x wrote:
>>>>>
>>>>>  
>>>>>
>>>>>    
>>>>>
>>>>>> Paul--
>>>>>> --- Paul Koufalas <[email protected]> wrote:
>>>>>>
>>>>>>
>>>>>>   
>>>>>>      
>>>>>>
>>>>>>> G'day all.
>>>>>>>
>>>>>>> Was there any conclusion to how to make use of the infrared and
>>>>>>> remote
>>>>>>> control? (see below)
>>>>>>>     
>>>>>>>        
>>>>>>
>>>>>>
>>>>>> 1. xmms with lirc-plugin works ok (kind of cool to see the
>>>>>> volume-slider
>>>>>> move from RC).
>>>>>> 2. Couldn't get mplayer or vlc going. don't know, if they need a
>>>>>> plugin
>>>>>> or need to be compiled especially with lirc-support, using
>>>>>> binaries    from videolan.org resp. linuxpackages.net.
>>>>>> 3. Got last MoviX2 and remastered the CD, editing some cfg-files for
>>>>>> my TV-remote and second attempt worked, so if u have trouble for
>>>>>> testing I'd recommend trying MoviX2, as it's pretty "lirc-ready",
>>>>>> though it doesn't have all the lirc cfg- & testing tools included.
>>>>>> If u find an existing cfg-file for specific RC it's sure easier.
>>>>>>
>>>>>> HTH & HAND
>>>>>>
>>>>>> ursus
>>>>>>
>>>>>>
>>>>>>  
>>>>>>
>>>>>>  
>>>>>>     ___________________________________________________________
>>>>>> Telefonate ohne weitere Kosten vom PC zum PC:
>>>>>> http://messenger.yahoo.de
>>>>>>
>>>>>>
>>>>>>   
>>>>>>      
>>>>>
>>>>>
>>>>>     ______________________________________________ LLama Gratis a
>>>>> cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo
>>>>> por
>>>>> minuto. http://es.voice.yahoo.com
>>>>>
>>>>>
>>>>>  
>>>>>
>>>>>    
>>>>
>>>>
>>>>
>>>>  
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>        
> ______________________________________________ LLama Gratis a
> cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por
> minuto. http://es.voice.yahoo.com
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.