Mantis Bugtracker

Расширенный вид комментарии ] простой вид ] история ] печать ]
Номер Категория Серьезность Воспроизводимость Создан Изменен
0000028 [obex-data-server] General нововведение всегда 2007-12-11 17:30 2009-10-21 20:13
Инициатор skirsdeda Видимость общая  
Ответственный skirsdeda
Приоритет низкий Решение решен Платформа
Состояние закрыт   Операционная система
Трудоемкость нет   Версия ОС
Примерный срок нет Решен в версии 0.4.5 Версия продукта
  Целевая версия 0.4.5 Сборка продукта
Суть 0000028: Implement support for other transports
Подробности USB cable transport would be quite useful, other transports are very low priority.
Шаги по воспроизведению
Дополнительные сведения
Tэги Нет прикрепленных тэгов.
Вложенные файлы ? file icon usb-transport.patch [^] (21,178 bytes) 2008-10-08 19:12
? file icon usb-transport-1.patch [^] (18,297 bytes) 2008-10-09 23:34
? file icon usb-transport-2.patch [^] (18,280 bytes) 2008-10-10 00:01
? file icon setup-usbtransport-fix.patch [^] (543 bytes) 2008-10-16 23:38

- Связи

-  Комментарии
hadess (инициатор)
2008-03-02 20:23

For the USB transport, I see no way to get the "identifier" for a device other than listing the devices using libusb ourselves or using OBEX_FindInterfaces().

That means that obex-data-server should add a function to list the devices openobex knows about.

array{string} ListUsbDevices();

And we'd add:

object CreateUsbSession(int interface_index);

And I believe usbobex_find_interfaces() in usbobex.c (openobex) would need to be fixed to allow itself to be called multiple times.
hadess (инициатор)
2008-03-02 20:58

libgphoto uses this info from the bus:
sprintf (info.path, "usb:%s,%s", bus->dirname, dev->filename);

So we can use that given a few openobex changes.

ods API:
object CreateUsbSession(string port); # Port is "usb:XXX,YYY"

We would discover the dirname, filename using either libusb or HAL[1], ods woud parse the string, create a obex_usb_intf_transport_t from it, and use OBEX_InterfaceConnect().

[1]: [^]
skirsdeda (администратор)
2008-03-06 19:21

Firstly, ods only uses fd (socket) transport in openobex (because Server,Session and ServerSession objects are transport agnostic), so OBEX_InterfaceConnect and OBEX_FindInterfaces functionality has to be reimplemented in ods.

It would be nice if ListUsbDevices() would work by querying HAL instead of using libusb, since AFAIK using libusb requires iterating through _all_ usb interfaces to find the needed ones. BTW, I looked at HAL info for my mobile (Sony Ericsson) and it has all the needed information to find interface for obex transfers.
hadess (инициатор)
2008-03-07 18:50

See also: [^]
alexbk (инициатор)
2008-10-08 19:28

I've written and tested a patch that implements support in
obex-data-server for USB transport. The comments from Tadas are:

"1) We should use only FD transport from openobex library. That way we can use the same session/server/server_session code for all real transports (bluetooth, usb, etc.)"

USB is an exception here, because there is no file descriptor associated with an USB OBEX interface. To have one, a kernel driver would be needed, and kernel developers have said that they don't want such a driver, and prefer all OBEX stuff to be done in userspace. Thus, OpenOBEX is using libusb and its iterative API, and that's why the patch introduces usb-specific session code.

"2) All USB interface code should be either copied from openobex (there's not that much actually) or it should be written from scratch. For desktop use-cases using HAL would be much better than plain libusb. HAL detects OBEX USB interfaces quite well (at least for the devices that I have) and it is pretty easy to use HAL."

HAL could (and should) be used for detecting OBEX interfaces when they appear, however the lack of a file descriptor means that OpenOBEX interface discovery code must be used from upper layer (ods) before opening a USB OBEX session.
skirsdeda (администратор)
2008-10-09 19:59

I took a closer look at the patch and here are my new comments:
1) Let's not break GObject conventions and not split ods_session_new into ods_fdsession_new and ods_usbsession_new. Just add usb_inface_num argument to ods_session_new.
2) Why is ods_process_usb_input public and why it is added to mainloop from ods_obex_send function? Can't this be done in usb transport initialization (ods_session_setup_usbtransport)?
3) No need to split ods_manager_session_list_add into ods_manager_session_list_add_btsession and ods_manager_session_list_add_usbsession. Again, just add usb_interface_number arg to ods_manager_session_list_add.
4) No need to define create_usb_session_full, client_usb_connected_cb (they are called only in one place!). No need for OdsManagerCreateUsbSessionData either.
5) ods_manager_get_usb_interfaces_num leaks *handle and *obex_intf.
6) ods_manager_get_usb_interface_info leaks *handle (in second error check) and *obex_intf.
alexbk (инициатор)
2008-10-09 23:54

I have attached a new version of the patch:
1) 3) 4) fixed
5) 6) *handle leaking fixed, obex_intf is not leaked because it is deallocated in OBEX_Cleanup()

2) Libusb does not provide a way to set up a callback data reader function, similar to obex_io_callback. So we need to explicitly make such a function call but only when we expect data to be read - right after OBEX_Request in ods_obex_send. ods_process_usb_input is in ods-session.c (it is using some private things from ods-session.c) so I made it public to make it visible from ods-obex.c - let me know if there's a better way to do that.
alexbk (инициатор)
2008-10-10 00:01

And even newer one, to resolve a svn conflict :)
skirsdeda (администратор)
2008-10-10 01:52

