LinuxMCE Forums

General => Users => Topic started by: jamo on July 05, 2013, 09:53:02 am

Title: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 05, 2013, 09:53:02 am
As promised, opening a new thread since I got the template up and running and autodetecting in the following thread:

http://forum.linuxmce.org/index.php/topic,13309.0.html

Now the problem is getting the multimedia keys working... which is why I need a template in the first place since the rest of the keyboard works otb.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 05, 2013, 06:57:13 pm
Have you read this: http://wiki.linuxmce.org/index.php/Creating_a_Device_Template_for_a_Remote_that_uses_the_kernel_input_subsystem ?

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 07, 2013, 12:56:41 pm
Thanks Tschak...

Have read it and applied it. Works very well. What was messing things up was that I was battling to run "xev" because it wants to use "X" - ie it asks for 'DISPLAY' enviro variable to be set and generally I'm running it from a text terminal.

I tried setting 'DISPLAY' to '192.168.80.4:0.0' which worked a bit but didn't get the events coming through nicely... some errors/messages in xev where I think it's fighting with LMCE over the window visibility... so I just plugged the Rii into my zoneminder server and ran xev there and copied all the keycodes I needed.

Have created the template and it's working brilliantly. Very pleased, thanks for the pointers.

Now to share the template with others- are the instructions in
http://wiki.linuxmce.org/index.php/LinuxMCEsqlCVScommitProcedure
still relevant. What's a mantis ticket?

PS have already wikified (http://wiki.linuxmce.org/index.php/Rii_Mini_i8) on the assumption that I'll share the device template with others.

Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 07, 2013, 06:38:49 pm
You need to:

- create a ticket over at svn.linuxmce.org, and keep note of the #
- use sqlcvs diff in web admin to check in your changes to dce. Hopefully this is the only template you have added or changed?
- in the comment, please reference the trac ticket #
- we will look it over and check it in.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 08, 2013, 09:00:23 am
Thanks!

 :-[

And if I've changed one or two others....? Is there any way of isolating them at sqlcvs diff time?
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 08, 2013, 05:01:17 pm
Yes, on the sqlCVS diff screen, you'll see entries that have changed. That's why you're there.

You'll notice each change has a check box next to it, if you uncheck it, that change will not be sent to our server.

You'll need to dig into the database, and match the primary keys it is showing you, with the rows in the database, to see which rows are relevant, and uncheck the rows that do not involve the Rii template.

And, for next time, please only work on one device template at a time, before submitting. :)

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 08, 2013, 09:22:30 pm
And, for next time, please only work on one device template at a time, before submitting. :)
Now you tell me!!
OK... so I need to take screenshots of all those shiny new templates I've created because my DB is so out of date I need to update the sucker and then add them back and *then* submit. hmm...

All learning is good. Thanks Thom, appreciate the help... hope my piddly little effort can help someone else one day.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: mkbrown69 on July 08, 2013, 09:38:17 pm
OK... so I need to take screenshots of all those shiny new templates I've created because my DB is so out of date I need to update the sucker and then add them back and *then* submit. hmm...
Jamo,

One trick I use is to create a text file for each parameter (i.e. #373), and copy/paste from/into the WebUI.  That way, I can use an editor with Ruby syntax highlighting, and keep a copy aside for back-up purposes.

Hope that helps!

/Mike
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 08, 2013, 09:41:24 pm
Your effort is not piddly, the fact that you are doing this at all, makes you a man amongst mice. :)

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 08, 2013, 09:51:35 pm
Just say, completely hypothetically speaking, that I completely cooked the database....

Am I looking at a re-install of linuxmce?

If, for the sake of argument, I had run the sqlCVSupdate from the web-admin.... checked all the update options ... then pressed submit... while logged in as root to the pluto_main db from a terminal. and then, after waiting a reasonable time for a blank firefox window that said only "Waiting for dcerouter..." at the bottom, that I'd tried again to log in to pluto_main from the terminal, and found a bunch of error stuff scrolling past the screen ending in something like

Code: [Select]
nnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130708 21:46:26  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
130708 21:46:26  InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
130708 21:46:26 [ERROR] Plugin 'InnoDB' init function returned error.
130708 21:46:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld: Too many arguments (first extra is 'pluto_main').
Use --verbose --help to get a list of available options
130708 21:46:26 [ERROR] Aborting

130708 21:46:26 [Note] mysqld: Shutdown complete

Would that be a bad thing? Would it be advisable to carry on "Waiting for dcerouter...." and go to bed..... and see what it looked like in the morning? Or should I start downloading the latest snapshot now?
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 08, 2013, 09:54:32 pm
Woah, forgot about rule#1.  8)
update came back with success.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 08, 2013, 10:07:59 pm
Done... I think I've checked the sucker in against ticket http://svn.linuxmce.org/trac.cgi/ticket/1836
 :o
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 08, 2013, 10:26:22 pm
I've approved the template.

However, I do need to explain something:

sqlCVS is very clever...but also very finicky...

Basically, if your database is not always up to date, then when a device template is scheduled to be approved, the various foreign keys in database tables may not be updated properly, (Basically, the device template # shifted because you had an old copy of the database, then you updated, and sqlCVS moved your device template # to the highest psc_id value (which is 2374 at the moment, we really need to reset the psc id's!), so when you sent in the submission, the device template was assigned the # 2262, but the records all had #2374 attached to them.. I went through and corrected the issue.

Now,

You also seem to have added a manufacturer (#1172), but this is actually part of the IR repository, so, for now, I have set the manufacturer to 1, so the database is correct for the moment.

You need to do the following steps, to get everything up to date:

* sqlCVS update, to pull in my changes.
* reset the manufacturer from Pluto to your new manufacturer (if needed)
* sqlCVS diff the ir repository, and have it check in your new manufacturer row
* sqlCVS diff the dce repository, and have it check in the change to the manufacturer (if needed)

Thanks so much for the submission, I wish more people would add support for hardware. :)

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 09, 2013, 10:15:45 pm
Hi Thom

Thanks again... I've done what you suggested - checked in the new manufacturer (Rii) and the updated mini i8 template linked to this manufacturer but I'm afraid we're probably going to have another key issue.... because the manufacturer number (mine) will probably differ with the master.

Shucks.... at the end of this I'm going to search the wiki for every entry that refers to creating a device template and put in bold at the top !!Make sure you update your datbase *before* merrily creating templates if you want to share with the rest of the class!!

When you get a moment, please check the submissions and see if they can work.

Ta
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 16, 2013, 11:27:05 am
Oh, no.... I think it's cooked. I went a away for a few days and shutdown the core. When I start up again, none of my MDs or orbiters come up properly... and dmesg reports a segfault from libpluto_main.so (IIR) in updateEntArea or something. I wonder if this is due to a corrupt device database - missing PKs or FKs or something?

I can scan through the DB manually but may be difficult to determine exactly where the problems are. Is there any way I can start with a "clean" pluto_main databse and then add everything from there? I took screenshots of my new devices and saved the IR codes anyway just in case of this scenario?
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 16, 2013, 06:14:33 pm
can you post the output of the dmesg?

The system drops core dump files in /usr/pluto/coredump, which are time stamped. These can be used to diagnose where the problem might be.

To use them, notice they're named for the program that failed, core_blablabla, etc. in our case core_UpdateMedia_XXXXXXXX where XXXXX is a time stamp.

you can run gdb against them, and it will tell you where the program stopped, and you can get a backtrace, example (from the core, root shell):

Code: [Select]
dcerouter_1031482:/home# cd /usr/pluto/coredump
dcerouter_1031482:/usr/pluto/coredump# ls
core_Photo_Screen_Sa_1373691026_6  core_Slim_Server_Str_1373565907_11  core_UpdateMedia_1373319234_11
dcerouter_1031482:/usr/pluto/coredump# cd /usr/pluto/bin/
dcerouter_1031482:/usr/pluto/bin# gdb /usr/pluto/bin/UpdateMedia /usr/pluto/coredump/core_UpdateMedia_1373319234_11
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/pluto/bin/UpdateMedia...done.
[New Thread 10989]
[New Thread 11030]

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /usr/lib/libmysqlclient_r.so.16...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libmysqlclient_r.so.16
Reading symbols from /usr/pluto/lib/libpluto_media.so...(no debugging symbols found)...done.
Loaded symbols for /usr/pluto/lib/libpluto_media.so
Reading symbols from /usr/pluto/lib/libpluto_main.so...(no debugging symbols found)...done.
Loaded symbols for /usr/pluto/lib/libpluto_main.so
Reading symbols from /usr/pluto/lib/libDCECommon.so...done.
Loaded symbols for /usr/pluto/lib/libDCECommon.so
Reading symbols from /usr/pluto/lib/libSerializeClass.so...(no debugging symbols found)...done.
Loaded symbols for /usr/pluto/lib/libSerializeClass.so
Reading symbols from /usr/pluto/lib/libPlutoUtils.so...done.
Loaded symbols for /usr/pluto/lib/libPlutoUtils.so
Reading symbols from /lib/tls/i686/cmov/libpthread.so.0...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libpthread-2.11.1.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libpthread.so.0
Reading symbols from /usr/lib/libid3-3.8.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libid3-3.8.so.3
Reading symbols from /usr/lib/libtag.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libtag.so.1
Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/tls/i686/cmov/libm.so.6...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libm-2.11.1.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/tls/i686/cmov/libc.so.6...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libc-2.11.1.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/tls/i686/cmov/libcrypt.so.1...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libcrypt-2.11.1.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libcrypt.so.1
Reading symbols from /lib/tls/i686/cmov/libnsl.so.1...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libnsl-2.11.1.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libnsl.so.1
Reading symbols from /lib/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.11.1.so...done.
done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `/usr/pluto/bin/UpdateMedia -d /home/public/data/videos/Main Disk [35]/TV Shows'.
Program terminated with signal 11, Segmentation fault.
#0  __strlen_sse2 () at ../sysdeps/i386/i686/multiarch/strlen.S:99
99 ../sysdeps/i386/i686/multiarch/strlen.S: No such file or directory.
in ../sysdeps/i386/i686/multiarch/strlen.S
(gdb) bt
#0  __strlen_sse2 () at ../sysdeps/i386/i686/multiarch/strlen.S:99
#1  0x00748332 in std::string::operator=(char const*) () from /usr/lib/libstdc++.so.6
#2  0x0805b02f in main (argc=6, argv=0xbf8b4b74) at Main.cpp:395
(gdb) quit


Can you do that against the process that failed, and give me the output?

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 17, 2013, 07:59:17 am
Sweet, thanks. Will try to hit this tonight.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 17, 2013, 10:23:37 pm
dmesg output:

http://pastebin.com/SUq81gMt

And here's the gdb output
Code: [Select]
Core was generated by `/usr/pluto/bin/UpdateEntArea -h localhost -P 3306 -u root -D pluto_main'.
Program terminated with signal 11, Segmentation fault.
#0  Row_DeviceTemplate::FK_DeviceCategory_get (this=0x0) at Table_DeviceTemplate.cpp:248
248 Table_DeviceTemplate.cpp: No such file or directory.
in Table_DeviceTemplate.cpp

So it does seem to be to do with mucking about with the device templates....
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 17, 2013, 10:48:32 pm
in mySQL, do a SELECT * from DeviceTemplate WHERE FK_DeviceCategory=NULL;

-Thom

p.s. did you add a new device category?

Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 17, 2013, 10:57:19 pm
Thanks, checked for nulls on FK_DeviceCategory, then checked for non existant categories in the FK of DeviceTemplate... nothing.

But I *did* find my old Device with an FK_DeviceTemplate that didn't exist -> set to the old devicetemplate of the Rii before I sqlcvsed myself. Updated to the new template ID and...
voila...

we're back in business.

So, I'm guessing here, the issue was that I already had a Device in the Device table, which pointed to a non-existant template. Presumably, the code was trying to get the DeviceCategory of the non-existant template so it looked like a DeviceCategory issue. Red-herring.

All good, though, screen is back and I can pick up from there.

Thanks a stack, Thom...  useful info on the gdb and coredump stuff that I can use in future. I even found the offending line in TableDeviceTemplate.cpp:
Code: [Select]
long int Row_DeviceTemplate::FK_DeviceCategory_get(){PLUTO_SAFETY_LOCK_ERRORSONLY(sl,table->database->m_DBMutex);

return m_FK_DeviceCategory;}

but I haven't a cooking clue what it does... that's a battle for another day perhaps.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 18, 2013, 12:30:16 am
Good, I'm glad that got sorted. Looks like we need to add additional checking in UpdateEntArea to actually check if we have a proper pointer to a database row, before trying to use its accessor.

Basically, the chunk of code you're looking at, is what we call an "accessor" in object oriented programming speak. It returns whatever value you're asking about, in this case, it returns the FK_DeviceCategory value that is present in the DeviceTemplate row that you're asking about. All the PLUTO_SAFETY_LOCK() macro is basically to ensure that only one interested party can access this method at a time (to avoid race conditions).

The issue you experienced is always a potential issue when trying to send stuff to sqlCVS and you didn't update your database BEFORE starting your template work.

You can remove the core dump files in /usr/pluto/coredump, as they are probably taking up a nice chunk of space.

-Thom
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: jamo on July 18, 2013, 01:49:18 pm
Ok... did some digging through the code and I have a vague idea what you're talking about. I must say there were no obvious ways of making it idiot-proof to me so I think we should, at this point, just say make sure every device in your database has a valid device template associated to it and it's only likely to become a problem if you've either been mucking about in the db yourself *blush* or sqlcvsing without first updating and coming off a common solid base.

Ta, I'll remove the coredump files and soldier on.

Thom, can you carry on and check out my last sqlcvs submit? I added the "Rii" manufacturer but, as mentioned earlier, it may need a PK correction due to my having other devices in my system.
Title: Re: Rii mini i8 wifi multimedia keyboard template: getting multimedia keys working
Post by: tschak909 on July 18, 2013, 05:56:12 pm
ok, I'll do it today.

-Thom