From: Alexander Holler <holler@ahsoftware.de>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] Success: switching the Logitech-Hub
Date: Sun, 04 Jan 2004 07:25:38 +0100 [thread overview]
Message-ID: <9810000.1073197538@[192.168.207.2]> (raw)
Hi,
lsusb:
Bus 001 Device 004: ID 046d:c707 Logitech, Inc.
Bus 001 Device 003: ID 046d:c704 Logitech, Inc.
Bus 001 Device 002: ID 0451:2036 Texas Instruments, Inc. TUSB2036 Hub
Bus 001 Device 001: ID 0000:0000
Just be sure you have sshd up and running before switching the hub when
using the diNovo Keyboard. ;)
This is also the reason for putting one of those stupid disclaimers into
the source.
-------------------- logi2hci.cpp --------------------
/*
logi2hci
Small utility for switching the Logitech Bluetooth-Hub from USB-HID-mode
into bluetooth-operation.
(c) 2003 Alexander Holler
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation;
Legal stuff:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM,
OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE
USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS
DISCLAIMED.
Kernel-patch for 2.6.0 needed:
http://sourceforge.net/mailarchive/forum.php?thread_id=3581364&forum_id=53
98
*/
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <asm/types.h>
#include <linux/hiddev.h>
#include <string.h>
#include <unistd.h>
static int send_report(int fd, const char *values)
{
struct hiddev_report_info rinfo;
struct hiddev_usage_ref uref;
for(int i=0; i<6; ++i ) {
memset( &uref, 0, sizeof(uref) );
uref.report_type = HID_REPORT_TYPE_OUTPUT;
uref.report_id = 0x10;
uref.field_index = 0;
uref.usage_index = i ;
uref.usage_code=0xff000001; // not needed just as beautifier
uref.value = values[i];
int rc=ioctl(fd, HIDIOCSUSAGE, &uref);
if(rc)
return rc;
}
memset( &rinfo, 0, sizeof(rinfo) );
rinfo.report_type = HID_REPORT_TYPE_OUTPUT;
rinfo.report_id = 0x10;
rinfo.num_fields = 1;
return ioctl(fd, HIDIOCSREPORT, &rinfo);
}
int main(void)
{
int fd, rc;
if ((fd = open("/dev/usb/hid/hiddev0", O_RDONLY)) <= 0) { // I have only
one hiddev
printf("error opening device\n");
return 1;
}
/*
rc=ioctl(fd, HIDIOCINITREPORT,0);
if(rc) {
perror(NULL);
return 2;
}
*/
char report1[] = {
0xff, 0x80, 0x80, 0x01, 0x00, 0x00
};
rc=send_report(fd, report1);
if(rc) {
perror(NULL);
return 3;
}
char report2[] = {
0xff, 0x80, 0x00, 0x00, 0x30, 0x00
};
rc=send_report(fd, report2);
if(rc) {
perror(NULL);
return 4;
}
char report3[] = {
0xff, 0x81, 0x80, 0x00, 0x00, 0x00
};
rc=send_report(fd, report3);
if(rc) {
perror(NULL);
return 5;
}
close(fd);
return 0;
}
-------------------- logi2hci.cpp --------------------
Now, a hid-howto is needed. ;)
Regards,
Alexander
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next reply other threads:[~2004-01-04 6:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-04 6:25 Alexander Holler [this message]
2004-01-05 1:43 ` [Bluez-devel] Success: switching the Logitech-Hub Marcel Holtmann
2004-01-05 2:42 ` Alexander Holler
2004-01-06 17:15 ` Olivier Bornet
2004-01-06 17:48 ` Marcel Holtmann
2004-01-06 17:53 ` Olivier Bornet
2004-01-07 1:51 ` Alexander Holler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='9810000.1073197538@[192.168.207.2]' \
--to=holler@ahsoftware.de \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.