Thanks for new version of patch, I'll look at it once again and if everything is fine it can be pushed to svn.
skirsdeda (администратор)
2008-10-11 19:11

Patch applied in svn rev 2027. I decided to add one more argument to CreateUsbSession(), namely profile. Although FTP is definitely the most common case, but some syncing profiles can also be used through USB OBEX AFAIK. BTW, I only looked at helper functions but didn't try testing actual USB session yet.

So the next thing for transport support should probably be USB servers.
alexbk (инициатор)
2008-10-12 09:53

Looks good, thanks a lot. As for USB servers, they are not supported by libusb yet, so I think we can close this issue.
Thoemy (инициатор)
2008-10-16 23:37

I tried revision 2060 but connecting to my Nokia phone failed without a error message.
The attached patch fixes this problem. I don't know if it causes any other problems.

Unfortunately RetrieveFolderListing() does not work. The calling python script says "dbus.exceptions.DBusException: org.openobex.Error.Failed: Operation failed (unexpected response)" and the daemon writes this "** Message: obex_request_done: command 3, response 76 (Unknown response)".
Same problem with ChangeCurrentFolder() and CreateFolder(). But SendFile() and GetCapability() works.

The obexftp command lists the files on the phone without problems. So I guess the problem is somewhere in ods. I tried to find the problem myself, but so far I had no luck. Hopefully you can fix the problem or point me into the right direction. Any more information I can provide?

GetCapability output:
<?xml version="1.0" ?>
<!DOCTYPE Capability SYSTEM "obex-capability.dtd">
<Capability Version="1.0">
<SW Version="V 05.24" Date="20041125T120000"/>
<HW Version="0721"/>
<!-- DEV memory -->
<!-- MMC memory -->
<!-- APPL memory -->
skirsdeda (администратор)
2008-10-17 01:02

Please also post the output of obexftp
skirsdeda (администратор)
2008-10-17 15:32

Did some changes in svn revision 2067 and included provided patch. Hopefully this fixes RetrieveFolderListing() and others since they were returning OBEX response PRECONDITION FAILED (probably because no target UUID was sent along with Connect command). I don't have a proper way to test this ATM so please test :)
alexbk (инициатор)
2008-10-17 17:40

I was testing this with a Nokia Series 60 phone, while Thoemy is using a Series 40 phone - they run completely different operating systems and OBEX implementations. I can't test the changes at the moment, but they seem quite safe to me, and shouldn't break Series 60 support.
Thoemy (инициатор)
2008-10-17 23:53
изменен: 2008-10-18 00:21

RetrieveFolderListing() works! Thank you! I will do further tests and report any problems I can find.

Do you still need the obexftp output?

skirsdeda (администратор)
2008-10-18 10:42

Don't need obexftp output anymore.. Great that it works though :)

Yet I have tried several Sony Ericsson phones and their USB interfaces provide no info, connect fails :(
skirsdeda (администратор)
2009-08-25 23:55

as of svn rev 2856, TTY server support has been added.

- история
Дата изменения Пользователь Поле Изменение
2007-12-11 17:30 skirsdeda Новый вопрос
2007-12-11 17:30 skirsdeda Состояние новый => назначен
2007-12-11 17:30 skirsdeda Ответственный => skirsdeda
2007-12-11 17:47 skirsdeda version => 1.0
2008-01-18 15:29 hadess Отслеживать: hadess
2008-03-02 20:23 hadess Комментарий добавлен: 0000112
2008-03-02 20:58 hadess Комментарий добавлен: 0000113
2008-03-06 19:21 skirsdeda Комментарий добавлен: 0000134
2008-03-07 18:50 hadess Комментарий добавлен: 0000151
2008-10-08 19:12 alexbk Файл добавлен: usb-transport.patch
2008-10-08 19:12 alexbk Отслеживать: alexbk
2008-10-08 19:28 alexbk Комментарий добавлен: 0000446
2008-10-09 19:59 skirsdeda Комментарий добавлен: 0000449
2008-10-09 23:34 alexbk Файл добавлен: usb-transport-1.patch
2008-10-09 23:54 alexbk Комментарий добавлен: 0000458
2008-10-10 00:01 alexbk Файл добавлен: usb-transport-2.patch
2008-10-10 00:01 alexbk Комментарий добавлен: 0000459
2008-10-10 01:52 skirsdeda Комментарий добавлен: 0000460
2008-10-11 19:11 skirsdeda Комментарий добавлен: 0000469
2008-10-12 09:53 alexbk Комментарий добавлен: 0000471
2008-10-16 23:37 Thoemy Комментарий добавлен: 0000473
2008-10-16 23:38 Thoemy Файл добавлен: setup-usbtransport-fix.patch
2008-10-17 01:02 skirsdeda Комментарий добавлен: 0000474
2008-10-17 15:32 skirsdeda Комментарий добавлен: 0000476
2008-10-17 17:40 alexbk Комментарий добавлен: 0000478
2008-10-17 23:53 Thoemy Комментарий добавлен: 0000483
2008-10-18 00:21 Thoemy Комментарий изменен: 0000483
2008-10-18 10:42 skirsdeda Комментарий добавлен: 0000484
2009-08-25 23:54 skirsdeda Целевая версия => 0.4.5
2009-08-25 23:55 skirsdeda Комментарий добавлен: 0000659
2009-08-25 23:55 skirsdeda Состояние назначен => отработан
2009-08-25 23:55 skirsdeda Решен в версии => 0.4.5
2009-08-25 23:55 skirsdeda Решение открыт => решен
2009-10-21 20:13 skirsdeda Состояние отработан => закрыт

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker