2004-01-04 06:25:38

by Alexander Holler

[permalink] [raw]
Subject: [Bluez-devel] Success: switching the Logitech-Hub

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2004-01-07 01:51:52

by Alexander Holler

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hello,

--On Dienstag, Januar 06, 2004 18:48:55 +0100 Marcel Holtmann
<[email protected]> wrote:

>> One question: I can't switch back to USB mode. Is this not supported at
>> this time ?
>
> No. I think it is possible, but at the moment we don't understand how
> the Logitech protocol works. I have some written notes about it on my
> desktop, because they also use the same protocol framework for driving
> the display of the mediapad. But I haven't found the time to setup a
> webpage about it.

I don't know if Logitech knows how to switch back. ;)

At least I've send them a bug report, that the widcomm-stack should switch
back to usb-mode when deinstalling the stack.

I've discovered that because I've got the answer "reinstall all" 2 times
for a problem. But deinstalling the stack leaves me with a box, I could
only reset using a hw-switch, which isn't that fine. The problem I now
have, is to explain this to help desk. The first time they didn't
understand what I mean. ;)

When they will fix that, I will try to log the usb-communication while
deinstalling the stack, which should give me the correct sequence of
reports for switching back.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-01-06 17:53:18

by Olivier Bornet

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hi Marcel,

> > one of our device has an ID of 0x046d:0xc703. Can you add it to the
> > hid2hci.c file in the CVS ? I have tested it, and it works OK.
>
> done.

Thanks. :-)

> > One question: I can't switch back to USB mode. Is this not supported at
> > this time ?
>
> No. I think it is possible, but at the moment we don't understand how
> the Logitech protocol works. I have some written notes about it on my
> desktop, because they also use the same protocol framework for driving
> the display of the mediapad. But I haven't found the time to setup a
> webpage about it.

OK, thanks for the info. And good luck in your search.

Olivier
--
Olivier Bornet | fran?ais : http://puck.ch/f
Swiss Ice Hockey Results | english : http://puck.ch/e
http://puck.ch/ | deutsch : http://puck.ch/g
[email protected] | italiano : http://puck.ch/i
Get my PGP-key at http://puck.ch/pgp or at http://wwwkeys.pgp.net


Attachments:
(No filename) (980.00 B)
(No filename) (189.00 B)
Download all attachments

2004-01-06 17:48:55

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hi Olivier,

> one of our device has an ID of 0x046d:0xc703. Can you add it to the
> hid2hci.c file in the CVS ? I have tested it, and it works OK.

done.

> One question: I can't switch back to USB mode. Is this not supported at
> this time ?

No. I think it is possible, but at the moment we don't understand how
the Logitech protocol works. I have some written notes about it on my
desktop, because they also use the same protocol framework for driving
the display of the mediapad. But I haven't found the time to setup a
webpage about it.

Regards

Marcel




-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-01-06 17:15:10

by Olivier Bornet

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hi Marcel and Alexander,

Great work. :-)

> > Bus 001 Device 004: ID 046d:c707 Logitech, Inc.
> > Bus 001 Device 003: ID 046d:c704 Logitech, Inc.

one of our device has an ID of 0x046d:0xc703. Can you add it to the
hid2hci.c file in the CVS ? I have tested it, and it works OK.

One question: I can't switch back to USB mode. Is this not supported at
this time ?

Good day.

Olivier
--
Olivier Bornet | fran?ais : http://puck.ch/f
Swiss Ice Hockey Results | english : http://puck.ch/e
http://puck.ch/ | deutsch : http://puck.ch/g
[email protected] | italiano : http://puck.ch/i
Get my PGP-key at http://puck.ch/pgp or at http://wwwkeys.pgp.net


Attachments:
(No filename) (720.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-01-05 02:42:27

by Alexander Holler

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hello,

--On Montag, Januar 05, 2004 02:43:56 +0100 Marcel Holtmann
<[email protected]> wrote:

>> lsusb:
>>
>> Bus 001 Device 004: ID 046d:c707 Logitech, Inc.
>> Bus 001 Device 003: ID 046d:c704 Logitech, Inc.

> A little bit weird is that the HID device 046d:c704 is still present
> after switching.

This is something I doesn't understand too. Either the Linux-USB stack is
missing the disconnect, or a 'magic' report in the switch-sequence for
finally disabling the usb-hid-device is missing.
Using Windows it seems the usb-hid-dev is removed after starting the
bluetooth-stack. I will check my win-logs if I could find another report
which could do this.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-01-05 01:43:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Success: switching the Logitech-Hub

Hi Alexander,

> 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. ;)

I modified the hid2hci program to support switching of the Logitech
Bluetooth wireless hub. Code is in CVS now and it should also support
the Apple devices with HID proxy out of the box.

A little bit weird is that the HID device 046d:c704 is still present
after switching.

Regards

Marcel




-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel